summaryrefslogtreecommitdiffstats
path: root/build/gyp_chromium
diff options
context:
space:
mode:
authorsgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-16 22:37:47 +0000
committersgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-16 22:37:47 +0000
commitda67d252a2c42b5fd8c46f06e42f07c9c92294bb (patch)
tree9b1375d9f25d916f38c453f3ae11f7d8c87000c4 /build/gyp_chromium
parentfb42c9807220ebff48f2a05641e2c1bdc97714d2 (diff)
downloadchromium_src-da67d252a2c42b5fd8c46f06e42f07c9c92294bb.zip
chromium_src-da67d252a2c42b5fd8c46f06e42f07c9c92294bb.tar.gz
chromium_src-da67d252a2c42b5fd8c46f06e42f07c9c92294bb.tar.bz2
Refactor gyp_chromium so you don't have to execute it from the src/.. directory.
BUG=none TEST='python src/build/gyp_chromium; cd src; python build/gyp_chromium; cd build; python gyp_chromium' Review URL: http://codereview.chromium.org/195107 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26408 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/gyp_chromium')
-rwxr-xr-xbuild/gyp_chromium32
1 files changed, 16 insertions, 16 deletions
diff --git a/build/gyp_chromium b/build/gyp_chromium
index 93687ce..0d0d75d 100755
--- a/build/gyp_chromium
+++ b/build/gyp_chromium
@@ -12,35 +12,35 @@ import os
import shlex
import sys
-print 'Updating projects from gyp files...'
-sys.stdout.flush()
+script_dir = os.path.dirname(__file__)
+chrome_src = os.path.normpath(os.path.join(script_dir, os.pardir))
-chrome_src = os.path.join(os.path.dirname(sys.argv[0]), os.pardir)
-
-try:
- import gyp
-except ImportError, e:
- sys.path.append(os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
- import gyp
+sys.path.append(os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
+import gyp
if __name__ == '__main__':
args = sys.argv[1:]
# If we didn't get a file, check an env var, and then fall back to
- # assuming 'src/build/all.gyp'. This can't have any backslashes as path
- # separators even on Windows due to the use of shlex.split.
- default_gyp_file = 'src/build/all.gyp'
- if len(args) == 0:
- args += shlex.split(os.environ.get('CHROMIUM_GYP_FILE',
- default_gyp_file))
+ # assuming 'all.gyp' from the same directory as the script.
+ gyp_file = os.environ.get('CHROMIUM_GYP_FILE')
+ if gyp_file:
+ # Note that CHROMIUM_GYP_FILE values can't have backslashes as
+ # path separators even on Windows due to the use of shlex.split().
+ args.extend(shlex.split(gyp_file))
+ else:
+ args.append(os.path.join(script_dir, 'all.gyp'))
# Always include common.gypi
- args += ['-I', os.path.join(chrome_src, 'build', 'common.gypi')]
+ args += ['-I', os.path.join(script_dir, 'common.gypi')]
# Optionally add supplemental .gypi files if present.
supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi'))
for supplement in supplements:
args += ['-I', supplement]
+ print 'Updating projects from gyp files...'
+ sys.stdout.flush()
+
# Off we go...
sys.exit(gyp.main(args))