I'm writing a cross-platform package which need to include different binary file for different platforms (e.g. Linux/MAC OS/Windows and even 32bit/64bit Windows)
I need my package's setup.py to install different binary data files based on the platform. The problem is that I need the data files for all platforms to be included in the package where they may have the same name but different content.
Can someone suggest how to do it using distutils / setuptools setup.py?
It's not too hard, at least in simple cases: you can for instance see how the setup.py of the uncertainties Python package does it (it selects an install directory based on the version of Python, but you would simply check sys.platform and friends, in your case).
The key lines are
if sys.version_info >= (2, 5):
package_dir = 'uncertainties-py25'
else:
package_dir = 'uncertainties-py23'
and
distutils.core.setup(
…
# Where to find the source code:
package_dir={'uncertainties': package_dir},
…
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With