[Checkins] SVN: zc.buildout/branches/help-api/bootstrap/bootstrap.py Allow to bootstrap on Jython.

Godefroid Chapelle gotcha at bubblenet.be
Sun Mar 29 17:25:25 EDT 2009


Log message for revision 98541:
  Allow to bootstrap on Jython.
  
  Signed-off-by: Georgy Berdyshev - ?\208?\147?\208?\181?\208?\190?\209?\128?\208?\179?\208?\184?\208?\185 ?\208?\145?\208?\181?\209?\128?\208?\180?\209?\139?\209?\136?\208?\181?\208?\178 <codingmaster at gmail.com>

Changed:
  U   zc.buildout/branches/help-api/bootstrap/bootstrap.py

-=-
Modified: zc.buildout/branches/help-api/bootstrap/bootstrap.py
===================================================================
--- zc.buildout/branches/help-api/bootstrap/bootstrap.py	2009-03-29 21:25:19 UTC (rev 98540)
+++ zc.buildout/branches/help-api/bootstrap/bootstrap.py	2009-03-29 21:25:25 UTC (rev 98541)
@@ -24,6 +24,8 @@
 
 tmpeggs = tempfile.mkdtemp()
 
+is_jython = sys.platform.startswith('java')
+
 try:
     import pkg_resources
 except ImportError:
@@ -46,15 +48,28 @@
 
 cmd = 'from setuptools.command.easy_install import main; main()'
 ws  = pkg_resources.working_set
-assert os.spawnle(
-    os.P_WAIT, sys.executable, quote (sys.executable),
-    '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout',
-    dict(os.environ,
-         PYTHONPATH=
-         ws.find(pkg_resources.Requirement.parse('setuptools')).location
-         ),
-    ) == 0
 
+if is_jython:
+    import subprocess
+    
+    assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd', 
+           quote(tmpeggs), 'zc.buildout'], 
+           env=dict(os.environ,
+               PYTHONPATH=
+               ws.find(pkg_resources.Requirement.parse('setuptools')).location
+               ),
+           ).wait() == 0
+
+else:
+    assert os.spawnle(
+        os.P_WAIT, sys.executable, quote (sys.executable),
+        '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout',
+        dict(os.environ,
+            PYTHONPATH=
+            ws.find(pkg_resources.Requirement.parse('setuptools')).location
+            ),
+        ) == 0
+
 ws.add_entry(tmpeggs)
 ws.require('zc.buildout')
 import zc.buildout.buildout



More information about the Checkins mailing list