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

Unified Diff: editor/build/build.py

Issue 22393002: First CL for removing our dependency on the checked-in binary for building (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/tools/buildbot_annotated_steps.py ('k') | editor/build/create_analyzer.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/build/build.py
diff --git a/editor/build/build.py b/editor/build/build.py
index 0887d8fc7c96dae6e42c0717b84b06a7a5290585..3355eb94075655a134a7b2049a61d32a73fa2c96 100755
--- a/editor/build/build.py
+++ b/editor/build/build.py
@@ -5,6 +5,9 @@
# BSD-style license that can be found in the LICENSE file.
import glob
+import gsutil
+import hashlib
+import imp
import optparse
import os
import re
@@ -12,9 +15,7 @@ import shutil
import subprocess
import sys
import tempfile
-import gsutil
import ziputils
-import hashlib
from os.path import join
@@ -34,7 +35,12 @@ PLUGINS_BUILD = None
NO_UPLOAD = None
-utils = None
+def GetUtils():
+ '''Dynamically load the tools/utils.py python module.'''
+ dart_dir = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
+ return imp.load_source('utils', os.path.join(dart_dir, 'tools', 'utils.py'))
+
+utils = GetUtils()
class AntWrapper(object):
"""A wrapper for ant build invocations"""
@@ -171,26 +177,6 @@ def BuildOptions():
action='store')
return result
-
-def GetUtils(toolspath):
- """Dynamically get the utils module.
-
- We use a dynamic import for tools/util.py because we derive its location
- dynamically using sys.argv[0]. This allows us to run this script from
- different directories.
-
- Args:
- toolspath: the path to the tools directory
-
- Returns:
- the utils module
- """
- global utils
- sys.path.append(os.path.abspath(toolspath))
- utils = __import__('utils')
- return utils
-
-
def main():
"""Main entry point for the build program."""
global BUILD_OS
@@ -204,7 +190,6 @@ def main():
global MILESTONE_BUILD
global PLUGINS_BUILD
global NO_UPLOAD
- global utils
if not sys.argv:
print 'Script pathname not known, giving up.'
@@ -221,7 +206,6 @@ def main():
bzip2libpath = os.path.join(thirdpartypath, 'bzip2')
buildpath = os.path.join(editorpath, 'tools', 'features',
'com.google.dart.tools.deploy.feature_releng')
- utils = GetUtils(toolspath)
buildos = utils.GuessOS()
BUILD_OS = utils.GuessOS()
« no previous file with comments | « client/tools/buildbot_annotated_steps.py ('k') | editor/build/create_analyzer.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698