[Checkins] SVN: grokproject/trunk/ Work around virtualenv '-S' bug

Jan-Jaap Driessen jdriessen at thehealthagency.com
Fri Nov 26 06:19:13 EST 2010


Log message for revision 118587:
  Work around virtualenv '-S' bug

Changed:
  U   grokproject/trunk/CHANGES.txt
  U   grokproject/trunk/grokproject/template/bootstrap.py
  U   grokproject/trunk/grokproject/utils.py

-=-
Modified: grokproject/trunk/CHANGES.txt
===================================================================
--- grokproject/trunk/CHANGES.txt	2010-11-26 07:56:54 UTC (rev 118586)
+++ grokproject/trunk/CHANGES.txt	2010-11-26 11:19:12 UTC (rev 118587)
@@ -8,6 +8,8 @@
 
 - Added 'daemon' part to the newly created buildout.cfg.
 
+- Work around '-S' bug in virtualenv.
+  https://bugs.launchpad.net/virtualenv/+bug/572545
 
 2.1 (2010-10-26)
 ----------------

Modified: grokproject/trunk/grokproject/template/bootstrap.py
===================================================================
--- grokproject/trunk/grokproject/template/bootstrap.py	2010-11-26 07:56:54 UTC (rev 118586)
+++ grokproject/trunk/grokproject/template/bootstrap.py	2010-11-26 11:19:12 UTC (rev 118587)
@@ -46,12 +46,21 @@
 # run without site-packages loaded.  This is somewhat tricky, in
 # particular because Python 2.6's distutils imports site, so starting
 # with the -S flag is not sufficient.  However, we'll start with that:
-if not has_broken_dash_S and 'site' in sys.modules:
-    # We will restart with python -S.
-    args = sys.argv[:]
-    args[0:0] = [sys.executable, '-S']
-    args = map(quote, args)
-    os.execv(sys.executable, args)
+
+# XXX There is a difference between 'stock' zc.buildout bootstrap.py and this
+# bootstrap.py.
+# This is a hack around restarting the bootstrap run in order not to restart
+# with '-S', as this raises problems when ran from a virtualenv. As soon as
+# virtualenv and -S play nice again, revert this hack.
+# https://bugs.launchpad.net/virtualenv/+bug/572545
+
+# if not has_broken_dash_S and 'site' in sys.modules:
+#     # We will restart with python -S.
+#     args = sys.argv[:]
+#     args[0:0] = [sys.executable, '-S']
+#     args = map(quote, args)
+#     os.execv(sys.executable, args)
+
 # Now we are running with -S.  We'll get the clean sys.path, import site
 # because distutils will do it later, and then reset the path and clean
 # out any namespace packages from site-packages that might have been

Modified: grokproject/trunk/grokproject/utils.py
===================================================================
--- grokproject/trunk/grokproject/utils.py	2010-11-26 07:56:54 UTC (rev 118586)
+++ grokproject/trunk/grokproject/utils.py	2010-11-26 11:19:12 UTC (rev 118587)
@@ -96,7 +96,7 @@
 
 def run_buildout(verbose=False, use_distribute=False):
     # Run the project's bootstrap.
-    cmd = sys.executable + ' -S ' + os.path.join(os.getcwd(), 'bootstrap.py')
+    cmd = sys.executable + '' + os.path.join(os.getcwd(), 'bootstrap.py')
     if use_distribute:
         cmd += ' --distribute'
     print 'Running %s...' % cmd



More information about the checkins mailing list