SCons under virtualenv
Paweł Tomulik <[email protected]>
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Organization | WUT |
| Message-ID | <[email protected]> |
Hi all, I'd like to discuss some issues related to SCons and virtualenv. Currently SCons uses hard-coded PATH to search for executables. Because of this, when it gets executed from virtualenv, it still prefers system executables over these from virtualenv. So, for example, when we try to execute python interpreter from SConscript running in virtualenv, the execution jumps out of virtualenv, leading to possible confusions (another version of python gets called, some packages installed purposely in virtualenv are not found by scons tools, etc.). This kind of issue seems to be currently observed when testing SCons on travis-ci. Travis uses virtualenv, and some scripts from SCons end-to-end tests get accidentally executed by python2, despite the testsuite was started in python3 (runtest.py is started in python3, but some script snippets get passed by scons to non-virtualenv python2). This masks some regressions, which would be revealed under python3. My idea was to change SCons behaviour, such that it would look into virtualenv in the first place, and then search through all the hardcoded directories. The implementation would simply prepend to env['ENV']['PATH'] the search path from virtualenv, when a virtualenv is in use. In all cases I've seen, it's just about prepending a single directory, like '/home/user/.local/share/virtualenvs/<random>/bin', so final PATH is like '/home/user/.local/share/virtualenvs/<random>/bin:/usr/bin:/opt/bin:/usr/local/bin'. This approach breaks the rule of predictable and repeatable SCons behaviour defined as "the search PATH is same on every run, on every variant of given platform, except you change this explicitly". My question is, if it would be reasonable to redefine this repeatability a little bit, such that it would take into account virtualenvs? There is a pull request, which implements the change. Currently it makes the change by default, but this can be disabled with --ignore-virtualenv flag (or SCONS_IGNORE_VIRTUALENV environment variable). As William pointed out, this is still too risky to introduce this change in next release, without some transition period. What others think? May it have such a huge impact on users? What are your opinions? PR: https://github.com/SCons/scons/pull/3216 -- Pawel Tomulik _______________________________________________ Scons-users mailing list [email protected] https://pairlist4.pair.net/mailman/listinfo/scons-users