How to distribute an additional DLL to site-packages?

B

Bo Peng

Dear Python experts,

I am writing a python extension module that needs to link with a
third-party DLL. How can I copy this DLL to the site-packages directory
along with my extension modules? It seems that data_files parameter can
do this, but I do not know how to get the absolute destination
directory. After all, this directory is configurable.

I guess I need to determine /path/to/site-package for

setup(
...
ext_modules = [...]
data_files = [ ('/path/to/site-package', ['mydll.dll]) ]
)

using something like distutil.config.get_dest_dir().

Many thanks in advance.
Bo
 
B

Bo Peng

I am writing a python extension module that needs to link with a
third-party DLL. How can I copy this DLL to the site-packages directory
along with my extension modules? It seems that data_files parameter can
do this, but I do not know how to get the absolute destination
directory. After all, this directory is configurable.

So nobody has ever done this???

Bo
 
G

Gabriel Genellina

Bo Peng ha escrito:
So nobody has ever done this???

Use the package_data option. setup(..., packages=['yyy'],
package_data={'yyy':['xxx.dll']}, ...)
(Distutils documentation may be arcane sometimes, but this is easily
found at http://docs.python.org/dist/node12.html)
Absolute dirs are almost never necesary, usually all distutils commands
operate on relative paths (relative to location of setup.py for source
files, relative to some meaningful directory for targets).
 
B

Bo Peng

Use the package_data option. setup(..., packages=['yyy'],
package_data={'yyy':['xxx.dll']}, ...)
(Distutils documentation may be arcane sometimes, but this is easily
found at http://docs.python.org/dist/node12.html)
Absolute dirs are almost never necesary, usually all distutils commands
operate on relative paths (relative to location of setup.py for source
files, relative to some meaningful directory for targets).

I read that page but I am not using package so things are installed to
site-packages directly. What should I put for 'yyy'?

Bo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top