|
|
Created:
7 years, 7 months ago by Daniel Bratell Modified:
7 years, 6 months ago CC:
chromium-reviews Base URL:
https://chromium.googlesource.com/chromium/src.git@master Visibility:
Public. |
DescriptionMake gyp_chromium.py work with Python 2.7.
gyp_chromium.py contained a Python 2.6 Windows bug workaround which turns out to be harmful with Python 2.7 since it will just include itself without doing anything.
BUG=
R=scottmg@chromium.org
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=202578
Patch Set 1 #Patch Set 2 : Simplified. #
Total comments: 1
Patch Set 3 : Addressed comments about comments. #Messages
Total messages: 18 (0 generated)
This is really no big deal but I wasted some time trying to figure out why things were broken so I imagines this could save some time for someone else.
Will this work on 2.6? I don't think multiprocessing imports with __name__ == '__main__'?
On 2013/05/15 15:22:39, scottmg wrote: > Will this work on 2.6? I don't think multiprocessing imports with __name__ == > '__main__'? It works when run from the console in with python 2.6, but I didn't test with multiprocessing because I don't know what it is, but I think you're right. If you point me to multiprocessing I can check what it does and see if I can put together a better solution.
On 2013/05/15 15:34:49, bratell wrote: > On 2013/05/15 15:22:39, scottmg wrote: > > Will this work on 2.6? I don't think multiprocessing imports with __name__ == > > '__main__'? > > It works when run from the console in with python 2.6, but I didn't test with > multiprocessing because I don't know what it is, but I think you're right. > > If you point me to multiprocessing I can check what it does and see if I can put > together a better solution. If you set an environment variable GYP_PARALLEL=1 then gyp uses http://docs.python.org/2/library/multiprocessing.html to parse the gyp input files in parallel, and generate the output configs in parallel (for ninja). This file was working around people running "python build\gyp_chromium" on windows, but multiprocessing expecting to find a script named "gyp_chromium.py" when relaunching subprocesses.
I just removed the error handling code that tried to be nice to the user. If it can't detect an error condition, well, then it can't.
lgtm with comment https://codereview.chromium.org/14670009/diff/6001/build/gyp_chromium.py File build/gyp_chromium.py (right): https://codereview.chromium.org/14670009/diff/6001/build/gyp_chromium.py#newc... build/gyp_chromium.py:8: # their command line to add a .py when running gyp_chromium. please add "This is necessary when multiprocessing reinvokes gyp_chromium when using GYP_PARALLEL=1" or similar.
(nit: cl descript says ".oy" instead of ".py". also might want to mention that this mostly affects windows since gyp_chromium.py isn't used elsewhere afaik)
On 2013/05/16 16:53:43, Nico wrote: > (nit: cl descript says ".oy" instead of ".py". also might want to mention that > this mostly affects windows since gyp_chromium.py isn't used elsewhere afaik) Do I need a new lgtm for the updated patch or does the old one still apply?
On 2013/05/20 13:51:48, bratell wrote: > On 2013/05/16 16:53:43, Nico wrote: > > (nit: cl descript says ".oy" instead of ".py". also might want to mention that > > this mostly affects windows since gyp_chromium.py isn't used elsewhere afaik) > > Do I need a new lgtm for the updated patch or does the old one still apply? Just fix "gyp_chromuim.py" -> "gyp_chromium.py" in the description and lgtm.
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bratell@opera.com/14670009/12001
Failed to apply patch for build/gyp_chromium.py: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file build/gyp_chromium.py Hunk #1 FAILED at 2. 1 out of 1 hunk FAILED -- saving rejects to file build/gyp_chromium.py.rej Patch: build/gyp_chromium.py Index: build/gyp_chromium.py diff --git a/build/gyp_chromium.py b/build/gyp_chromium.py index 29bac98c9253f29d0ad7af25d7f29bc9227c3623..c22398e2039e2ab110c59063eae59af365b3a246 100644 --- a/build/gyp_chromium.py +++ b/build/gyp_chromium.py @@ -2,8 +2,17 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# This is a workaround for multiprocessing on Windows. Importing in Python on -# Windows doesn't search for imports that don't end in .py (and aren't -# directories with an __init__.py). So, add this wrapper to avoid having -# people change their command line to add a .py when running gyp_chromium. -__import__('gyp_chromium') +# This file is (possibly, depending on python version) imported by +# gyp_chromium when GYP_PARALLEL=1 and it creates sub-processes +# through the multiprocessing library. + +# Importing in Python 2.6 (fixed in 2.7) on Windows doesn't search for +# imports that don't end in .py (and aren't directories with an +# __init__.py). This wrapper makes "import gyp_chromium" work with +# those old versions and makes it possible to execute gyp_chromium.py +# directly on Windows where the extension is useful. + +import os + +path = os.path.abspath(os.path.split(__file__)[0]) +execfile(os.path.join(path, 'gyp_chromium'))
Any guess why the patch doesn't apply? I've uploaded it with "git cl upload" and the file hasn't been changed for a year.
On 2013/05/20 16:59:04, bratell wrote: > Any guess why the patch doesn't apply? I've uploaded it with "git cl upload" and > the file hasn't been changed for a year. Possibly line endings? I might have committed the original with dos line endings mistakenly. I'm not sure how to fix it w/o dcommitting.
scottmg, do you think you could help me land this? I have no other way of doing it than checking the Commit checkbox and if the commitbot doesn't want to help there is nothing I can do. (I did mail it about this but got no response.)
On 2013/05/28 09:19:10, bratell wrote: > scottmg, do you think you could help me land this? I have no other way of doing > it than checking the Commit checkbox and if the commitbot doesn't want to help > there is nothing I can do. (I did mail it about this but got no response.) OK, I'll land it. It seems to work OK on 2.6, but I haven't tried on 2.7.
Message was sent while issue was closed.
Committed patchset #3 manually as r202578 (presubmit successful).
Message was sent while issue was closed.
On 2013/05/28 16:02:19, scottmg wrote: > Committed patchset #3 manually as r202578 (presubmit successful). Thanks a lot for your help! |