distutils

How to have PyPI package install header files for C extension with distutils/setuptools?

心已入冬 提交于 2019-12-22 09:20:12
问题 We have a package (rebound) up on PyPI that includes a C extension . The relevant part of the setup.py file looks like this (simplified): libreboundmodule = Extension('librebound', sources = [ 'src/rebound.c'], include_dirs = ['src'],) Additional libraries need access to rebound.h, but when one runs pip install rebound it doesn't install rebound.h anywhere. How can we get distutils/setuptools to install rebound.h somewhere along with all the python modules? We're hoping that we can have pip

Install package with separate source directory in editable mode

六月ゝ 毕业季﹏ 提交于 2019-12-22 09:08:01
问题 Situation This is the structure of an example package: $ tree Foo/ Foo/ ├── setup.py └── src ├── bar.py └── __init__.py The package's name shall be foo however the package's source files are placed in the src folder. The files' contents are: setup.py: from setuptools import setup setup( name='foo', version='1', packages=['foo'], package_dir={'foo': 'src'} ) __init__.py: from .bar import bar print(bar) bar.py: bar = 1 Problem When doing pip install Foo everything is fine and I can use the

distutils setup.py and %post %postun

你。 提交于 2019-12-22 09:07:10
问题 I am newbie. I am buidling rpm package for my own app and decided to use distutils to do achieve it. I managed to create some substitue of %post by using advice from this website, which i really am thankfull for, but i am having problems with %postun. Let me describe what i have done. In setup.py i run command that creates symbolic link which is needed to run application. It works good but problem is when i want to remove rpm, link stays there. So i figured that i should use %postun in spec

distutils ignores changes to setup.py when building an extension?

时间秒杀一切 提交于 2019-12-22 07:42:36
问题 I have a setup.py file that builds an extension. If I change one of the source files, distutils recognizes this and rebuilds the extension, showing all the compile / link commands. However, if the only thing I change is setup.py (I'm fiddling trying to make library dependencies work), then it doesn't seem to rebuild (e.g., none of the compile/link commands show up). I've tested this by removing one of the source files in the line sources = ['foo.c', 'bar.c' ...] and when I pip install -e . or

setup.py check if non-python library dependency exists

旧街凉风 提交于 2019-12-21 17:06:32
问题 I'm trying to make a setup.py for cgal-bindings. To install this, the user needs to have at least a certain version of CGAL. In addition, CGAL has a few optional targets that should be built if the user has some libraries (like Eigen3). Is there a cross-platform way in Python to check for this? I can use find_library in ctypes.util to check if the library exists, but I don't see any easy way to get the version . <-- This doesn't actually work all the time, some libraries are header-only like

Installing Python binary modules to a custom location in Windows

不羁的心 提交于 2019-12-21 12:33:19
问题 Suppose that I want to install a binary module for Python on Windows. Suppose that the module is distributed as a pre-built installer xxx-n.n.n.win32-py2.7.exe , prepared using distutils. My problem is that the installer insists on installing the package into whatever Python directory he finds in the registry. However, I have this tiny "portable" Python directory on a flash drive that I use from time to time and need to have packages installed there. That directory is not marked in the

Using Sphinx with a distutils-built C extension

与世无争的帅哥 提交于 2019-12-21 12:10:24
问题 I have written a Python module including a submodule written in C: the module itself is called foo and the C part is foo._bar . The structure looks like: src/ foo/__init__.py <- contains the public stuff foo/_bar/bar.c <- the C extension doc/ <- Sphinx configuration conf.py ... foo/__init__.py imports _bar to augment it, and the useful stuff is exposed in the foo module. This works fine when it's built, but obviously won't work in uncompiled form, since _bar doesn't exist until it's built. I

How to install distutils packages using distutils api or setuptools api

两盒软妹~` 提交于 2019-12-21 06:07:18
问题 I'm working on a buildout script that needs to install a distutils package on remote server. On PyPi there are 2 recipes for doing this collective.recipe.distutils 0.1 and zerokspot.recipe.distutils 0.1.1. The later module a derivative of the former, and is a little more convenient then the first, but the both suffer from the same problem, which I will describe now. When bootstrap.py is executed, it downloads zc.buildout package and puts it into buildout's eggs directory. This gives ./bin

How to install distutils packages using distutils api or setuptools api

霸气de小男生 提交于 2019-12-21 06:07:09
问题 I'm working on a buildout script that needs to install a distutils package on remote server. On PyPi there are 2 recipes for doing this collective.recipe.distutils 0.1 and zerokspot.recipe.distutils 0.1.1. The later module a derivative of the former, and is a little more convenient then the first, but the both suffer from the same problem, which I will describe now. When bootstrap.py is executed, it downloads zc.buildout package and puts it into buildout's eggs directory. This gives ./bin

Use WiX or Inno Setup to bundle the installation of several MSI files

那年仲夏 提交于 2019-12-21 05:36:20
问题 I use cx-freeze to create an MSI installer for a Python application. Let's call it application "A". It depends on another application "B". I would like my installer for "A" to include and run the MSI installer for "B". How can I create a bootstrapping/chaining installer using Inno Setup or the WiX toolset? 回答1: Here is a basic Inno Setup script that bundles two MSI installations into a single setup program. Since the installer only exists to install MSI files, there is no need for an