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

Side by Side Diff: pylib/gyp/common.py

Issue 1806733002: Support DEVELOPER_DIR in gyp-ninja for mac. (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from __future__ import with_statement 5 from __future__ import with_statement
6 6
7 import collections 7 import collections
8 import errno 8 import errno
9 import filecmp 9 import filecmp
10 import os.path 10 import os.path
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 if sys.platform.startswith('openbsd'): 426 if sys.platform.startswith('openbsd'):
427 return 'openbsd' 427 return 'openbsd'
428 if sys.platform.startswith('netbsd'): 428 if sys.platform.startswith('netbsd'):
429 return 'netbsd' 429 return 'netbsd'
430 if sys.platform.startswith('aix'): 430 if sys.platform.startswith('aix'):
431 return 'aix' 431 return 'aix'
432 432
433 return 'linux' 433 return 'linux'
434 434
435 435
436 def CopyTool(flavor, out_path): 436 def CopyTool(flavor, out_path, generator_flags={}):
437 """Finds (flock|mac|win)_tool.gyp in the gyp directory and copies it 437 """Finds (flock|mac|win)_tool.gyp in the gyp directory and copies it
438 to |out_path|.""" 438 to |out_path|."""
439 # aix and solaris just need flock emulation. mac and win use more complicated 439 # aix and solaris just need flock emulation. mac and win use more complicated
440 # support scripts. 440 # support scripts.
441 prefix = { 441 prefix = {
442 'aix': 'flock', 442 'aix': 'flock',
443 'solaris': 'flock', 443 'solaris': 'flock',
444 'mac': 'mac', 444 'mac': 'mac',
445 'win': 'win' 445 'win': 'win'
446 }.get(flavor, None) 446 }.get(flavor, None)
447 if not prefix: 447 if not prefix:
448 return 448 return
449 449
450 # Slurp input file. 450 # Slurp input file.
451 source_path = os.path.join( 451 source_path = os.path.join(
452 os.path.dirname(os.path.abspath(__file__)), '%s_tool.py' % prefix) 452 os.path.dirname(os.path.abspath(__file__)), '%s_tool.py' % prefix)
453 with open(source_path) as source_file: 453 with open(source_path) as source_file:
454 source = source_file.readlines() 454 source = source_file.readlines()
455 455
456 # Set custom header flags.
457 header = '# Generated by gyp. Do not edit.\n'
458 mac_toolchain_dir = generator_flags.get('mac_toolchain_dir', None)
459 if flavor == 'mac' and mac_toolchain_dir:
460 header += "import os;\nos.environ['DEVELOPER_DIR']='%s'\n" \
461 % mac_toolchain_dir
462
456 # Add header and write it out. 463 # Add header and write it out.
457 tool_path = os.path.join(out_path, 'gyp-%s-tool' % prefix) 464 tool_path = os.path.join(out_path, 'gyp-%s-tool' % prefix)
458 with open(tool_path, 'w') as tool_file: 465 with open(tool_path, 'w') as tool_file:
459 tool_file.write( 466 tool_file.write(
460 ''.join([source[0], '# Generated by gyp. Do not edit.\n'] + source[1:])) 467 ''.join([source[0], header] + source[1:]))
461 468
462 # Make file executable. 469 # Make file executable.
463 os.chmod(tool_path, 0755) 470 os.chmod(tool_path, 0755)
464 471
465 472
466 # From Alex Martelli, 473 # From Alex Martelli,
467 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560 474 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
468 # ASPN: Python Cookbook: Remove duplicates from a sequence 475 # ASPN: Python Cookbook: Remove duplicates from a sequence
469 # First comment, dated 2001/10/13. 476 # First comment, dated 2001/10/13.
470 # (Also in the printed Python Cookbook.) 477 # (Also in the printed Python Cookbook.)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 def CrossCompileRequested(): 606 def CrossCompileRequested():
600 # TODO: figure out how to not build extra host objects in the 607 # TODO: figure out how to not build extra host objects in the
601 # non-cross-compile case when this is enabled, and enable unconditionally. 608 # non-cross-compile case when this is enabled, and enable unconditionally.
602 return (os.environ.get('GYP_CROSSCOMPILE') or 609 return (os.environ.get('GYP_CROSSCOMPILE') or
603 os.environ.get('AR_host') or 610 os.environ.get('AR_host') or
604 os.environ.get('CC_host') or 611 os.environ.get('CC_host') or
605 os.environ.get('CXX_host') or 612 os.environ.get('CXX_host') or
606 os.environ.get('AR_target') or 613 os.environ.get('AR_target') or
607 os.environ.get('CC_target') or 614 os.environ.get('CC_target') or
608 os.environ.get('CXX_target')) 615 os.environ.get('CXX_target'))
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698