[Distutils] Handling the binary dependency management problem

Thomas Heller theller at ctypes.org
Fri Dec 6 14:16:17 CET 2013


Am 06.12.2013 13:22, schrieb Nick Coghlan:
> On 6 December 2013 17:10, Thomas Heller <theller at ctypes.org> wrote:
>> Am 06.12.2013 06:47, schrieb Nick Coghlan:
>>> Hmm, I just had an idea for how to do the runtime selection thing. It
>>> actually shouldn't be that hard, so long as the numpy folks are OK
>>> with a bit of __path__ manipulation in package __init__ modules.
>>
>> Manipulation of __path__ at runtime usually makes it harder for
>> modulefinder to find all the required modules.
>
> Not usually, always. That's why
> http://docs.python.org/2/library/modulefinder#modulefinder.AddPackagePath
> exists :)

Well, as the py2exe author and the (inactive, I admit) modulefinder
maintainer I already know this.

> However, the interesting problem in this case is that we want to
> package 3 different versions of the modules, choosing one of them at
> runtime, and modulefinder definitely *won't* cope with that.

The new importlib implementation in python3.3 offers a lot a new
possibilities, probably not all of them have been explored yet.
For example, I have written a ModuleMapper object that, when inserted
into sys.meta_path, allows transparent mapping of module names between
Python2 and Python3 - no need to use six.  And the new modulefinder(*)
that I've written works great with that.

Thomas

(*) which will be part of py2exe for python3, but it is too late for
python3.4.


More information about the Distutils-SIG mailing list