[Distutils] Python 3.3 / packaging - how to make installation conditional on platform?

Vinay Sajip vinay_sajip at yahoo.co.uk
Sat Jun 18 13:31:23 CEST 2011

I've a project which needs to install different data files depending on what
platform the project is being installed on - e.g. win32, linux2, darwin. Using
packaging setup.cfg, how can I indicate different files for different platforms,
as well as some common files for all platforms? It's easy enough to do with
setup.py, of course.

It doesn't seem possible to use project-specific Python files to do this (via
setup_hooks, for example), as when pysetup3 runs, the project directory is not
in sys.path, so you can't import anything from e.g. files adjacent to setup.cfg.

Although my current need is for data files, there might be situations where
different packages need installing for different platforms (e.g. having shim or
adapter functionality).

What's the official packaging solution for this?


Vinay Sajip

More information about the Distutils-SIG mailing list