[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/buildout.py Added Jython support.

Georgy Berdyshev codingmaster at gmail.com
Wed Aug 27 18:44:52 EDT 2008


Log message for revision 90480:
  Added Jython support.
  
  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/trunk/src/zc/buildout/buildout.py

-=-
Modified: zc.buildout/trunk/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/buildout.py	2008-08-27 22:44:48 UTC (rev 90479)
+++ zc.buildout/trunk/src/zc/buildout/buildout.py	2008-08-27 22:44:52 UTC (rev 90480)
@@ -43,6 +43,11 @@
 
 _isurl = re.compile('([a-zA-Z0-9+.-]+)://').match
 
+is_jython = sys.platform.startswith('java')
+
+if is_jython:
+    import subprocess
+
 class MissingOption(zc.buildout.UserError, KeyError):
     """A required option was missing
     """
@@ -780,8 +785,12 @@
         if not __debug__:
             args.insert(0, '-O')
         args.insert(0, zc.buildout.easy_install._safe_arg (sys.executable))
-        sys.exit(os.spawnv(os.P_WAIT, sys.executable, args))
 
+        if is_jython:
+            sys.exit(subprocess.Popen([sys.executable] + list(args)).wait())
+        else:
+            sys.exit(os.spawnv(os.P_WAIT, sys.executable, args))
+
     def _load_extensions(self):
         __doing__ = 'Loading extensions.'
         specs = self['buildout'].get('extensions', '').split()
@@ -831,9 +840,19 @@
                 setup=setup,
                 __file__ = setup,
                 ))
-            os.spawnl(os.P_WAIT, sys.executable, zc.buildout.easy_install._safe_arg (sys.executable), tsetup,
-                      *[zc.buildout.easy_install._safe_arg(a)
-                        for a in args])
+            if is_jython:
+                arg_list = list()
+                
+                for a in args:
+                    add_args.append(zc.buildout.easy_install._safe_arg(a))
+                
+                subprocess.Popen([zc.buildout.easy_install._safe_arg(sys.executable)] + list(tsetup) +
+                                arg_list).wait()
+            
+            else:
+                os.spawnl(os.P_WAIT, sys.executable, zc.buildout.easy_install._safe_arg (sys.executable), tsetup,
+                        *[zc.buildout.easy_install._safe_arg(a)
+                            for a in args])
         finally:
             os.close(fd)
             os.remove(tsetup)



More information about the Checkins mailing list