Only make vendored Python packages available if requested by the virtualenv
Categories
(Firefox Build System :: Mach Core, enhancement)
Tracking
(Not tracked)
People
(Reporter: mhentges, Assigned: mhentges)
References
(Blocks 1 open bug)
Details
Attachments
(6 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Currently, all third-party Python modules are placed into the sys.path
, even if they're not wanted by the virtualenv. This can cause collisions with pypi modules, which we want to guard against.
Unfortunately, one of the pieces that will make this trickier is that we aren't lazy-loading mach commands yet. So, existing mach commands will need to be lazy-loading (do imports at the function level, rather than file) at the command level, which is going to be some up-front busywork. This is required so that mach commands don't try to import 3rd-party libraries even though the commands aren't being run yet.
![]() |
Assignee | |
Updated•4 years ago
|
![]() |
Assignee | |
Comment 1•4 years ago
|
||
Since https://phabricator.services.mozilla.com/D115921, "set-variable"
is no longer a valid action. Looks like that patch forgot to remove the
associated docs
![]() |
Assignee | |
Comment 2•4 years ago
|
||
The "pth" action no longer has a customizable filename, and the docs
should be updated accordingly.
Depends on D118609
![]() |
Assignee | |
Updated•4 years ago
|
![]() |
||
Comment 4•4 years ago
|
||
bugherder |
![]() |
Assignee | |
Comment 5•4 years ago
|
||
We should prune the mach virtualenv to remove dependencies only used in commands (and not at the global Mach level) once this work is done.
![]() |
Assignee | |
Comment 6•4 years ago
|
||
Maps virtualenvs one-to-one with their associated requirements
definition.
For example:
Name: "docs"
Virtualenv location: <snip>/_virtualenvs/docs
Requirements location: $topsrcdir/build/docs_virtualenv_packages.txt
An issue to be resolved in the future is that it's tricky to know that,
when you define a new virtualenv, you have to know that a requirements
definition needs to exist in "build/".
As part of this change, the default virtualenv changed from
build
to common
. Since some python-tests depend on glean_parser
,
the python-test
virtualenv was modified to still include it.
This addition to the python-test
virtualenv is temporary and
will be removed when bug 1724273 is resolved.
Depends on D122890
![]() |
Assignee | |
Comment 7•4 years ago
|
||
All commands now have their virtualenv activated before they're invoked.
If they haven't explicitly specified a virtualenv, then they use the one
named "common".
Removes all now-redundant manual activations of virtualenvs.
Tweaks some tests that include Mach command invocations to
skip virtualenv activation to avoid parallel process
race conditions.
Depends on D122891
![]() |
Assignee | |
Comment 8•4 years ago
|
||
Tweak the VirtualenvManager
API to accept a single base "python"
executable during initialization, then to consistently use it for
up-to-date checking, construction, etc.
This constraint allows future simplification for behaviour involving th
"base" python.
Depends on D122893
![]() |
Assignee | |
Comment 9•4 years ago
|
||
Adds a MozVirtualenvMetadata
file abstraction that allows us to:
- Statically determine if a virtualenv is managed by Mach.
- Determine the virtualenv's name.
Note: I called this file moz_virtualenv_metadata.json
instead of
mach_virtualenv_metadata.json
because I didn't want to be ambiguous
between "the Mach virtualenv" and "a Mach-managed virtualenv".
Depends on D124516
Comment 10•4 years ago
|
||
Comment 11•4 years ago
|
||
bugherder |
![]() |
||
Comment 12•4 years ago
|
||
This seems to have broken MACH_USE_SYSTEM_PYTHON=1 on Linux, at least when building on Gentoo.
The "common" virtualenv doesn't get set up, so it fails similar to 1731024 but for "./mach build --verbose"
Error running mach:
['build', '--verbose']
The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file build| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.
If filing a bug, please include the full output of mach, including this error
message.
The details of the failure are as follows:
FileNotFoundError: [Errno 2] No such file or directory: '/var/tmp/portage/www-client/firefox-9999/work/firefox_build/instrumented/_virtualenvs/common/bin/python'
![]() |
Assignee | |
Comment 13•4 years ago
|
||
Steven, I can't reproduce that issue, can you share the associated stack trace?
When I do a ./mach build --verbose
, the common
virtualenv isn't used.
![]() |
||
Comment 14•4 years ago
|
||
Curious. Could that be affected by using PGO? I'm building my own nightly from a modified portage ebuild.
Specifically, what gets called is "virtx ./mach build --verbose"
It was working fine up until a few days ago. It's definitely trying to use the common virtualenv as you can see above.
![]() |
Assignee | |
Comment 15•4 years ago
|
||
Perhaps it's related to PGO - can you create a new bug, mark this one as "regressing" it, and attach your full build logs? I need to see the stack trace to continue investigation here.
![]() |
||
Comment 16•4 years ago
|
||
Regressions: 1732177
![]() |
||
Comment 17•4 years ago
|
||
Mitchell, I don't see how to mark the bug a regressed by this bug. Obviously just writing it via a comment isn't the way...
Updated•4 years ago
|
Updated•4 years ago
|
Comment 18•4 years ago
|
||
Comment 19•4 years ago
|
||
bugherder |
![]() |
Assignee | |
Updated•3 years ago
|
Comment 20•3 years ago
|
||
The leave-open keyword is there and there is no activity for 6 months.
:ahochheiden, maybe it's time to close this bug?
For more information, please visit auto_nag documentation.
Comment 21•3 years ago
|
||
As far as I can tell, everything that needed to be done for this has landed. I'll close this now.
If something was overlooked we can always raise a new bug.
Updated•3 years ago
|
Updated•3 years ago
|
Description
•