Closed
Bug 841713
Opened 12 years ago
Closed 12 years ago
support adding objdir paths to virtualenv
Categories
(Firefox Build System :: General, defect)
Firefox Build System
General
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla22
People
(Reporter: ted, Assigned: gps)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
9.71 KB,
patch
|
ted
:
review+
|
Details | Diff | Splinter Review |
The XPIDL parser generates .py files at build time in the objdir:
http://mxr.mozilla.org/mozilla-central/source/xpcom/idl-parser/Makefile.in#28
Right now there's no way to get that path into the virtualenv, so all the places we do IDL parsing wind up using pythonpath.py:
http://mxr.mozilla.org/mozilla-central/source/config/rules.mk#1276
I think we should make populate_virtualenv.py support this, maybe by adding support for something like:
xpidl.pth:$objdir/xpcom/idl-parser
Thoughts?
Comment 1•12 years ago
|
||
I think it's more complicated than that, because these files are actually generated wherever --cachedir points to, and i think it will also try to read from there.
Reporter | ||
Comment 2•12 years ago
|
||
We can almost certainly fix that so they always go to a known location.
Comment 3•12 years ago
|
||
The underlying point is that having the files in the virtualenv may not actually change anything (and pythonpath is possibly already useless)
Assignee | ||
Comment 4•12 years ago
|
||
I think this should do the trick.
Reporter | ||
Comment 5•12 years ago
|
||
Comment on attachment 715289 [details] [diff] [review]
Add objdir paths to virtualenv, v1
Review of attachment 715289 [details] [diff] [review]:
-----------------------------------------------------------------
r=me, just a bikesheddy naming comment.
::: build/virtualenv/populate_virtualenv.py
@@ +157,5 @@
> + will be read and processed as if its contents were concatenated
> + into the manifest being read.
> +
> + objdir -- Denotes a relative path in the object directory to add to the
> + search path.
This seems oddly inconsistent, since we have "foo.pth:srcdir/path", and now we'll have "objdir:objdir/path". Any thoughts on how we can make that less confusing?
Attachment #715289 -
Flags: review?(ted) → review+
Comment 6•12 years ago
|
||
Comment on attachment 715289 [details] [diff] [review]
Add objdir paths to virtualenv, v1
Review of attachment 715289 [details] [diff] [review]:
-----------------------------------------------------------------
::: build/autoconf/python-virtualenv.m4
@@ +52,5 @@
> dnl This verifies our Python version is sane and ensures the Python
> dnl virtualenv is present and up to date. It sanitizes the environment
> dnl for us, so we don't need to clean anything out.
> $PYTHON $_virtualenv_populate_path \
> + $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv || exit 1
Do we have a reason not to just do $PYTHON $_virtualenv_populate_path $_virtualenv_topsrcdir $MOZ_BUILD_ROOT ? IOW, do we have a reason to specify a virtualenv path that would not be $MOZ_BUILD_ROOT/_virtualenv ?
Assignee | ||
Comment 7•12 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #6)
> ::: build/autoconf/python-virtualenv.m4
> @@ +52,5 @@
> > dnl This verifies our Python version is sane and ensures the Python
> > dnl virtualenv is present and up to date. It sanitizes the environment
> > dnl for us, so we don't need to clean anything out.
> > $PYTHON $_virtualenv_populate_path \
> > + $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv || exit 1
>
> Do we have a reason not to just do $PYTHON $_virtualenv_populate_path
> $_virtualenv_topsrcdir $MOZ_BUILD_ROOT ? IOW, do we have a reason to specify
> a virtualenv path that would not be $MOZ_BUILD_ROOT/_virtualenv ?
Not really. The only reason is populate_virtualenv.py as currently implemented is generic and could be used by any project. I could foresee a future where we may take advantage of this. Until then, YAGNI applies. But, I don't think it's worth any of our time to go back and change a reviewed patch.
Assignee | ||
Comment 8•12 years ago
|
||
Target Milestone: --- → mozilla22
Comment 9•12 years ago
|
||
(In reply to Gregory Szorc [:gps] from comment #7)
> (In reply to Mike Hommey [:glandium] from comment #6)
> > ::: build/autoconf/python-virtualenv.m4
> > @@ +52,5 @@
> > > dnl This verifies our Python version is sane and ensures the Python
> > > dnl virtualenv is present and up to date. It sanitizes the environment
> > > dnl for us, so we don't need to clean anything out.
> > > $PYTHON $_virtualenv_populate_path \
> > > + $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv || exit 1
> >
> > Do we have a reason not to just do $PYTHON $_virtualenv_populate_path
> > $_virtualenv_topsrcdir $MOZ_BUILD_ROOT ? IOW, do we have a reason to specify
> > a virtualenv path that would not be $MOZ_BUILD_ROOT/_virtualenv ?
>
> Not really. The only reason is populate_virtualenv.py as currently
> implemented is generic and could be used by any project. I could foresee a
> future where we may take advantage of this. Until then, YAGNI applies. But,
> I don't think it's worth any of our time to go back and change a reviewed
> patch.
Let's be careful here too, as long as we're talking about vantage points. (This is all OT, btw, so feel free to skip this now.) populate_virtualenv.py has a huge intention overlap with pip (as well as other software not really worth mentioning) and while a populate_virtualenv.py is the right size now for its task I would really want to sit-on-hands a bit before going ahead with it as a general best-practice for our software. I would love to reach out to pip, get anything we would need generic there, and figure out what to do to front end pip and take care of non-generic use cases (as this would no doubt be). While there is more overhead in reaching out and collaborating here, what is gained is both the developer wisdom and ongoing involvement and investment of pip as well as both the prestige in the python community and influence that comes with it. I'll truncate here. Apologies for being off-topic, but I would like to put Mozilla's python craft, where applicable and not hung up in project politics, into generic tools where there is greater exposure(=testing) and interest, and mostly for Mozilla's sake. FWIW, I may be doing some work in the future on pip to provide specific functionality needed.
Assignee | ||
Comment 10•12 years ago
|
||
I couldn't agree with you more. populate_virtualenv.py was originally written (bug 774106) so we could code logic in Python and not in some Makefile.in. It has slowly expanded in scope. If there is an existing Python tool out there that does something similar or if we could convince an existing Python tool to gain the features we desire, we should pursue that.
Comment 11•12 years ago
|
||
(In reply to Gregory Szorc [:gps] from comment #10)
> I couldn't agree with you more. populate_virtualenv.py was originally
> written (bug 774106) so we could code logic in Python and not in some
> Makefile.in. It has slowly expanded in scope. If there is an existing Python
> tool out there that does something similar or if we could convince an
> existing Python tool to gain the features we desire, we should pursue that.
To replace OOTB we'd need to be able to do everything in http://mxr.mozilla.org/mozilla-central/source/build/virtualenv/packages.txt with pip and presumably have to interpolate the file since things are relative to topsrcdir. I'll ticket separately so not to further go off-topic here
Comment 12•12 years ago
|
||
(In reply to Gregory Szorc [:gps] from comment #8)
> https://hg.mozilla.org/integration/mozilla-inbound/rev/4682ed369545
I don't know how this doesn't break the tree, but it does break incremental builds for me locally, with the following error:
Creating Python environment
Traceback (most recent call last):
File "/home/mh/mozilla-central/build/virtualenv/populate_virtualenv.py", line 379, in <module>
manager.ensure()
File "/home/mh/mozilla-central/build/virtualenv/populate_virtualenv.py", line 100, in ensure
if self.up_to_date():
File "/home/mh/mozilla-central/build/virtualenv/populate_virtualenv.py", line 85, in up_to_date
submanifest)
TypeError: __init__() takes exactly 6 arguments (5 given)
and indeed, the call in there hasn't been updated.
Status: ASSIGNED → NEW
Target Milestone: mozilla22 → ---
Comment 13•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
Assignee | ||
Comment 15•12 years ago
|
||
Fixed bug reported in comment #12. IRC review.
https://hg.mozilla.org/mozilla-central/rev/9dbb23d8ab8a
Comment 16•12 years ago
|
||
Is that also likely to fix bug 843059? Or are you looking into that, or should we back out your patch?
Assignee | ||
Comment 17•12 years ago
|
||
Backed out for reftest bustage:
https://hg.mozilla.org/mozilla-central/rev/1e5d26d9e154
https://hg.mozilla.org/mozilla-central/rev/461e427960b2
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 19•12 years ago
|
||
(In reply to Jeff Hammel [:jhammel] from comment #11)
> (In reply to Gregory Szorc [:gps] from comment #10)
> > I couldn't agree with you more. populate_virtualenv.py was originally
> > written (bug 774106) so we could code logic in Python and not in some
> > Makefile.in. It has slowly expanded in scope. If there is an existing Python
> > tool out there that does something similar or if we could convince an
> > existing Python tool to gain the features we desire, we should pursue that.
>
> To replace OOTB we'd need to be able to do everything in
> http://mxr.mozilla.org/mozilla-central/source/build/virtualenv/packages.txt
> with pip and presumably have to interpolate the file since things are
> relative to topsrcdir. I'll ticket separately so not to further go
> off-topic here
bug 843426
Assignee | ||
Updated•12 years ago
|
Target Milestone: mozilla22 → ---
Assignee | ||
Comment 20•12 years ago
|
||
I was reminded of this today. I can't remember what the error was. So, I pushed to try: https://tbpl.mozilla.org/?tree=Try&rev=3058f4f107be
Reporter | ||
Comment 21•12 years ago
|
||
I think this was backed out for bug 843059, because it broke running reftests (and presumably other tests) locally, because automation.py has hardcoded relative paths in it.
Assignee | ||
Comment 22•12 years ago
|
||
Hmmm. I think the try push looks green, does it not? Perhaps I should try re-landing this...
Reporter | ||
Comment 23•12 years ago
|
||
You didn't break the tree, you broke people running tests locally from their objdir.
Assignee | ||
Comment 24•12 years ago
|
||
Indeed. It seems when we add <objdir>/build to sys.path that automation.py from that directory is picked up instead of the automation.py in _tests. I, uh, am not sure how to fix this one short of hacking up everywhere automation.py is needed and ensuring sys.path order is sane.
Assignee | ||
Comment 25•12 years ago
|
||
In the objdir, we have automation.py in the following directories:
./_leaktest/automation.py
./_profile/pgo/automation.py
./_tests/reftest/automation.py
./_tests/testing/mochitest/automation.py
./build/automation.py
./build/pgo/automation.py
./layout/tools/reftest/automation.py
./testing/mochitest/automation.py
I looked at the mochitest and reftest Python test runners. There were all installing the script/local directory in sys.path[0] except for reftest's runner. It was appending to sys.path. I changed it to sys.path.insert(0, path) and reftests started working locally again.
I /think/ this is sufficient to fix the bustage with the original patch. If we find additional bustage, it should hopefully be a matter of replacing sys.path.append with sys.path.insert...
Attachment #715289 -
Attachment is obsolete: true
Attachment #728406 -
Flags: review?(ted)
Reporter | ||
Updated•12 years ago
|
Attachment #728406 -
Flags: review?(ted) → review+
Assignee | ||
Comment 26•12 years ago
|
||
Target Milestone: --- → mozilla22
Comment 27•12 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 12 years ago → 12 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Updated•7 years ago
|
Product: Core → Firefox Build System
You need to log in
before you can comment on or make changes to this bug.
Description
•