gecko-dev/python
Mitchell Hentges 9e039efcfa Bug 1758584: Add in-proc venv activation paths to the end of sys.path r=ahal
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
2022-03-09 22:18:33 +00:00
..
devtools/migrate-l10n Bug 1753413 - fx doc: Remove whitespaces, trailing lines & windows CR r=andi,perftest-reviewers,sparky 2022-02-03 18:34:58 +00:00
docs Bug 1755562: Document Mach dependency management r=ahal 2022-03-02 15:51:30 +00:00
gdbpp/gdbpp
l10n Bug 1746509 - Replace More from Mozilla XUL tags with HTML, r=pdahiya,Gijs,preferences-reviewers,flod 2022-01-27 19:11:27 +00:00
lldbutils
mach Bug 1758584: Add in-proc venv activation paths to the end of sys.path r=ahal 2022-03-09 22:18:33 +00:00
mozboot Bug 1758189: Don't double-srcdir for mach during stdalone bootstrap r=ahal 2022-03-09 21:51:13 +00:00
mozbuild Bug 1750632: ./mach lint should bootstrap clang-format r=ahal 2022-03-04 19:39:32 +00:00
mozlint Bug 1756224: Update MozlintParser docs about default paths r=ahal 2022-03-09 15:52:48 +00:00
mozperftest Bug 1741971 - Add MozPerfTest Testing Section to WPT Layer r=perftest-reviewers,sparky 2022-03-09 20:53:29 +00:00
mozrelease Bug 1755088: Replace all usages of unittest deprecated aliases r=webdriver-reviewers,ahal,whimboo 2022-02-17 15:21:41 +00:00
mozterm
mozversioncontrol Bug 1732795: Resolve upcoming pytest deprecations r=webdriver-reviewers,ahal,whimboo 2022-02-18 14:27:18 +00:00
mach_commands.py Bug 1753795 - Add progress bar (via tqdm) to running Python Tests r=ahal 2022-02-11 18:51:46 +00:00
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