New issue
Advanced search Search tips

Issue 759231 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

format-webkitpy: No module named pep8

Project Member Reported by skobes@chromium.org, Aug 25 2017

Issue description

When I run format-webkitpy on Ubuntu, I get the following:

$ third_party/WebKit/Tools/Scripts/format-webkitpy 
Traceback (most recent call last):
  File "third_party/WebKit/Tools/Scripts/format-webkitpy", line 8, in <module>
    from webkitpy.formatter.main import main
  File "/b/c/src/third_party/WebKit/Tools/Scripts/webkitpy/formatter/main.py", line 9, in <module>
    from webkitpy.thirdparty import autopep8
  File "/b/c/src/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/autopep8.py", line 59, in <module>
    import pep8
ImportError: No module named pep8

I attempted to install pep8 as follows, and it seemed to succeed:

$ sudo pip install pep8
[sudo] password for skobes: 
Downloading/unpacking pep8
  Downloading pep8-1.7.0-py2.py3-none-any.whl (41kB): 41kB downloaded
Installing collected packages: pep8
Successfully installed pep8
Cleaning up...

However, I still get the same error from format-webkitpy.
 
Status: Available (was: Unconfirmed)
Confirmed, thanks for reporting. I think that the pep8 dependency was supposed to be satisfied by webkitpy/thirdparty/pep8.py.

Invoking it without vpython (with `python format-webkitpy`) works. So after vpython I think we need to change it to explicitly change sys.path to get that dependency?
Cc: -qyears...@chromium.org
Owner: qyears...@chromium.org
Status: Started (was: Available)
https://chromium-review.googlesource.com/c/chromium/src/+/638693
Project Member

Comment 3 by bugdroid1@chromium.org, Aug 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ef32c4ae540cb5cf1be5117f9a800389cfa4864d

commit ef32c4ae540cb5cf1be5117f9a800389cfa4864d
Author: Quinten Yearsley <qyearsley@google.com>
Date: Mon Aug 28 22:46:19 2017

In formatter/main.py change sys.path so that pep8 can be found

Bug:  759231 
Change-Id: I93ec80617bd361d444c5bd6a05e3a497666c6cce
Reviewed-on: https://chromium-review.googlesource.com/638693
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#497914}
[modify] https://crrev.com/ef32c4ae540cb5cf1be5117f9a800389cfa4864d/third_party/WebKit/Tools/Scripts/webkitpy/common/path_finder.py
[modify] https://crrev.com/ef32c4ae540cb5cf1be5117f9a800389cfa4864d/third_party/WebKit/Tools/Scripts/webkitpy/formatter/main.py

Status: Fixed (was: Started)

Comment 5 by skobes@chromium.org, Aug 28 2017

Thanks for the quick fix!
I'm a bit confused... if this is using vpython, why didn't we add pep8 to the vpython spec?

Changing sys.path leads to the dark side of the force (most of the time :)).
Status: Started (was: Fixed)
:-) That's true.

My excuse/rationale here was that pep8 is used only for this script, so it doesn't quite seem right to put it in Tools/Scripts/common.vpython -- and pep8.py is already in webkitpy/thirdparty/.

Do you still think it's better to use vpython to get it? I could put a venv config inside of a comment in Tools/Scripts/format-webkitpy, right?
Ideally we'd have a common set of packages that we added and used chromium-wide and then we'd get rid of the individually hand-managed packages that have been checked in (like the ones in webkitpy/thirdparty).
Status: Fixed (was: Started)
Right, that's true.

I'll close this bug for now; tweaking the code to use the copy of pep8 in webkitpy/thirdparty was just keeping the status quo; it's worth noting that in general in the future we can decrease the number of checked-in dependencies.

Sign in to add a comment