[Scons-dev] SCons tools and module name clashes

Paweł Tomulik ptomulik at meil.pw.edu.pl
Tue Jan 31 17:01:13 EST 2017


Hi,

I've just faced a problem in one of my project, which I think may also
affect SCons + python3. To be short, I'd like to point to this code

https://bitbucket.org/scons/scons/src/38b0c56f96b6948dd07675d727e99728fb167238/src/engine/SCons/Tool/__init__.py?at=default&fileviewer=file-view-default#__init__.py-150

It attempts to load a tool module using importlib.import_module().
However, there is at least one name clash, namely the 'gettext' tool
which has same module name as THE 'gettext' module from Python library.

The problem is, that importlib.import_module() attempts to use cached
module (if it was previously imported) and particularly gettext is used
here:

https://bitbucket.org/scons/scons/src/38b0c56f96b6948dd07675d727e99728fb167238/src/engine/SCons/Script/SConsOptions.py?at=default&fileviewer=file-view-default#SConsOptions.py-34


So I guess, the

mod = importlib.import_module('gettext')

will always return the Python gettext module, not the SCons gettext
tool. Do you think, there is some solution/workaround to this problem?

Best Regards!
-- 
Pawel Tomulik


More information about the Scons-dev mailing list