Ray
Ray

Reputation: 4671

Generating Python-version-dependent installer with pre-compiled extension package

I am trying to create an installer (using distutils) for a Python package that includes a pre-compiled extension module which is included using the "package_data" keyword argument. My setup.py looks something like this:

from distutils.core import setup
setup(name="Foobar",
      ...
      packages = ['Foobar'],
      package_data = {'Foobar': '_foobar.pyd'})

However, building this package with python setup.py bdist_msi generates an installer that will install for any version of Python (named Foobar-1.0.win-amd64.msi), even though the extension module is only compatible with the Python version it was compiled for.

Is there any way to tell distutils to create an installer that requires the compatible Python version, similar to what is produced when distutils is used to compile the extension module (producing an installer named Foobar-1.0.win-amd64-py2.7.msi)

So far, the best solution I've come up with is to include an additional (dummy) extension package, but that seems kind of kludgy and creates some additional problems.

Upvotes: 2

Views: 223

Answers (1)

Ray
Ray

Reputation: 4671

This can be done using the --target-version argument, e.g.

python setup.py bdist_msi --target-version=2.7

The Distutils documentation mentions this option in reference to the bdist_rpm command, but it also works for bdist_msi.

Upvotes: 1

Related Questions