Closed
Bug 1253651
Opened 9 years ago
Closed 9 years ago
|mach artifact install| fails when using git with "No module named mercurial"
Categories
(Firefox Build System :: General, defect)
Tracking
(firefox47 affected, firefox48 fixed)
VERIFIED
FIXED
mozilla48
People
(Reporter: whimboo, Assigned: chmanchester)
References
Details
Attachments
(1 file)
After bug 1234913 got fixed I tried to use artifact build with my git repository by using cinnabar. Sadly it failed with the following error:
Traceback (most recent call last):
0:24.94 File "/mozilla/code/git-cinnabar/git-cinnabar", line 9, in <module>
0:24.94 from cinnabar.githg import (
0:24.94 File "/mozilla/code/gecko/build/mach_bootstrap.py", line 470, in __call__
0:24.94 module = self._original_import(name, globals, locals, fromlist, level)
0:24.94 File "/mozilla/code/git-cinnabar/cinnabar/githg.py", line 38, in <module>
0:24.94 from mercurial import mdiff
0:24.94 File "/mozilla/code/gecko/build/mach_bootstrap.py", line 470, in __call__
0:24.94 module = self._original_import(name, globals, locals, fromlist, level)
0:24.94 ImportError: No module named mercurial
I did a look into the obj/_virtualenv/ folder and noticed that mercurial has not been installed for that venv which mach seems to use. Manually installing mercurial via pip fixed the problem for me.
So it looks like that we miss to install mercurial for git users?
Assignee | ||
Comment 1•9 years ago
|
||
For reference, https://bugzilla.mozilla.org/show_bug.cgi?id=1234913#c19 and below is the relevant discussion from the original bug. This has worked for me and a few others without installing mercurial in the mozbuild virtualenv. We should figure out what's going on here.
Assignee | ||
Comment 2•9 years ago
|
||
I see that the first step for setting up git-cinnabar is to install mercurial, which sounds like it solved Henrik's problem. I'll be sure to call this out in the mdn docs when updating.
Closing for now.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Reporter | ||
Comment 3•9 years ago
|
||
Mercurial is installed on my system but the virtualenv which is affected here doesn't seem to use the packages from dist-packages.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Assignee | ||
Comment 4•9 years ago
|
||
I wasn't able to reproduce because I, too, had mercurial installed in my tree virtualenv. Nick's comment from https://bugzilla.mozilla.org/show_bug.cgi?id=1234913#c19 is still the exact problem we're having (git cinnabar picks up the virtualenv python).
So we can go back to installing mercurial into the mach virtualenv, or we can invoke cinnabar with sys.executable, which gets set before activating the virtualenv.
Assignee: nobody → cmanchester
Assignee | ||
Comment 5•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/38323/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/38323/
Attachment #8726919 -
Flags: review?(gps)
Comment 6•9 years ago
|
||
https://reviewboard.mozilla.org/r/38323/#review34819
::: python/mozbuild/mozbuild/artifacts.py:829
(Diff revision 1)
> - self._cinnabar, 'git2hg'
> + sys.executable, self._cinnabar, 'git2hg'
Don't call cinnabar with python directly. Use "git", "cinnabar". And there's no reason to do the lookup on your own, let git do it.
Comment 7•9 years ago
|
||
https://reviewboard.mozilla.org/r/38323/#review34819
> Don't call cinnabar with python directly. Use "git", "cinnabar". And there's no reason to do the lookup on your own, let git do it.
Specifically, there is no guarantee that the command will stay in python forever.
Assignee | ||
Comment 8•9 years ago
|
||
https://reviewboard.mozilla.org/r/38323/#review34819
> Specifically, there is no guarantee that the command will stay in python forever.
I tried this, it fails in the same fashion. When the virtualenv is active, /usr/bin/env python2.7 is the virtualenv python.
Assignee | ||
Comment 9•9 years ago
|
||
Comment on attachment 8726919 [details]
MozReview Request: Bug 1253651 - Undo changes to PATH made by activating virtualenv in mach artifact. r=glandium
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/38323/diff/1-2/
Attachment #8726919 -
Attachment description: MozReview Request: Bug 1253651 - Use system Python rather than in-tree virtualenv Python when invoking cinnabar to avoid errors import mercurial libaries. r=gps → MozReview Request: Bug 1253651 - Install mercurial into the in-tree virtualenv to allow invoking git cinnabar in a subprocess. r=gps
Comment 10•9 years ago
|
||
https://reviewboard.mozilla.org/r/38323/#review34863
::: python/mozbuild/mozbuild/mach_commands.py:1495
(Diff revision 2)
> + self.virtualenv_manager.install_pip_package('mercurial==3.7.1')
I'd rather save os.environ['PATH '] before running _activate_virtualenv() and restore it after.
Assignee | ||
Comment 11•9 years ago
|
||
Comment on attachment 8726919 [details]
MozReview Request: Bug 1253651 - Undo changes to PATH made by activating virtualenv in mach artifact. r=glandium
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/38323/diff/2-3/
Attachment #8726919 -
Attachment description: MozReview Request: Bug 1253651 - Install mercurial into the in-tree virtualenv to allow invoking git cinnabar in a subprocess. r=gps → MozReview Request: Bug 1253651 - Undo changes to PATH made by activating virtualenv in mach artifact. r=glandium
Attachment #8726919 -
Flags: review?(gps) → review?(mh+mozilla)
Assignee | ||
Comment 12•9 years ago
|
||
https://reviewboard.mozilla.org/r/38323/#review34863
> I'd rather save os.environ['PATH '] before running _activate_virtualenv() and restore it after.
Works for me.
Assignee | ||
Updated•9 years ago
|
Attachment #8726919 -
Flags: review?(mh+mozilla)
Assignee | ||
Updated•9 years ago
|
Attachment #8726919 -
Flags: review?(mh+mozilla)
Assignee | ||
Comment 13•9 years ago
|
||
Comment on attachment 8726919 [details]
MozReview Request: Bug 1253651 - Undo changes to PATH made by activating virtualenv in mach artifact. r=glandium
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/38323/diff/3-4/
Comment 14•9 years ago
|
||
https://reviewboard.mozilla.org/r/38323/#review35199
::: python/mozbuild/mozbuild/mach_commands.py:1497
(Diff revision 4)
> + os.environ['PATH'] = original_path
If you are going to hack up the environment, you should have a try..finally block to unhack it.
Comment 15•9 years ago
|
||
Comment on attachment 8726919 [details]
MozReview Request: Bug 1253651 - Undo changes to PATH made by activating virtualenv in mach artifact. r=glandium
https://reviewboard.mozilla.org/r/38323/#review35283
Attachment #8726919 -
Flags: review?(mh+mozilla) → review+
Comment 16•9 years ago
|
||
https://reviewboard.mozilla.org/r/38323/#review35199
> If you are going to hack up the environment, you should have a try..finally block to unhack it.
It's virtualenv_activate that is hacking the environment. This is *restoring* it.
Comment 17•9 years ago
|
||
Comment 18•9 years ago
|
||
bugherder |
Status: REOPENED → RESOLVED
Closed: 9 years ago → 9 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Reporter | ||
Comment 19•9 years ago
|
||
Works like a charm! Thanks for the fix.
Status: RESOLVED → VERIFIED
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
•