Is it possible to deliver different source distributions for different Python versions?

Dave Hein jenesuispasdave at gmail.com
Sun Apr 5 16:38:11 EDT 2015


I would like to distribute a python package with different code for
Python 2.* than for Python 3.*. (Mostly this is because of different
unicode string handling).

There is nothing in to setuptools or PyPi that directly supports
this scenario.

But perhaps there could be some script run at install time that moves
the correct source code to the right location? In other works, if I
included both source code versions in the distribution (in a src2 and
a src3 subdirectory) then a function invoked at install time could
detect the python version and copy the appropriate source code to the
right location.

Is that at all possible? Is there some install time hook that lets me
supply custom installation code?

--
Dave Hein



More information about the Python-list mailing list