Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a dll/so to a python built distribution

I've compiled the python wrapper of nanomsg and I want to create a python installer for the package.

The package can be created by running

python setup.py bdist --format=wininst

However I would like nanomsg.dll/nanomsg.so to be included in the installer/package but I haven't found any documentation regarding this issue.

like image 957
shleimel Avatar asked Oct 19 '15 14:10

shleimel


People also ask

Can Python be compiled to DLL?

The standard Python "freeze" tool will create a C-language file which consists of the Python *. pyc files, and this file can be compiled to a DLL which can be shipped with your application.

Where do I put Python DLL files?

In the vast majority of cases, the solution is to properly reinstall python. dll on your PC, to the Windows system folder. Alternatively, some programs, notably PC games, require that the DLL file is placed in the game/application installation folder.

What is Python distribution package?

Distribution Package. A versioned archive file that contains Python packages, modules, and other resource files that are used to distribute a Release. The archive file is what an end-user will download from the internet and install.


1 Answers

As stated in the documentation here one needs to add the following code to his setup.py script:

setup(
    name='nanomsg',
    version=__version__,
    packages=[str('nanomsg'), str('_nanomsg_ctypes'), str('nanomsg_wrappers')],
    data_files=[(
        'lib\\site-packages\\', ["C:\\Dev\\external\\nanomsg\\x86\\Release\\nanomsg.dll"]
    )],
)
like image 131
shleimel Avatar answered Oct 14 '22 18:10

shleimel