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

Side by Side Diff: pylib/gyp/generator/ninja.py

Issue 1236933002: Make RelativePath use abspath rather than realpath for the 'path' variable. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Updated copywrite in hello.c and hello.gyp 2009->2015. The presubmit doesn't pass with a 2009 copyw… Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « pylib/gyp/common.py ('k') | test/symlinks/gyptest-symlinks.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) 2013 Google Inc. All rights reserved. 1 # Copyright (c) 2013 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 import collections 5 import collections
6 import copy 6 import copy
7 import hashlib 7 import hashlib
8 import json 8 import json
9 import multiprocessing 9 import multiprocessing
10 import os.path 10 import os.path
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 cflags_c = config.get('cflags_c', []) 914 cflags_c = config.get('cflags_c', [])
915 cflags_cc = config.get('cflags_cc', []) 915 cflags_cc = config.get('cflags_cc', [])
916 916
917 # Respect environment variables related to build, but target-specific 917 # Respect environment variables related to build, but target-specific
918 # flags can still override them. 918 # flags can still override them.
919 if self.toolset == 'target': 919 if self.toolset == 'target':
920 cflags_c = (os.environ.get('CPPFLAGS', '').split() + 920 cflags_c = (os.environ.get('CPPFLAGS', '').split() +
921 os.environ.get('CFLAGS', '').split() + cflags_c) 921 os.environ.get('CFLAGS', '').split() + cflags_c)
922 cflags_cc = (os.environ.get('CPPFLAGS', '').split() + 922 cflags_cc = (os.environ.get('CPPFLAGS', '').split() +
923 os.environ.get('CXXFLAGS', '').split() + cflags_cc) 923 os.environ.get('CXXFLAGS', '').split() + cflags_cc)
924 elif self.toolset == 'host':
925 cflags_c = (os.environ.get('CPPFLAGS_host', '').split() +
926 os.environ.get('CFLAGS_host', '').split() + cflags_c)
927 cflags_cc = (os.environ.get('CPPFLAGS_host', '').split() +
928 os.environ.get('CXXFLAGS_host', '').split() + cflags_cc)
924 929
925 defines = config.get('defines', []) + extra_defines 930 defines = config.get('defines', []) + extra_defines
926 self.WriteVariableList(ninja_file, 'defines', 931 self.WriteVariableList(ninja_file, 'defines',
927 [Define(d, self.flavor) for d in defines]) 932 [Define(d, self.flavor) for d in defines])
928 if self.flavor == 'win': 933 if self.flavor == 'win':
929 self.WriteVariableList(ninja_file, 'asmflags', 934 self.WriteVariableList(ninja_file, 'asmflags',
930 map(self.ExpandSpecial, asmflags)) 935 map(self.ExpandSpecial, asmflags))
931 self.WriteVariableList(ninja_file, 'rcflags', 936 self.WriteVariableList(ninja_file, 'rcflags',
932 [QuoteShellArgument(self.ExpandSpecial(f), self.flavor) 937 [QuoteShellArgument(self.ExpandSpecial(f), self.flavor)
933 for f in self.msvs_settings.GetRcflags(config_name, 938 for f in self.msvs_settings.GetRcflags(config_name,
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 1670
1666 def CommandWithWrapper(cmd, wrappers, prog): 1671 def CommandWithWrapper(cmd, wrappers, prog):
1667 wrapper = wrappers.get(cmd, '') 1672 wrapper = wrappers.get(cmd, '')
1668 if wrapper: 1673 if wrapper:
1669 return wrapper + ' ' + prog 1674 return wrapper + ' ' + prog
1670 return prog 1675 return prog
1671 1676
1672 1677
1673 def GetDefaultConcurrentLinks(): 1678 def GetDefaultConcurrentLinks():
1674 """Returns a best-guess for a number of concurrent links.""" 1679 """Returns a best-guess for a number of concurrent links."""
1675 pool_size = int(os.getenv('GYP_LINK_CONCURRENCY', 0)) 1680 pool_size = int(os.environ.get('GYP_LINK_CONCURRENCY', 0))
1676 if pool_size: 1681 if pool_size:
1677 return pool_size 1682 return pool_size
1678 1683
1679 if sys.platform in ('win32', 'cygwin'): 1684 if sys.platform in ('win32', 'cygwin'):
1680 import ctypes 1685 import ctypes
1681 1686
1682 class MEMORYSTATUSEX(ctypes.Structure): 1687 class MEMORYSTATUSEX(ctypes.Structure):
1683 _fields_ = [ 1688 _fields_ = [
1684 ("dwLength", ctypes.c_ulong), 1689 ("dwLength", ctypes.c_ulong),
1685 ("dwMemoryLoad", ctypes.c_ulong), 1690 ("dwMemoryLoad", ctypes.c_ulong),
1686 ("ullTotalPhys", ctypes.c_ulonglong), 1691 ("ullTotalPhys", ctypes.c_ulonglong),
1687 ("ullAvailPhys", ctypes.c_ulonglong), 1692 ("ullAvailPhys", ctypes.c_ulonglong),
1688 ("ullTotalPageFile", ctypes.c_ulonglong), 1693 ("ullTotalPageFile", ctypes.c_ulonglong),
1689 ("ullAvailPageFile", ctypes.c_ulonglong), 1694 ("ullAvailPageFile", ctypes.c_ulonglong),
1690 ("ullTotalVirtual", ctypes.c_ulonglong), 1695 ("ullTotalVirtual", ctypes.c_ulonglong),
1691 ("ullAvailVirtual", ctypes.c_ulonglong), 1696 ("ullAvailVirtual", ctypes.c_ulonglong),
1692 ("sullAvailExtendedVirtual", ctypes.c_ulonglong), 1697 ("sullAvailExtendedVirtual", ctypes.c_ulonglong),
1693 ] 1698 ]
1694 1699
1695 stat = MEMORYSTATUSEX() 1700 stat = MEMORYSTATUSEX()
1696 stat.dwLength = ctypes.sizeof(stat) 1701 stat.dwLength = ctypes.sizeof(stat)
1697 ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) 1702 ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat))
1698 1703
1699 # VS 2015 uses 20% more working set than VS 2013 and can consume all RAM 1704 # VS 2015 uses 20% more working set than VS 2013 and can consume all RAM
1700 # on a 64 GB machine. 1705 # on a 64 GB machine.
1701 mem_limit = max(1, stat.ullTotalPhys / (5 * (2 ** 30))) # total / 5GB 1706 mem_limit = max(1, stat.ullTotalPhys / (5 * (2 ** 30))) # total / 5GB
1702 hard_cap = max(1, int(os.getenv('GYP_LINK_CONCURRENCY_MAX', 2**32))) 1707 hard_cap = max(1, int(os.environ.get('GYP_LINK_CONCURRENCY_MAX', 2**32)))
1703 return min(mem_limit, hard_cap) 1708 return min(mem_limit, hard_cap)
1704 elif sys.platform.startswith('linux'): 1709 elif sys.platform.startswith('linux'):
1705 if os.path.exists("/proc/meminfo"): 1710 if os.path.exists("/proc/meminfo"):
1706 with open("/proc/meminfo") as meminfo: 1711 with open("/proc/meminfo") as meminfo:
1707 memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB') 1712 memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB')
1708 for line in meminfo: 1713 for line in meminfo:
1709 match = memtotal_re.match(line) 1714 match = memtotal_re.match(line)
1710 if not match: 1715 if not match:
1711 continue 1716 continue
1712 # Allow 8Gb per link on Linux because Gold is quite memory hungry 1717 # Allow 8Gb per link on Linux because Gold is quite memory hungry
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 arglists.append( 2389 arglists.append(
2385 (target_list, target_dicts, data, params, config_name)) 2390 (target_list, target_dicts, data, params, config_name))
2386 pool.map(CallGenerateOutputForConfig, arglists) 2391 pool.map(CallGenerateOutputForConfig, arglists)
2387 except KeyboardInterrupt, e: 2392 except KeyboardInterrupt, e:
2388 pool.terminate() 2393 pool.terminate()
2389 raise e 2394 raise e
2390 else: 2395 else:
2391 for config_name in config_names: 2396 for config_name in config_names:
2392 GenerateOutputForConfig(target_list, target_dicts, data, params, 2397 GenerateOutputForConfig(target_list, target_dicts, data, params,
2393 config_name) 2398 config_name)
OLDNEW
« no previous file with comments | « pylib/gyp/common.py ('k') | test/symlinks/gyptest-symlinks.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698