distutils

Execute a Python script post install using distutils / setuptools

戏子无情 提交于 2019-12-17 05:54:18
问题 I'm trying to add a post-install task to Python distutils as described in How to extend distutils with a simple post install script?. The task is supposed to execute a Python script in the installed lib directory . This script generates additional Python modules the installed package requires. My first attempt is as follows: from distutils.core import setup from distutils.command.install import install class post_install(install): def run(self): install.run(self) from subprocess import call

How to use MinGW's gcc compiler when installing Python package using Pip?

泄露秘密 提交于 2019-12-17 02:26:55
问题 I configured MinGW and distutils so now I can compile extensions using this command: setup.py install MinGW's gcc compiler will be used and package will be installed. For that I installed MinGW and created distutils.cfg file with following content: [build] compiler = mingw32 It's cool but now I'd like to use all pip benefits. Is there a way to use the same MinGW's gcc compiler in pip? So that when I run this: pip install <package name> pip will use MinGW's gcc compiler and compile C code if

How can I assert from Python C code?

社会主义新天地 提交于 2019-12-13 13:03:32
问题 I'm writing a Python class in C and I want to put assertions in my debug code. assert.h suits me fine. This only gets put in debug compiles so there's no chance of an assert failure impacting a user of the Python code*. I'm trying to divide my 'library' code (which should be separate to the code linked against Python) so I can use it from other C code. My Python methods are therefore thinnish wrappers around my pure-C code. So I can't do this in my 'library' code: if (black == white) { PyErr

Including .gitignore in setup? - Error: doesn't exist or not a regular file

谁说我不能喝 提交于 2019-12-13 06:53:06
问题 setup.py from setuptools import setup, find_packages from os import path from functools import partial if __name__ == '__main__': package_name = 'gen' templates_join = partial(path.join, path.dirname(__file__), package_name, 'templates') setup( name=package_name, test_suite=package_name + '.tests', packages=find_packages(), package_dir={package_name: package_name}, package_data={package_name: [templates_join('.gitignore')]} ) Tree . ├── gen │ ├── __init__.py │ ├── templates │ │ ├── __init__

Python distutils - Change Path RPM Installs To

南楼画角 提交于 2019-12-13 04:59:20
问题 I have Python 2.7.5 and am using distutils ( python setup.py bdist_rpm ) to create the following RPM... me@hostname:/tmp/dist$ rpm -qpil myApp-2.0.146-1.noarch.rpm Name : myApp Version : 2.0.146 Release : 1 Architecture: noarch Install Date: (not installed) Group : Development/Libraries Size : 290576 License : GPL Signature : (none) Source RPM : myApp-2.0.146-1.src.rpm Build Date : Wed 15 Oct 2014 02:57:08 PM EDT Build Host : hostname.example.lan Relocations : /usr Vendor : Me <me@example.lan

How to depends of a system command with python/distutils?

点点圈 提交于 2019-12-12 20:19:53
问题 I'm looking for the most elegant way to notify users of my library that they need a specific unix command to ensure that it will works... When is the bet time for my lib to raise an error: Installation ? When my app call the command ? At the import of my lib ? both? And also how should you detect that the command is missing ( if not commands.getoutput("which CommandIDependsOn"): raise Exception("you need CommandIDependsOn") ). I need advices. 回答1: I wouldn't have any check at all. Document

Why is an egg-info file created when I'm using distutils?

孤街浪徒 提交于 2019-12-12 19:08:19
问题 Below is my setup.py. I don't use anything from setuptools in my code and my project has no external dependencies #!/usr/bin/env python from distutils.core import setup setup(name='dots', ... packages=['dots','dots.configs','dots.management','dots.utils','dots.test'], scripts=['dots/dots.py'] ) When I run python setup.py install , I get the following running install running build running build_py running build_scripts running install_lib running install_scripts changing mode of /Users

How to access python package metadata from within the python console?

£可爱£侵袭症+ 提交于 2019-12-12 10:34:58
问题 If I have built a python package employing distutils.core , e.g. via setup( ext_package="foo", author="me", version="1.0", description="foo package", packages=["foo",], ) where does all the metadata go (what is it intended for?) and how can I access it from within python. Specifically, how can I access the author information from the python console after doing something like >>> import foo 回答1: One way to access the metadata is to use pip: import pip package = [pckg for pckg in pip.get

How to place a common code for different projects

我是研究僧i 提交于 2019-12-12 02:25:49
问题 I've got two python projects in a separate folders. And I also have a common code which I use in both of my projects. What is the best way to organize to them on filesystem to use distutils with setup.py to build them? My first idea was to use the structure like this: workspace | |- common lib | | | `- ... | |- project 1 | | | |- ... | `- setup.py | `- project 2 | |- ... `- setup.py and modify the python path environment variable in projects to find the code, but I've run into problems when I

Using cython extension once compiled [under Windows], how to use .pyd's?

余生颓废 提交于 2019-12-11 20:42:36
问题 I am used with compiling self-made python extensions under Linux using Cython. On Linux, I use distutils to produce a "myext.so", that I can then simply add to my PYTHONPATH and get the import myext python call available. Now, I am trying to get it working under Windows 7 (using Cython 0.18). I successfully ran distutils such that I now get a myext.pyd file. But it seems (http://docs.python.org/2/faq/windows.html#is-a-pyd-file-the-same-as-a-dll) that adding the path to "myext.pyd" is not