distutils

How do I use data in package_data from source code?

瘦欲@ 提交于 2019-11-28 04:08:35
In setup.py, I have specified package_data like this: packages=['hermes'], package_dir={'hermes': 'hermes'}, package_data={'hermes': ['templates/*.tpl']}, And my directory structure is roughly hermes/ | | docs/ | ... | hermes/ | | __init__.py | code.py | templates | | python.tpl | | README | setup.py The problem is that I need to use files from the templates directory in my source code so I can write out python code (this project is a parser generator). I can't seem to figure out how to properly include and use these files from my code. Any ideas? The standard pkgutil module's get_data()

Distutils compiler options configuration

女生的网名这么多〃 提交于 2019-11-28 03:35:53
问题 Maybe a stupid question, but I was wondering where Python's distutils get the compiler options from? It gets some linked directories wrong and I want to correct that once and for all. I know there should be a prefix/lib/pythonver/distutils/distutils.cfg but I can't find any distutils.cfg anywhere on the computer. Obviously I haven't got a local setup.cfg or any $HOME/.pydistutils.cfg. I'm using the Enthought 64-bit distribution, version 7.3 (Python 2.7) on Mac OS X 10.8.3 Cheers, U. 回答1: I

Undefined symbol error importing Cython module

这一生的挚爱 提交于 2019-11-28 03:13:32
问题 I want to make available one of my c++ classes as Python module. The class is declared in a header Foo.h and implemented in a .cpp Foo.cpp . (g++-4.5, Ubuntu x86_64). It's a very very simple class: Foo.cpp : Foo::Foo() : alfa(1.0), beta(1) { } Foo::~Foo() { } Foo.h : class Foo { public: Foo() Foo(const Foo& orig); ~Foo(); double alfa; int beta; }; I created a setup.py as shown in Cython tutorial: setup.py from distutils.core import setup from distutils.extension import Extension from Cython

Is there a standard way to create Debian packages for distributing Python programs?

点点圈 提交于 2019-11-28 03:05:38
There is a ton of information on how to do this, but since "there is more than one way to skin a cat" , and all the tutorials/manuals that cover a bit of the process seem to make certain assumptions which are different from other tutorials, I still didn't manage to grasp it. So far this is what I think I understood. My final goal should be that of creating a "binary" .deb package. Such package will be platform-independent (32/64 bit) as all Python programs are such. To create a "binary" package I need first to create a source package. To create the source package I can use either CDBS or

What is the correct way to share package version with setup.py and the package?

余生颓废 提交于 2019-11-28 02:50:56
With distutils , setuptools , etc. a package version is specified in setup.py : # file: setup.py ... setup( name='foobar', version='1.0.0', # other attributes ) I would like to be able to access the same version number from within the package: >>> import foobar >>> foobar.__version__ '1.0.0' I could add __version__ = '1.0.0' to my package's __init__.py, but I would also like to include additional imports in my package to create a simplified interface to the package: # file: __init__.py from foobar import foo from foobar.bar import Bar __version__ = '1.0.0' and # file: setup.py from foobar

Cross Compiling Python Extensions

不问归期 提交于 2019-11-27 23:40:19
问题 I have a problem cross compiling netifaces extension under Buildroot Linux distro for ARM (Python 2.7.2). According to this blog http://whatschrisdoing.com/blog/2009/10/16/cross-compiling-python-extensions/ I've defined CC, LDSHARE etc. environment variables, but distutils/setuptools doesn't take CC into account so all tests will fail: running build Setting prefix Setting prefix running build_ext checking for getifaddrs... not found. (cached) checking for getnameinfo... not found. (cached)

Determining the location of distutils data files programmatically in Python

雨燕双飞 提交于 2019-11-27 21:18:59
问题 I'm trying to include data files in distutils for my package and then refer to them using relative paths (following http://docs.python.org/distutils/setupscript.html#distutils-additional-files) My dir structure is: myproject/ mycode.py data/ file1.dat the code in mycode.py , which is actually a script in the package. It relies on accessing data/file1.dat , refer to it using that relative path. In setup.py , I have: setup( ... scripts = "myproject/mycode.py" data_files = [('data', 'myproject

python setuptools install_requires is ignored when overriding cmdclass

廉价感情. 提交于 2019-11-27 20:08:35
I have a setup.py that looks like this: from setuptools import setup from subprocess import call from setuptools.command.install import install class MyInstall(install): def run(self): call(["pip install -r requirements.txt --no-clean"], shell=True) install.run(self) setup( author='Attila Zseder', version='0.1', name='entity_extractor', packages=['...'], install_requires=['DAWG', 'mrjob', 'cchardet'], package_dir={'': 'modules'}, scripts=['...'], cmdclass={'install': MyInstall}, ) I need MyInstall because I want to install some libraries from github and I didn't want to use dependency_links

f2py with Intel Fortran compiler

那年仲夏 提交于 2019-11-27 18:30:16
问题 I am trying to use f2py to interface my python programs with my Fortran modules. I am on a Win7 platform. I use latest Anaconda 64 (1.7) as a Python+NumPy stack. My Fortran compiler is the latest Intel Fortran compiler 64 (version 14.0.0.103 Build 20130728). I have been experiencing a number of issues when executing f2py -c -m PyModule FortranModule.f90 --fcompiler=intelvem The last one, which I can't seem to sort out is that it looks like the sequence of flags f2py/distutils passes to the

Make distutils look for numpy header files in the correct place

馋奶兔 提交于 2019-11-27 17:49:42
In my installation, numpy's arrayobject.h is located at …/site-packages/numpy/core/include/numpy/arrayobject.h . I wrote a trivial Cython script that uses numpy: cimport numpy as np def say_hello_to(name): print("Hello %s!" % name) I also have the following distutils setup.py (copied from the Cython user guide ): from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext ext_modules = [Extension("hello", ["hello.pyx"])] setup( name = 'Hello world app', cmdclass = {'build_ext': build_ext}, ext_modules = ext_modules ) When I try to build