distutils

Using Cython To Link Python To A Shared Library

江枫思渺然 提交于 2019-11-27 10:26:23
I am trying to integrate a third party library written in C with my python application using Cython . I have all of the python code written for a test. I am having trouble finding an example for setting this up. I have a pyd/pyx file I created manually. The third party has given me a header file (*.h) and a shared library (*.so) . As far as I can tell, there are no other dependencies. Can someone provide an example of how to set this up using Cython and disutils ? Thanks Sure ! (In the following, I assume that you already know how to deal with cimport and the interactions between .pxd and .pyx

Don't touch my shebang

落爺英雄遲暮 提交于 2019-11-27 07:26:58
One thing I hate about distutils (I guess he is the evil who does this ) is that it changes the shebang line. In other words, the more rational and environment-vars decided scripture #!/usr/bin/env python gets magically converted into #!/whatever/absolute/path/is/my/python This is seen also with grok: I used grokproject in a virtualenv to start my project, but now I cannot move the development directory around anymore, because it puts absolute paths in the shebang directive. The reason why I ask this is twofold I want to move it around because I started developing in one directory (Experiments

How to extend distutils with a simple post install script?

ぐ巨炮叔叔 提交于 2019-11-27 06:53:15
I need to run a simple script after the modules and programs have been installed. I'm having a little trouble finding straight-forward documentation on how to do this. It looks like I need to inherit from distutils.command.install, override some methods and add this object to the setup script. The specifics are a bit hazy though and it seems like a lot of effort for such a simple hook. Does anyone know an easy way to do this? I dug through distutils source for a day to learn enough about it to make a bunch of custom commands. It's not pretty, but it does work. import distutils.core from

MANIFEST.in ignored on “python setup.py install” - no data files installed?

你说的曾经没有我的故事 提交于 2019-11-27 06:47:01
Here's my stripped-down setup.py script with non-code stuff removed: #!/usr/bin/env python from distutils.core import setup from whyteboard.misc import meta setup( name = 'Whyteboard', version = meta.version, packages = ['whyteboard', 'whyteboard.gui', 'whyteboard.lib', 'whyteboard.lib.pubsub', 'whyteboard.lib.pubsub.core', 'whyteboard.lib.pubsub.utils', 'whyteboard.misc'], py_modules = ['whyteboard'], scripts = ['whyteboard.py'], ) MANIFEST.in: include *.txt include whyteboard-help/*.* recursive-include locale *.mo recursive-include images *.png When I run "python setup.py install sdist" I

python distutils does not include data_files

寵の児 提交于 2019-11-27 06:43:41
问题 I am new to distutils.. I am trying to include few data files along with the package.. here is my code.. from distutils.core import setup setup(name='Scrapper', version='1.0', description='Scrapper', packages=['app', 'db', 'model', 'util'], data_files=[('app', ['app/scrapper.db'])] ) The zip file created after executing python setup.py sdist does not include the scrapper.db file. I have scrapper.db file in the app directory.. thanks for the help. 回答1: You probably need to add a MANIFEST.in

setup.py: run build_ext before anything else

时光怂恿深爱的人放手 提交于 2019-11-27 06:17:33
问题 I'm working with a setup.py that creates a whole bunch of SWIG interface files during the build_ext step. This needs to run first, because subsequent build steps need a full list of the python files to work properly (like copying the python files to the package directory, creating the egg, creating the sources list, etc.). This is what currently happens when you do setup.py install : running install running bdist_egg running egg_info running install_lib running build_py running build_ext The

How to include third party Python packages in Sublime Text 2 plugins

独自空忆成欢 提交于 2019-11-27 05:22:18
问题 I'm writing a sublime text 2 plugin that uses a module SEAPI.py which in itself imports the requests module. Since sublime text 2 uses it's own embedded python interpreter, it doesn't see the requests module installed in my ubuntu machine (I get the following error: ImportError: No module named requests). Best solution I could find so far was to copy the 'requests' module (the whole directory of files) from /usr/lib/python2.7/dist-packages/requests into my plugin directory in the sublime text

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

我与影子孤独终老i 提交于 2019-11-27 05:04:13
问题 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"

Run custom task when call `pip install`

拟墨画扇 提交于 2019-11-27 05:04:07
I want to make my python package "pip installable". The problem is that the package has shell script that must be sourced in the user's init shell script (e.g. .bashrc ). But after the installation, the user don't exactly know where the script went (presumably /usr/bin , but we can't garantee). Of course the user can runs which myscript.sh and manually edits his init script. But I want to automate this step. I can create a new distutils command, but pip install doesn't call it. And I can extend distutils.command.install.install , but the installation breaks via pip (although works via python

How can I install Python modules programmatically / through a Python script?

孤街醉人 提交于 2019-11-27 04:37:32
Can I download and install Python modules from PyPi strictly inside a script, without using a shell at all ? I use a non-standard Python environment, Autodesk Maya's Python interpreter. This does not come with "easy_install," and there is no "shell," only a python script interpreter invoked by the main Maya executable. Copying and pasting ez_setup.py's contents into the script editor window and running it correctly installs an easy_install somewhere into Maya's directory, but the script incorrectly records the Python interpreter as "...maya.exe" instead of "...mayapy.exe" Furthermore, using