conditional install/distribution

I

i3dmaster

Is there a feature in distutils or easy_install to specify what
version of python that the target package can be installed? For
example, if a package has a module that only needed if the python
version < 2.6, is there a way to specifiy that in setup.py or
easy_install cfg file so that when installing to python >= 2.6, this
module wouldn't be installed??

Thanks,
Jim
 
D

Diez B. Roggisch

i3dmaster said:
Is there a feature in distutils or easy_install to specify what
version of python that the target package can be installed? For
example, if a package has a module that only needed if the python
version < 2.6, is there a way to specifiy that in setup.py or
easy_install cfg file so that when installing to python >= 2.6, this
module wouldn't be installed??

you can simply import sys and check sys.version in the setup-script, and
abort with an error-message if the expectations aren't matched.

Diez
 
I

i3dmaster

i3dmasterschrieb:


you can simply import sys and check sys.version in the setup-script, and
abort with an error-message if the expectations aren't matched.

Diez
I know I can precheck the version, but the real issue is how I can
prevent from installing a specific module? Actually, the rest of the
package should still be installed but just not a particular module
because the feature is built in after 2.6.
 
D

Diez B. Roggisch

i3dmaster said:
I know I can precheck the version, but the real issue is how I can
prevent from installing a specific module? Actually, the rest of the
package should still be installed but just not a particular module
because the feature is built in after 2.6.

How about simply not importing the module in question if the version is
not proper? Or even a

try:
import a_module_requiring_2_6
except (SyntaxError, ImportError):
pass

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top