distutils

How can I use python distutils to cross compile an extension module to a different architecture?

那年仲夏 提交于 2019-12-25 09:12:49
问题 I'm using Cython to generate compiled .so files for a couple of python modules I have. As outlined in the Cython documentation, you can create a setup.py file as follows: from distutils.core import setup from Cython.Build import cythonize setup( ext_modules = cythonize([ 'MyModule1.py', 'MyModule2.py', 'MyModule3.py' ]) ) and then build the modules using the command python3 setup.py build_ext --inplace . This works fine, however it creates binaries that match the architecture of the host

Build Python package with C bindings in Windows (VC90) causes LNK1181 fatal error

徘徊边缘 提交于 2019-12-24 18:05:35
问题 I'm trying to build a Python package (pyspotify) with bindings to a C library (libspotify). I'm using Python 2.7.5 and have installed VS2008 Express for some required commandline tools. When I call python setup.py build from the Command Prompt (with Admin rights) I get the following output: running build running build_py running build_ext building 'spotify._spotify' extension And then ~18 of these, one for each .c file in the package: c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN

How do i run the python 'sdist' command from within a python automated script without using subprocess?

杀马特。学长 韩版系。学妹 提交于 2019-12-24 03:05:47
问题 I am writing a script to automate the packaging of a 'home-made' python module and distributing it on a remote machine. i am using Pip and have created a setup.py file but i then have to call the subprocess module to call the "python setup.py sdist" command. i have looked at the "run_setup" method in distutils.core but i am trying to avoid using the subprocess module alltogether. (i see no point in opening a shell to run a python command if i am already in python...) is there a way to import

How do i run the python 'sdist' command from within a python automated script without using subprocess?

谁说胖子不能爱 提交于 2019-12-24 03:05:09
问题 I am writing a script to automate the packaging of a 'home-made' python module and distributing it on a remote machine. i am using Pip and have created a setup.py file but i then have to call the subprocess module to call the "python setup.py sdist" command. i have looked at the "run_setup" method in distutils.core but i am trying to avoid using the subprocess module alltogether. (i see no point in opening a shell to run a python command if i am already in python...) is there a way to import

Choosing GCC version when building ( setup.py )

流过昼夜 提交于 2019-12-23 12:53:10
问题 I am trying to build a python module (scikit.timeseries) using python setup.py build but it's erroring out like this : /Versions/2.6/lib/python2.6/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c' gcc-4.0: scikits/timeseries/src/cseries.c sh: gcc-4.0: command not found This is because I'm on OSX Lion and gcc-4.0 doesn't exit, gcc does though : gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.0 but it is aliased to

How to create a .dylib C extension on mac os x with distutils and/or setuptools?

邮差的信 提交于 2019-12-23 12:37:20
问题 I need to make a C extension with distutils (and/or setuptools) that can be used BOTH dynamically at runtime, and at compile time (for different purposes). This isn't a problem on Linux, but it's an issue on OS X. By default, distutils creates a "bundle" on OS X (and names it .so), which can be used at runtime, but NOT at compile time. I need to make a .dylib, which can be linked to at compile time, and I need to do it within a setup.py that I can package for PyPI. No matter what I try,

correct way to find scripts directory from setup.py in Python distutils?

梦想与她 提交于 2019-12-23 08:33:34
问题 I am distributing a package that has this structure: mymodule: mymodule/__init__.py mymodule/code.py scripts/script1.py scripts/script2.py The mymodule subdir of mymodule contains code, and the scripts subdir contains scripts that should be executable by the user. When describing a package installation in setup.py , I use: scripts=['myscripts/script1.py'] To specify where scripts should go. During installation they typically go in some platform/user specific bin directory. The code that I

Is there any danger of e.g., causing conflicts using the --ignore-installed flag for pip?

北慕城南 提交于 2019-12-22 18:27:42
问题 I am having trouble finding good documentation for pip's --ignore-installed flag. pip install --help says simply: Ignore the installed packages (reinstalling instead). Other than the side effect of there being more cruft on your system, since installed packages will not be uninstalled when e.g., upgrading, are there any other known side effects? Is it possible for conflicts to arise with both packages installed? Will the newer package always "win", or is there a danger of accidentally using

How to link custom C (which itself needs special linking options to compile) with Cython?

我的梦境 提交于 2019-12-22 17:58:37
问题 so I'm trying to create a Cython module which uses a .c file that I've written. That .c file needs a special linking option (to compile it, I need gcc -o mycode mycode.c -lfftw3f ). I could potentially just rewrite my .c file in Cython, but I want to know how to do this. I am using fftw3, and when compiling, you need to use the -lfftw3f option IN ADDITION to #include <fftw3.h> in the .c file if you want to use the float version, which I do. My setup.py looks like the following: from distutils

How to link to forked package in distutils, without breaking pip freeze?

吃可爱长大的小学妹 提交于 2019-12-22 14:51:32
问题 Preface The official python package python-openid (as distributed through pypi.org) does not work with Google Apps. Somebody wrote a fix to this and uploaded the patched source to github. Now I want to create a package which should link to this forked package. Now when installing this package, everything is well. The forked package is installed and everything is fine. However, when doing a pip freeze , there is no mentioning of where the package came from. As the forked package should be used