delocate | Find and copy needed dynamic libraries into python wheels | Data Manipulation library
kandi X-RAY | delocate Summary
kandi X-RAY | delocate Summary
Find and copy needed dynamic libraries into python wheels
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Return a dict of cmdclass
- Extract version information from VCS
- Return the project root directory
- Construct a ConfigParser from a root
- Relocate a wheel in_sdir
- Delete libpath from tree path
- Ensures all libraries are unique
- Return a dictionary with the stripped version of the lib_dict
- Determine the directory to use for the library
- Return a set of package directories in root_path
- Create the versioneer config file
- Install versioneer
- Run git commands
- Deletes the library tree
- Extract the version information from the server
- Render pyp440 - post - tag
- Return a dictionary of libs from wheel files
- Scans the setup py and returns a boolean indicating whether it is missing
- Patch in_wheel with patch
- Strips the lib_dict from the lib_dict
- Decorator to ensure file permissions are set
- Fuse from to_wheel
- Fuse two trees
- Compare two files
- Copy a file to out_fname
delocate Key Features
delocate Examples and Code Snippets
Community Discussions
Trending Discussions on delocate
QUESTION
I'd like to specify a path for ctypes.util.find_library()
to search. How can I do this?
I'd like to do it from within Python.
I'm using macOS.
If I wanted to do it from outside Python, I can specify the location using LD_LIBRARY_PATH
. However I have read that I cannot modify this environment variable from within Python as it is cached on Python's startup. Modifying the value and then restarting Python seems like a very unusable idea; for example, what would happen if the library was imported part way through execution?
Why would I like to do this? Because I would like to add a MacOS wheel to a Python library that works under Windows. Currently they're packaging the DLLs into the same directory as the Python source files and adding that path to Windows' PATH environment, which ctypes.util.find_library()
searches--a technique that I can't seem to replicate under Mac.
I have tried to understand delocate. It seems to state that the Python library doesn't depend on any shared objects. I suspect this is because the dylibs are loaded dynamically using ctypes.util.find_library()
rather than being compiled code within Python.
Any suggestions would be gratefully received!
...ANSWER
Answered 2020-Sep-12 at 01:00Although there are environment variables (LD_LIBRARY_PATH
and DYLD_LIBRARY_PATH
) that impact the search path for shared libraries, they are read and fixed by Python when Python starts up. Thus that option was eliminated.
Instead, we took the approach hinted at in the Python documentation:
If wrapping a shared library with ctypes, it may be better to determine the shared library name at development time, and hardcode that into the wrapper module instead of using find_library() to locate the library at runtime.
We hard-coded the names of the libraries that were included for each operating system, plus we included a generic name for operating systems where the libraries were not included:
QUESTION
How can I create a Python C extension wheel for MacOS that is backwards compatible (MacOS 10.9+) using MacOS 10.15?
This is what I have so far:
...ANSWER
Answered 2020-Feb-28 at 00:13I found the solution to my problem and I will post the answer here in case someone else has the same problem.
In order to fix the problem I had to also set export MACOSX_DEPLOYMENT_TARGET=10.9
before I install python using pyenv
. Now pip wheel
creates my wheel with the tag macosx_10_9_x86_64
.
Thank you.
PS: When installing python via pyenv
, python is compiled from source, and somehow it takes into account the flag MACOSX_DEPLOYMENT_TARGET
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install delocate
You can use delocate like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page