[Distutils] Python 3.3 / packaging - custom installation locations

Vinay Sajip vinay_sajip at yahoo.co.uk
Wed Jun 22 20:58:03 CEST 2011

Éric Araujo <merwok <at> netwok.org> writes:

> Categories are extensible, so it’s a way.  See also the short
> description of the packaging configure command in my other message.

Actually, I'd like to make a suggestion re. project-specific categories. It's
easy to enable these, as follows:

1. In the install_data constructor, initialise self.categories to an empty
2. In install_data.expand_categories, add a "local_vars.update(self.categories)"
after the "local_vars = get_paths()" statement.

Just this change is sufficient to allow sufficient control over custom
installation locations. For projects that need custom categories, they just need
to do the necessary setup in an install_data pre-hook:

def pre_install_data(cmd):
    cmd.categories['customcategory'] = '/path/for/my/custom/category'

I've implemented this approach in the pythonv branch, and it works well.

Comments welcome.


Vinay Sajip

More information about the Distutils-SIG mailing list