Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup.py: add FreeBSD #210

Closed
wants to merge 1 commit into from
Closed

setup.py: add FreeBSD #210

wants to merge 1 commit into from

Conversation

ilius
Copy link

@ilius ilius commented Oct 21, 2024

Tested with these commands after installing libzim from FreeBSD ports:

cp /usr/local/lib/libzim.so.9 libzim/
mkdir -p include/zim
cp /usr/local/include/zim/* include/zim
DONT_DOWNLOAD_LIBZIM=1 python setup.py install --user

@kelson42
Copy link
Contributor

kelson42 commented Oct 22, 2024

I'm not sure that this is a good idea to add a supported platform without CI.

@kelson42 kelson42 requested a review from rgaudin October 22, 2024 11:17
@rgaudin
Copy link
Member

rgaudin commented Oct 23, 2024

@ilius thank you for this but this is not the proper way to go.

This concept of supported platform is only for the download feature ; for platforms that we provide static binaries for.
For other platforms, there is no such thing as supported platform or not because we only require a working libzim.

As indicated in the README, to use a system-installed libzim, you should just request to use it:

CXXFLAGS=-I/usr/local/include USE_SYSTEM_LIBZIM=1 DONT_DOWNLOAD_LIBZIM=1 python -m build

I tested on a fresh FreeBSD install, and it worked (I used the Package and not the Port but I guess it's the same).

(.venv) [reg@freebie ~/python-libzim]$ CXXFLAGS=-I/usr/local/include USE_SYSTEM_LIBZIM=1 DONT_DOWNLOAD_LIBZIM=1 python -m build
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - cython == 3.0.11
  - delocate == 0.11.0 ; platform_system=='Windows'
  - setuptools == 74.1.1
  - wheel == 0.44.0
* Getting build dependencies for sdist...
running egg_info
writing libzim.egg-info/PKG-INFO
writing dependency_links to libzim.egg-info/dependency_links.txt
writing requirements to libzim.egg-info/requires.txt
writing top-level names to libzim.egg-info/top_level.txt
reading manifest file 'libzim.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'setup.cfg'
warning: no files found matching 'requirements-dev.txt'
warning: no files found matching 'libzim/*.py'
warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
warning: no previously-included files found matching 'libzim/*.dylib'
warning: no previously-included files found matching 'libzim/*.so'
warning: no previously-included files found matching 'libzim/*.so.*'
warning: no previously-included files found matching 'libzim/*.dll'
adding license file 'LICENSE'
writing manifest file 'libzim.egg-info/SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing libzim.egg-info/PKG-INFO
writing dependency_links to libzim.egg-info/dependency_links.txt
writing requirements to libzim.egg-info/requires.txt
writing top-level names to libzim.egg-info/top_level.txt
reading manifest file 'libzim.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'setup.cfg'
warning: no files found matching 'requirements-dev.txt'
warning: no files found matching 'libzim/*.py'
warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
warning: no previously-included files found matching 'libzim/*.dylib'
warning: no previously-included files found matching 'libzim/*.so'
warning: no previously-included files found matching 'libzim/*.so.*'
warning: no previously-included files found matching 'libzim/*.dll'
adding license file 'LICENSE'
writing manifest file 'libzim.egg-info/SOURCES.txt'
running check
creating libzim-3.6.0
creating libzim-3.6.0/libzim
creating libzim-3.6.0/libzim.egg-info
creating libzim-3.6.0/tests
copying files to libzim-3.6.0...
copying LICENSE -> libzim-3.6.0
copying MANIFEST.in -> libzim-3.6.0
copying README.md -> libzim-3.6.0
copying pyproject.toml -> libzim-3.6.0
copying setup.py -> libzim-3.6.0
copying tasks.py -> libzim-3.6.0
copying libzim/__init__.pyi -> libzim-3.6.0/libzim
copying libzim/libwrapper.cpp -> libzim-3.6.0/libzim
copying libzim/libwrapper.h -> libzim-3.6.0/libzim
copying libzim/libzim.pyx -> libzim-3.6.0/libzim
copying libzim/reader.pyi -> libzim-3.6.0/libzim
copying libzim/search.pyi -> libzim-3.6.0/libzim
copying libzim/suggestion.pyi -> libzim-3.6.0/libzim
copying libzim/version.pyi -> libzim-3.6.0/libzim
copying libzim/writer.pyi -> libzim-3.6.0/libzim
copying libzim/zim.pxd -> libzim-3.6.0/libzim
copying tests/test_libzim_creator.py -> libzim-3.6.0/tests
copying tests/test_libzim_reader.py -> libzim-3.6.0/tests
copying tests/test_libzim_version.py -> libzim-3.6.0/tests
copying libzim.egg-info/SOURCES.txt -> libzim-3.6.0/libzim.egg-info
Writing libzim-3.6.0/setup.cfg
Creating tar archive
removing 'libzim-3.6.0' (and everything under it)
* Building wheel from sdist
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - cython == 3.0.11
  - delocate == 0.11.0 ; platform_system=='Windows'
  - setuptools == 74.1.1
  - wheel == 0.44.0
* Getting build dependencies for wheel...
running egg_info
writing libzim.egg-info/PKG-INFO
writing dependency_links to libzim.egg-info/dependency_links.txt
writing requirements to libzim.egg-info/requires.txt
writing top-level names to libzim.egg-info/top_level.txt
reading manifest file 'libzim.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'requirements-dev.txt'
warning: no files found matching 'libzim/*.py'
warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
warning: no previously-included files found matching 'libzim/*.dylib'
warning: no previously-included files found matching 'libzim/*.so'
warning: no previously-included files found matching 'libzim/*.so.*'
warning: no previously-included files found matching 'libzim/*.dll'
adding license file 'LICENSE'
writing manifest file 'libzim.egg-info/SOURCES.txt'
* Building wheel...
Using found library at libzim.so.9. Adjust CFLAGS/LDFLAGS if needed
Compiling libzim/libzim.pyx because it changed.
[1/1] Cythonizing libzim/libzim.pyx
warning: libzim/zim.pxd:69:61: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
warning: libzim/zim.pxd:70:64: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
warning: libzim/zim.pxd:71:85: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
warning: libzim/zim.pxd:72:119: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
warning: libzim/zim.pxd:74:47: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
warning: libzim/zim.pxd:76:78: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
performance hint: libzim/libzim.pyx:101:4: Exception check on 'string_cy_call_fct' will always require the GIL to be acquired. Declare 'string_cy_call_fct' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: libzim/libzim.pyx:110:4: Exception check on 'blob_cy_call_fct' will always require the GIL to be acquired. Declare 'blob_cy_call_fct' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: libzim/libzim.pyx:176:4: Exception check on 'geoposition_cy_call_fct' will always require the GIL to be acquired. Declare 'geoposition_cy_call_fct' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: libzim/libzim.pyx:194:4: Exception check on 'hints_cy_call_fct' will always require the GIL to be acquired. Declare 'hints_cy_call_fct' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
warning: libzim/libzim.pyx:280:52: Unknown type declaration 'Creator' in annotation, ignoring
warning: libzim/libzim.pyx:287:62: Unknown type declaration 'Creator' in annotation, ignoring
warning: libzim/libzim.pyx:296:53: Unknown type declaration 'Creator' in annotation, ignoring
warning: libzim/libzim.pyx:307:73: Unknown type declaration 'Creator' in annotation, ignoring
warning: libzim/libzim.pyx:317:56: Unknown type declaration 'Creator' in annotation, ignoring
warning: libzim/libzim.pyx:324:49: Unknown type declaration 'Creator' in annotation, ignoring
warning: libzim/libzim.pyx:344:45: Unknown type declaration 'BaseWritingItem' in annotation, ignoring
running bdist_wheel
running build
running build_py
running egg_info
writing libzim.egg-info/PKG-INFO
writing dependency_links to libzim.egg-info/dependency_links.txt
writing requirements to libzim.egg-info/requires.txt
writing top-level names to libzim.egg-info/top_level.txt
reading manifest file 'libzim.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'requirements-dev.txt'
warning: no files found matching 'libzim/*.py'
warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
warning: no previously-included files found matching 'libzim/*.dylib'
warning: no previously-included files found matching 'libzim/*.so'
warning: no previously-included files found matching 'libzim/*.so.*'
warning: no previously-included files found matching 'libzim/*.dll'
adding license file 'LICENSE'
writing manifest file 'libzim.egg-info/SOURCES.txt'
creating build
creating build/lib.freebsd-14.1-RELEASE-amd64-cpython-311
creating build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/__init__.pyi -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/libwrapper.cpp -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/libwrapper.h -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/libzim.cpp -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/libzim.h -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/libzim.pyx -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/libzim_api.h -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/reader.pyi -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/search.pyi -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/suggestion.pyi -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/version.pyi -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/writer.pyi -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
copying libzim/zim.pxd -> build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
running build_ext
building 'libzim' extension
creating build/temp.freebsd-14.1-RELEASE-amd64-cpython-311
creating build/temp.freebsd-14.1-RELEASE-amd64-cpython-311/libzim
c++ -pthread -I/usr/local/include -fPIC -Ilibzim -I/tmp/build-env-afjexl8p/include -I/usr/local/include/python3.11 -c libzim/libwrapper.cpp -o build/temp.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/libwrapper.o -std=c++11 -Wall -Wextra
c++ -pthread -I/usr/local/include -fPIC -Ilibzim -I/tmp/build-env-afjexl8p/include -I/usr/local/include/python3.11 -c libzim/libzim.cpp -o build/temp.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/libzim.o -std=c++11 -Wall -Wextra
c++ -pthread -I/usr/local/include -pthread -shared -I/usr/local/include build/temp.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/libwrapper.o build/temp.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/libzim.o -L/usr/local/lib -lzim -o build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim.cpython-311.so
installing to build/bdist.freebsd-14.1-RELEASE-amd64/wheel
running install
running install_lib
creating build/bdist.freebsd-14.1-RELEASE-amd64
creating build/bdist.freebsd-14.1-RELEASE-amd64/wheel
creating build/bdist.freebsd-14.1-RELEASE-amd64/wheel/libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/libzim.cpp -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/reader.pyi -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/libzim.pyx -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/writer.pyi -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/libwrapper.h -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/libzim.h -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/suggestion.pyi -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/search.pyi -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/libzim_api.h -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/zim.pxd -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/version.pyi -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/__init__.pyi -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim/libwrapper.cpp -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim
copying build/lib.freebsd-14.1-RELEASE-amd64-cpython-311/libzim.cpython-311.so -> build/bdist.freebsd-14.1-RELEASE-amd64/wheel/.
running install_egg_info
Copying libzim.egg-info to build/bdist.freebsd-14.1-RELEASE-amd64/wheel/./libzim-3.6.0-py3.11.egg-info
running install_scripts
creating build/bdist.freebsd-14.1-RELEASE-amd64/wheel/libzim-3.6.0.dist-info/WHEEL
creating '/home/reg/python-libzim/dist/.tmp-p947kz78/libzim-3.6.0-cp311-cp311-freebsd_14_1_release_amd64.whl' and adding 'build/bdist.freebsd-14.1-RELEASE-amd64/wheel' to it
adding 'libzim.cpython-311.so'
adding 'libzim/__init__.pyi'
adding 'libzim/libwrapper.cpp'
adding 'libzim/libwrapper.h'
adding 'libzim/libzim.cpp'
adding 'libzim/libzim.h'
adding 'libzim/libzim.pyx'
adding 'libzim/libzim_api.h'
adding 'libzim/reader.pyi'
adding 'libzim/search.pyi'
adding 'libzim/suggestion.pyi'
adding 'libzim/version.pyi'
adding 'libzim/writer.pyi'
adding 'libzim/zim.pxd'
adding 'libzim-3.6.0.dist-info/LICENSE'
adding 'libzim-3.6.0.dist-info/METADATA'
adding 'libzim-3.6.0.dist-info/WHEEL'
adding 'libzim-3.6.0.dist-info/top_level.txt'
adding 'libzim-3.6.0.dist-info/RECORD'
removing build/bdist.freebsd-14.1-RELEASE-amd64/wheel
Successfully built libzim-3.6.0.tar.gz and libzim-3.6.0-cp311-cp311-freebsd_14_1_release_amd64.whl
(tests-env) [reg@freebie ~]$ python
Python 3.11.10 (main, Oct  8 2024, 01:06:24) [Clang 18.1.5 (https://github.com/llvm/llvm-project.git llvmorg-18.1.5-0-g617a15 on freebsd14
Type "help", "copyright", "credits" or "license" for more information.
>>> from libzim.reader import Archive
>>> zim = Archive("wikipedia_bpy_medicine_nopic_2023-05.zim")
>>> zim.main_entry
Entry(url=A/index, title=Main Page)
>>> zim.metadata_keys
['Counter', 'Creator', 'Date', 'Description', 'Flavour', 'Language', 'Name', 'Publisher', 'Scraper', 'Tags', 'Title']
>>> zim.get_metadata("Title")
b'WikiMed Medical Encyclopedia in Bishnupriya Manipuri'
>>>

@rgaudin rgaudin closed this Oct 23, 2024
@rgaudin rgaudin self-assigned this Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants