distutils

Python non-trivial C++ Extension

I have fairly large C++ library with several sub-libraries that support it, and I need to turn the whole thing into a python extension. I'm using distutils because it needs to be cross-platform, but if there's a better tool I'm open to suggestions. Is there a way to make distutils first compile the sub-libraries, and link them in when ...

I'd like some advice on packaging this as an egg and uploading it to pypi

I wrote some code that I'd like to package as an egg. This is my directory structure: src/ src/tests src/tests/test.py # this has several tests for the movie name parser src/torrent src/torrent/__init__.py src/torrent/movienameparser src/torrent/movienameparser/__init__.py # this contains the code I'd like to package this directory s...

How to extend distutils with a simple post install script?

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 s...

Managing resources in a Python project

I have a Python project in which I am using many non-code files. Currently these are all images, but I might use other kinds of files in the future. What would be a good scheme for storing and referencing these files? I considered just making a folder "resources" in the main directory, but there is a problem; Some images are used from w...

distutils setup.py and %post %postun

Hi, I am newbie. I am buidling rpm package for my own app and decided to use distutils to do achieve it. I managed to create some substitue of %post by using advice from this website, which i really am thankfull for, but i am having problems with %postun. Let me describe what i have done. In setup.py i run command that creates symbolic ...

How to install distutils packages using distutils api or setuptools api

Hello, I'm working on a buildout script that needs to install a distutils package on remote server. On PyPi there are 2 recipes for doing this collective.recipe.distutils 0.1 and zerokspot.recipe.distutils 0.1.1. The later module a derivative of the former, and is a little more convenient then the first, but the both suffer from the s...

How to trigger post-build using setuptools/distutils

I am building an application using py2app/setuptools, so once it creates application bundle I want to take some action on dist folder e.g. create a installer/upload it. Is there a way? I have found some post-install solution but no post-build Alternatively I can call 'python setup.py py2app' from my own script and do that, but it would...

Python distutils - copy_tree with filter

I want to copy a data directory into my distribution dir. copy_tree does this just fine. However, the project is also an svn repository, and I don't want the distribution to have all the .svn files that the data dir has. Is there any easy way to do a copy_tree excluding the .svn files, or should I just write my own recursive dir copy? I ...

Reasons to use distutils when packaging C/Python project

I have an open source project containing both Python and C code. I'm wondering that is there any use for distutils for me, because I'm planning to do a ubuntu/debian package. The C code is not something that I could or want to use as Python extension. C and Python programs communicate with TCP/IP through localhost. So the bottom line he...

Don't touch my shebang!

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 virtua...

Which is the most pythonic: installing python modules via a package manager ( macports, apt) or via pip/easy_install/setuptools

Usually I tend to install things via the package manager, for unixy stuff. However, when I programmed a lot of perl, I would use CPAN, newer versions and all that. In general, I used to install system stuff via package manager, and language stuff via it's own package manager ( gem/easy_install|pip/cpan) Now using python primarily, I ...

Cleaning build directory in setup.py

How could I make my setup.py pre-delete and post-delete the build directory? ...

Including non-Python files with setup.py

How do I make setup.py include a file that isn't part of the code? (Specifically, it's a license file, but it could be any other thing.) ...

Including non-Python files with setup.py

How do I make setup.py include a file that isn't part of the code? (Specifically, it's a license file, but it could be any other thing.) I want to be able to control the location of the file. In the original source folder, the file is in the root of the package. (i.e. on the same level as the topmost __init__.py.) I want it to stay exac...

How does `setup.py sdist` work?

I'm trying to make a source distribution of my project with setup.py sdist. I already have a functioning setup.py that I can install with. But when I do the sdist, all I get is another my_project folder inside my my_project folder, a MANIFEST file I have no interest in, and a zip file which contains two text files, and not my project. W...

What's wrong with this `setup.py`?

I've been having problems withe getting setup.py to do the sdist thing correctly. I boiled it down to this. I have the following directory structure: my_package\ my_subpackage\ __init__.py deep_module.py __init__.py module.py setup.py And here's what I have in setup.py: #!/usr/bin/env python from dist...

Customising Install location for Django (or any Python module)

I'd like to to install Django into a custom location, I've read the distutils documentation and it suggests that I should be able to do something like the following to install under my home directory (when run from an unpacked django tarball). > python setup.py install --home=~/code/packages/install --install-purelib=modules --install-p...

Can Python's distutils compile .S (assembly)?

I wrote a small Python extension that bundles, compiles and statically links with a small C library with one optional .S (assembler) file. Distutils's Extension() doesn't recognize the .S by default. Is there a good way to compile that file, or should I just shell out to make? Right now I compile the C code only for a slightly slower lib...

What if setuptools isn't installed?

I'm just learning the art of writing a setup.py file for my project. I see there's lots of talk about setuptools, which is supposed to be superior to distutils. There's one thing though that I fail to understand, and I didn't see it addressed in any tutorial I've read about this: What if setuptools isn't installed? I understand it's not ...

How to pass flag to gcc in Python setup.py script?

I'm writing a Python extension in C that requires the CoreFoundation framework (among other things). This compiles fine with: gcc -o foo foo.c -framework CoreFoundation -framework Python ("-framework" is an Apple-only gcc extension, but that's okay because I'm using their specific framework anyway) How do I tell setup.py to pass this...