Closed Bug 1436639 Opened 6 years ago Closed 6 years ago

[flake8] Explicitly use version of python run with mach

Categories

(Developer Infrastructure :: Lint and Formatting, enhancement, P1)

3 Branch
enhancement

Tracking

(firefox60 fixed)

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: ahal, Assigned: ahal)

References

Details

Attachments

(1 file)

I noticed the flake8 linter will use whatever the default 'python' is. For example, the machine reviewbot runs on has python 3 by default, so we're seeing 'undefined name basestring' errors.

It looks like instead of:
flake8 ...

We need to run:
python2.7 -mflake8 ...

(Though using sys.executable instead of hardcoding anything)
Comment on attachment 8949275 [details]
Bug 1436639 - [lint] Make sure flake8 is run with same python as |mach lint| was,

https://reviewboard.mozilla.org/r/218640/#review224496

looks good
Attachment #8949275 - Flags: review?(jmaher) → review+
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c9d150401eea
[lint] Make sure flake8 is run with same python as |mach lint| was, r=jmaher
Depends on: 1436777
Oops, I forgot that sys.executable doesn't point to the virtualenv python due to bug 1436777. Out of an abundance of caution I'm going to ask for this to be backed out, fix bug 1436777, and then re-land.
Flags: needinfo?(ahalberstadt)
https://hg.mozilla.org/mozilla-central/rev/c9d150401eea
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Apparently modifying sys.executable can cause problems in some cases, so it's not something we want to do all the time. Luckily sys.prefix *does* get modified, so I can come up with a new patch that uses that instead.

Enough has changed that this should get a re-review. Patch coming shortly.
Comment on attachment 8949275 [details]
Bug 1436639 - [lint] Make sure flake8 is run with same python as |mach lint| was,

Sorry, the old patch you reviewed had a problem, and I think this warrants a re-review.

Basically sys.executable doesn't get updated to the build system python environment, but sys.prefix does.
Attachment #8949275 - Flags: review+ → review?(jmaher)
Comment on attachment 8949275 [details]
Bug 1436639 - [lint] Make sure flake8 is run with same python as |mach lint| was,

https://reviewboard.mozilla.org/r/218640/#review225628

this doesn't look scary
Attachment #8949275 - Flags: review?(jmaher) → review+
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/365a91ab41e2
[lint] Make sure flake8 is run with same python as |mach lint| was, r=jmaher
https://hg.mozilla.org/mozilla-central/rev/365a91ab41e2
Status: REOPENED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Product: Testing → Firefox Build System
Version: Version 3 → 3 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: