Bug 794506 - Part 1: Move virtualenv code under mozbuild; r=ted
authorGregory Szorc <gps@mozilla.com>
Fri, 20 Sep 2013 15:46:23 -0700
changeset 148218 c678ea1db9c9233f23fb97345302f1991c81a201
parent 148217 61972f55702b702dd31deb4254a0985d0506dcfc
child 148219 392068d519fbd2d1a4aec7c31027d9712b5c1d8e
push id2780
push userphilringnalda@gmail.com
push dateSun, 22 Sep 2013 16:16:37 +0000
treeherderfx-team@41047800c65c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs794506
milestone27.0a1
Bug 794506 - Part 1: Move virtualenv code under mozbuild; r=ted
build/autoconf/python-virtualenv.m4
build/virtualenv/packages.txt
build/virtualenv/populate_virtualenv.py
build/virtualenv_packages.txt
client.mk
js/src/build/autoconf/python-virtualenv.m4
python/mozbuild/mozbuild/virtualenv.py
--- a/build/autoconf/python-virtualenv.m4
+++ b/build/autoconf/python-virtualenv.m4
@@ -19,17 +19,17 @@ fi
 
 _virtualenv_topsrcdir=
 _virtualenv_populate_path=
 
 dnl If this is a mozilla-central, we'll find the virtualenv in the top
 dnl source directory. If this is a SpiderMonkey build, we assume we're at
 dnl js/src and try to find the virtualenv from the mozilla-central root.
 for base in $MOZILLA_CENTRAL_PATH $_topsrcdir $_topsrcdir/../..; do
-  possible=$base/build/virtualenv/populate_virtualenv.py
+  possible=$base/python/mozbuild/mozbuild/virtualenv.py
 
   if test -e $possible; then
     _virtualenv_topsrcdir=$base
     _virtualenv_populate_path=$possible
     break
   fi
 done
 
@@ -48,17 +48,18 @@ mozilla-central and relaunch configure.]
 fi
 
 if test -z $DONT_POPULATE_VIRTUALENV; then
   AC_MSG_RESULT([Creating Python environment])
   dnl This verifies our Python version is sane and ensures the Python
   dnl virtualenv is present and up to date. It sanitizes the environment
   dnl for us, so we don't need to clean anything out.
   $PYTHON $_virtualenv_populate_path \
-    $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv || exit 1
+    $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv \
+    $_virtualenv_topsrcdir/build/virtualenv_packages.txt || exit 1
 
   case "$host_os" in
   mingw*)
     PYTHON=`cd $MOZ_BUILD_ROOT && pwd -W`/_virtualenv/Scripts/python.exe
     ;;
   *)
     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
     ;;
