Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1023)

Issue 14887003: xcode_emulation: work in the absence of xcodebuild

Created:
7 years, 7 months ago by mistydemeo
Modified:
6 years, 9 months ago
Reviewers:
Mark Mentovai, Nico
CC:
gyp-developer_googlegroups.com
Visibility:
Public.

Description

xcode_emulation: work in the absence of xcodebuild OS X systems running only the Command Line Tools for Xcode package, without the full Xcode, don't have a functioning xcodebuild, but this isn't mandatory for building many gyp projects (e.g. node.js, v8). This commit handles xcodebuild failures and avoids populating Xcode-specific CFLAGS/LDFLAGS when xcodebuild can't be run. This has been tested on both Xcode and CLT-only systems by successfully building node.js. The behaviour can be simulated on systems with Xcode by setting the xcode-select path to something nonsensical, e.g. xcode-select -switch /usr/bin This fixes issue https://code.google.com/p/gyp/issues/detail?id=292 BUG=

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+22 lines, -11 lines) Patch
M pylib/gyp/xcode_emulation.py View 4 chunks +22 lines, -11 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
mistydemeo
This patch allows gyp builds to work in the absence of a working xcodebuild, for ...
7 years, 7 months ago (2013-05-03 03:52:07 UTC) #1
Nico
Thank you for your patch! I'm somewhat afraid that the blanket "catch" might mask problems ...
7 years, 7 months ago (2013-05-03 04:02:57 UTC) #2
mistydemeo
Thank you for the quick review! On 2013/05/03 04:02:57, Nico wrote: > Thank you for ...
7 years, 7 months ago (2013-05-03 04:23:09 UTC) #3
Nico
On 2013/05/03 04:23:09, mistydemeo wrote: > Thank you for the quick review! > > On ...
7 years, 7 months ago (2013-05-03 04:40:14 UTC) #4
mistydemeo
On 2013/05/03 04:40:14, Nico wrote: > On 2013/05/03 04:23:09, mistydemeo wrote: > > Thank you ...
7 years, 7 months ago (2013-05-03 05:03:19 UTC) #5
Nico
7 years, 7 months ago (2013-05-03 05:07:38 UTC) #6
> You might want to consider wrapping xcrun with a function that can also find
CLT
> tools. Homebrew's looks like this:
> https://github.com/mxcl/homebrew/blob/master/Library/Homebrew/macos.rb#L37-L61

Thanks, I'll give that a look!

> > We use it fairly heavily in chromium:
> >
>
https://code.google.com/p/chromium/codesearch#search/&q=%25255C%2524%25255C%2...
> 
> Thanks! In that case, deleting "$(SDKROOT)" should result in valid paths, so
> rather than the example you gave, this should work:
> 
> replacement = self._SdkPath() or ''
> s = s.replace("$(SDKROOT)", replacement)

Right, but then you still need to call _SdkPath(). I'm trying to prevent the
addition of the try:/catch: in that function.

> > The existing tests are in the test/ directory; mac-specific tests are mostly
i
> > test/mac. You can run the tests with `python gyptest.py -a`. You can pass
`-f
> > ninja` to run only the ninja tests, `-f make,xcodebuild` to run make and
> > xcodebuild, and you can pass `test/mac` instead of `-a` to run only the
tests
> > below test/mac instead of all of them. The test runner logic is implemented
in
> > test/lib.
> 
> Thanks, I'll take a look into it.
> 
> Incidentally, what do you recommend to hide stderr using subprocess.popen()? I
> don't write python too frequently.

I think the usual way is

  devnull = open(os.devnull, 'w')
  subprocess.Popen(or call or whatevs)(..., stderr=devnull)

If you want to be tidy, you can then close devnull afterwards, or do

  with open(os.devnull, "w") as devnull:
    subprocess…

Powered by Google App Engine
This is Rietveld 408576698