distutils

How to install a dependency from a submodule in Python?

*爱你&永不变心* 提交于 2021-01-26 23:07:21
问题 I have a Python project with the following structure (irrelevant source files omitted for simplicity): myproject/ mysubmodule/ setup.py setup.py The file myproject/setup.py uses distutils.core.setup to install the module myproject and the relevant sources. However, myproject requires mysubmodule to be installed (this is a git submodule). So what I am doing right now is: myproject/$ cd mysubmodule myproject/mysubmodule/$ python setup.py install myproject/mysubmodule/$ cd .. myproject/$ python

How to install a dependency from a submodule in Python?

北城余情 提交于 2021-01-26 23:06:41
问题 I have a Python project with the following structure (irrelevant source files omitted for simplicity): myproject/ mysubmodule/ setup.py setup.py The file myproject/setup.py uses distutils.core.setup to install the module myproject and the relevant sources. However, myproject requires mysubmodule to be installed (this is a git submodule). So what I am doing right now is: myproject/$ cd mysubmodule myproject/mysubmodule/$ python setup.py install myproject/mysubmodule/$ cd .. myproject/$ python

Distutils setup generate .so and not .dylib on Mac OS X

时光毁灭记忆、已成空白 提交于 2020-07-19 07:03:05
问题 I've been trying to create C bindings for a Python library following an official tutorial presented by the developer of the latter library using Cython (https://www.ibisc.univ-evry.fr/~fpommereau/SNAKES/snakes-out-of-python.html). The cythonization of the library works perfectly. However, when calling the creation of the library file with distutils.core.setup on Mac OS X 10.10.5 , it produces a file .so . However, when I need to compile the example .c file with the library, I end up having

MANIFEST.in, package_data, and data_files clarification?

我与影子孤独终老i 提交于 2020-07-17 07:16:02
问题 I am trying to create a Python package, and I have a directory structure like this: mypkg/ ├── __init__.py ├── module1 │ ├── x.py │ ├── y.py │ └── z.txt └── module2 ├── a.py └── b.py Then I added all the files in MANIFEST.in and when I check the created archive, it had all the files. When I do python setup.py install in the dist-packages/mypkg/module1 . I see only the Python files and not z.txt . I have z.txt in both MANIFEST.in and setup.py : setup ( packages = [ 'mypkg', 'mypkg.module1',

How to specify C++11 with distutils?

本小妞迷上赌 提交于 2020-07-17 04:36:08
问题 I have a module that needs to be compiled with C++11. On GCC and Clang, that means a std=c++11 switch, or std=c++0x on older compilers. Python is not compiled with this switch so Distutils doesn't include it when compiling modules. What is the preferred way to compile C++11 code with distutils? 回答1: You can use the extra_compile_args parameter of distutils.core.Extension : ext = Extension('foo', sources=[....], libraries=[....], extra_compile_args=['-std=c++11'], ....) Note that this is

How to specify C++11 with distutils?

你离开我真会死。 提交于 2020-07-17 04:33:12
问题 I have a module that needs to be compiled with C++11. On GCC and Clang, that means a std=c++11 switch, or std=c++0x on older compilers. Python is not compiled with this switch so Distutils doesn't include it when compiling modules. What is the preferred way to compile C++11 code with distutils? 回答1: You can use the extra_compile_args parameter of distutils.core.Extension : ext = Extension('foo', sources=[....], libraries=[....], extra_compile_args=['-std=c++11'], ....) Note that this is

Python3 shared extension doesn't link against library dependency

柔情痞子 提交于 2020-07-08 12:01:25
问题 I'm creating a shared Python extension for my library and I'm using distutils to build it. These are the relevant sections of my setup.py : import distuitls.core as dc from os.path import join as path_join module = dc.Extension(module_name, sources = [path_join(meson_src_root, "py3_bindings", "module.c")], include_dirs = [path_join(meson_src_root, "include")], libraries = ["bbmputil"], runtime_library_dirs = [meson_build_root]) dc.setup(name = module_name, version = module_version,

Best way to package a Python library that includes a C shared library?

旧巷老猫 提交于 2020-07-04 07:46:27
问题 I have written a library whose main functionality is implemented in C (speed is critical), with a thin Python layer around it to deal with the ctypes nastiness. I'm coming to package it and I'm wondering how I might best go about this. The code it must interface with is a shared library. I have a Makefile which builds the C code and creates the .so file, but I don't know how I compile this via distutils. Should I just call out to make with subprocess by overriding the install command (if so,

Best way to package a Python library that includes a C shared library?

北城以北 提交于 2020-07-04 07:46:05
问题 I have written a library whose main functionality is implemented in C (speed is critical), with a thin Python layer around it to deal with the ctypes nastiness. I'm coming to package it and I'm wondering how I might best go about this. The code it must interface with is a shared library. I have a Makefile which builds the C code and creates the .so file, but I don't know how I compile this via distutils. Should I just call out to make with subprocess by overriding the install command (if so,