rename from build/virtualenv/packages.txt
rename to build/virtualenv_packages.txt
--- a/client.mk
+++ b/client.mk
@@ -320,18 +320,18 @@ EXTRA_CONFIG_DEPS := \
 CONFIG_STATUS_DEPS := \
   $(wildcard $(TOPSRCDIR)/*/confvars.sh) \
   $(CONFIGURES) \
   $(TOPSRCDIR)/CLOBBER \
   $(TOPSRCDIR)/nsprpub/configure \
   $(TOPSRCDIR)/config/milestone.txt \
   $(TOPSRCDIR)/js/src/config/milestone.txt \
   $(TOPSRCDIR)/browser/config/version.txt \
-  $(TOPSRCDIR)/build/virtualenv/packages.txt \
-  $(TOPSRCDIR)/build/virtualenv/populate_virtualenv.py \
+  $(TOPSRCDIR)/build/virtualenv_packages.txt \
+  $(TOPSRCDIR)/python/mozbuild/mozbuild/virtualenv.py \
   $(TOPSRCDIR)/testing/mozbase/packages.txt \
   $(NULL)
 
 CONFIGURE_ENV_ARGS += \
   MAKE="$(MAKE)" \
   $(NULL)
 
 # configure uses the program name to determine @srcdir@. Calling it without
--- a/js/src/build/autoconf/python-virtualenv.m4
+++ b/js/src/build/autoconf/python-virtualenv.m4
@@ -19,17 +19,17 @@ fi
 
 _virtualenv_topsrcdir=
 _virtualenv_populate_path=
 
 dnl If this is a mozilla-central, we'll find the virtualenv in the top
 dnl source directory. If this is a SpiderMonkey build, we assume we're at
 dnl js/src and try to find the virtualenv from the mozilla-central root.
 for base in $MOZILLA_CENTRAL_PATH $_topsrcdir $_topsrcdir/../..; do
-  possible=$base/build/virtualenv/populate_virtualenv.py
+  possible=$base/python/mozbuild/mozbuild/virtualenv.py
 
   if test -e $possible; then
     _virtualenv_topsrcdir=$base
     _virtualenv_populate_path=$possible
     break
   fi
 done
 
@@ -48,17 +48,18 @@ mozilla-central and relaunch configure.]
 fi
 
 if test -z $DONT_POPULATE_VIRTUALENV; then
   AC_MSG_RESULT([Creating Python environment])
   dnl This verifies our Python version is sane and ensures the Python
   dnl virtualenv is present and up to date. It sanitizes the environment
   dnl for us, so we don't need to clean anything out.
   $PYTHON $_virtualenv_populate_path \
-    $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv || exit 1
+    $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv \
+    $_virtualenv_topsrcdir/build/virtualenv_packages.txt || exit 1
 
   case "$host_os" in
   mingw*)
     PYTHON=`cd $MOZ_BUILD_ROOT && pwd -W`/_virtualenv/Scripts/python.exe
     ;;
   *)
     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
     ;;
rename from build/virtualenv/populate_virtualenv.py
rename to python/mozbuild/mozbuild/virtualenv.py
--- a/build/virtualenv/populate_virtualenv.py
+++ b/python/mozbuild/mozbuild/virtualenv.py
@@ -361,17 +361,17 @@ class VirtualenvManager(object):
         """
 
         self.create()
 
         # We need to populate the virtualenv using the Python executable in
         # the virtualenv for paths to be proper.
 
         args = [self.python_path, __file__, 'populate', self.topsrcdir,
-            self.topobjdir, self.virtualenv_root]
+            self.topobjdir, self.virtualenv_root, self.manifest_path]
 
         result = subprocess.call(args, stdout=self.log_handle,
             stderr=subprocess.STDOUT, cwd=self.topsrcdir)
 
         if result != 0:
             raise Exception('Error populating virtualenv.')
 
         os.utime(self.activate_path, None)
@@ -404,36 +404,29 @@ def verify_python_version(log_handle):
             log_handle.write(UPGRADE_WINDOWS)
         else:
             log_handle.write(UPGRADE_OTHER)
 
         sys.exit(1)
 
 
 if __name__ == '__main__':
-    if len(sys.argv) < 4:
-        print('Usage: populate_virtualenv.py /path/to/topsrcdir /path/to/topobjdir /path/to/virtualenv')
+    if len(sys.argv) < 5:
+        print('Usage: populate_virtualenv.py /path/to/topsrcdir /path/to/topobjdir /path/to/virtualenv /path/to/virtualenv_manifest')
         sys.exit(1)
 
     verify_python_version(sys.stdout)
 
-    topsrcdir = sys.argv[1]
-    topobjdir = sys.argv[2]
-    virtualenv_path = sys.argv[3]
+    topsrcdir, topobjdir, virtualenv_path, manifest_path = sys.argv[1:5]
     populate = False
 
     # This should only be called internally.
     if sys.argv[1] == 'populate':
         populate = True
-        topsrcdir = sys.argv[2]
-        topobjdir = sys.argv[3]
-        virtualenv_path = sys.argv[4]
-
-    # path to default packages.txt
-    manifest_path = os.path.join(topsrcdir, 'build', 'virtualenv', 'packages.txt')
+        topsrcdir, topobjdir, virtualenv_path, manifest_path = sys.argv[2:]
 
     manager = VirtualenvManager(topsrcdir, topobjdir, virtualenv_path,
         sys.stdout, manifest_path)
 
     if populate:
         manager.populate()
     else:
         manager.ensure()