mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
9e039efcfa
So far, we've been using `virtualenv`'s `activate_this.py` script. However, unlike earlier expectations, it adds its `sys.path` additions to the //front//, not the back! This breaks our prioritization requirements, such as: * When using any package from the system environment, import *all possible* packages from the system to avoid compatibility issues. * Use vendored packages instead of virtualenv-installed packages wherever possible, because it more-closely matches developer expectations ("why is this package vendored if it's not used?") Define an `activate_virtualenv()` function that replicates the logic of `activate_this.py` [1], except for three differences: * Don't modify `sys.real_prefix`, since it's a non-standard property of `sys`. * Only add seen-with-`venv`-module paths to the `sys.path` (`$prefix`, `$prefix/.../$site_packages_dir`) - don't do the paths in-between. * And, of course, append instead of prepend `sys.path` entries. As an aside, this is one of the few remaining blockers from allowing us to fully embrace `venv` instead of `virtualenv` - the last piece is waiting on the fix for bug 1697833 to propagate. [1] https://github.com/pypa/virtualenv/blob/20.7.2/src/virtualenv/activation/python/activate_this.py Differential Revision: https://phabricator.services.mozilla.com/D140579 |
||
---|---|---|
.. | ||
devtools/migrate-l10n | ||
docs | ||
gdbpp/gdbpp | ||
l10n | ||
lldbutils | ||
mach | ||
mozboot | ||
mozbuild | ||
mozlint | ||
mozperftest | ||
mozrelease | ||
mozterm | ||
mozversioncontrol | ||
mach_commands.py | ||
moz.build | ||
README |
This directory contains common Python code. The basic rule is that if Python code is cross-module (that's "module" in the Mozilla meaning - as in "module ownership") and is MPL-compatible, it should go here. What should not go here: * Vendored python modules (use third_party/python instead) * Python that is not MPL-compatible (see other-licenses/) * Python that has good reason to remain close to its "owning" (Mozilla) module (e.g. it is only being consumed from there). Historical information can be found at https://bugzilla.mozilla.org/show_bug.cgi?id=775243 https://bugzilla.mozilla.org/show_bug.cgi?id=1346025