distutils

Directly call distutils' or setuptools' setup() function with command name/options, without parsing the command line?

倖福魔咒の 提交于 2020-01-02 02:52:09
问题 I'd like to call Python's distutils' or setuptools' setup() function in a slightly unconventional way, but I'm not sure whether distutils is meant for this kind of usage. As an example, let's say I currently have a 'setup.py' file, which looks like this (lifted verbatim from the distutils docs--the setuptools usage is almost identical): from distutils.core import setup setup(name='Distutils', version='1.0', description='Python Distribution Utilities', author='Greg Ward', author_email='gward

Automate compilation of protobuf specs into python classes in setup.py

你。 提交于 2020-01-01 14:42:53
问题 I have a python project that uses google protobufs as a message format for communicating over the network. Generating python files from the .proto files is straight-forward using the protoc program. How can I configure my setup.py file for the project so that it automatically calls the protoc command? 回答1: In a similar situation, I ended up with this code (setup.py, but written in a way to allow extraction into some external Python module for reuse). Note that I took the generate_proto

Translate F2PY compile steps into setup.py

ⅰ亾dé卋堺 提交于 2020-01-01 10:49:12
问题 I've inherited a Fortran 77 code which implements several subroutines which are run through a program block which requires a significant amount of user-input via an interactive command prompt every time the program is run. Since I'd like to automate running the code, I moved all the subroutines into a module and wrote a wrapper code through F2PY. Everything works fine after a 2-step compilation: gfortran -c my_module.f90 -o my_module.o -ffixed-form f2py -c my_module.o -m my_wrapper my_wrapper

Installing my sdist from PyPI puts the files in unexpected places

[亡魂溺海] 提交于 2020-01-01 09:29:09
问题 My problem is that when I upload my Python package to PyPI, and then install it from there using pip, my app breaks because it installs my files into completely different locations than when I simply install the exact same package from a local sdist. Installing from the local sdist puts files on my system like this: /Python27/ Lib/ site-packages/ gloopy-0.1.alpha-py2.7.egg/ (egg and install info files) data/ (images and shader source) doc/ (html) examples/ (.py scripts that use the library)

A simple Hello World setuptools package and installing it with pip

核能气质少年 提交于 2019-12-31 10:40:49
问题 I'm having trouble figuring out how to install my package using setuptools, and I've tried reading the documentation on it and SO posts, but I can't get it to work properly. I'm trying to get a simple helloworld application to work. This is how far I got: helloworld.py: print("Hello, World!") README.txt: Hello, World! readme MANIFEST.in: recursive-include images *.gif setup.py: from setuptools import setup, find_packages setup( name='helloworld', version='0.1', license='BSD', author='gyeh',

Python can't locate distutils_path on Mac OSX

泪湿孤枕 提交于 2019-12-31 09:20:06
问题 I've been using virtualenv + pip for python development. I'm not sure what happened, but suddenly whenever I try to run a command-line tool or import libraries, I get this error message: Traceback (most recent call last): File "/Users/kyle/.virtualenvs/fj/bin/pip", line 4, in <module> import pkg_resources File "/Users/kyle/.virtualenvs/fj/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 698, in <module> the platform/python version defined at initialization are

How to run installed python script?

不打扰是莪最后的温柔 提交于 2019-12-30 06:23:34
问题 I used distutils to install my python package, with this setup.py : import distutils.core args = { 'name' : 'plugh', 'version' : '1.0', 'scripts' : [ "scripts/plugh" ], 'packages': [ "plugh" ], } d = distutils.core.setup( **args ) On linux/mac, it works as expected: % plugh hello world % On windows, the script "plugh" does not run: C:\Python25\Scripts>plugh 'plugh' is not recognized as an internal or external command, operable program or batch file. C:\Python25\Scripts> I found the bug report

Changing console_script entry point interpreter for packaging

末鹿安然 提交于 2019-12-28 11:56:10
问题 I'm packaging some python packages using a well known third party packaging system, and I'm encountering an issue with the way entry points are created. When I install an entry point on my machine, the entry point will contain a shebang pointed at whatever python interpreter, like so: in /home/me/development/test/setup.py from setuptools import setup setup( entry_points={ "console_scripts": [ 'some-entry-point = test:main', ] } ) in /home/me/.virtualenvs/test/bin/some-entry-point : #!/home/me

compiling cython modules when gcc is on the PATH in OSX

送分小仙女□ 提交于 2019-12-25 09:59:11
问题 I'm trying to use distutils to compile a cython module using Enthought Canopy's version of python; however it's clear there is a mixup between gcc and clang. Distutils is trying to compile the module using gcc and the clang option -arch x86_64 . The problem is that I have gcc installed from macports, so gcc isn't just a link to clang. I can get the module to compile using CC='clang' ./setup.py build_ext , but this feels a little hacky in terms of distributing the module. Is there something I

compiling cython modules when gcc is on the PATH in OSX

孤人 提交于 2019-12-25 09:58:29
问题 I'm trying to use distutils to compile a cython module using Enthought Canopy's version of python; however it's clear there is a mixup between gcc and clang. Distutils is trying to compile the module using gcc and the clang option -arch x86_64 . The problem is that I have gcc installed from macports, so gcc isn't just a link to clang. I can get the module to compile using CC='clang' ./setup.py build_ext , but this feels a little hacky in terms of distributing the module. Is there something I