[Lxml-checkins] r47375 - lxml/trunk

scoder at codespeak.net scoder at codespeak.net
Wed Oct 10 11:22:38 CEST 2007


Author: scoder
Date: Wed Oct 10 11:22:37 2007
New Revision: 47375

Modified:
   lxml/trunk/setup.py
   lxml/trunk/setupinfo.py
   lxml/trunk/versioninfo.py
Log:
Py3 syntax fixes in build scripts

Modified: lxml/trunk/setup.py
==============================================================================
--- lxml/trunk/setup.py	(original)
+++ lxml/trunk/setup.py	Wed Oct 10 11:22:37 2007
@@ -38,7 +38,7 @@
 # create lxml-version.h file
 svn_version = versioninfo.svn_version()
 versioninfo.create_version_h(svn_version)
-print "Building lxml version", svn_version
+print("Building lxml version %s." % svn_version)
 
 
 branch_link = """

Modified: lxml/trunk/setupinfo.py
==============================================================================
--- lxml/trunk/setupinfo.py	(original)
+++ lxml/trunk/setupinfo.py	Wed Oct 10 11:22:37 2007
@@ -3,7 +3,7 @@
 
 try:
     from Cython.Distutils import build_ext as build_pyx
-    print "Building with Cython."
+    print("Building with Cython.")
     CYTHON_INSTALLED = True
 except ImportError:
     CYTHON_INSTALLED = False
@@ -131,13 +131,21 @@
     return macros
     
 def flags(cmd):
-    wf, rf, ef = os.popen3(cmd)
+    try:
+        import subprocess
+    except ImportError:
+        # Python 2.3
+        _, rf, ef = os.popen3(cmd)
+    else:
+        # Python 2.4+
+        p = subprocess.Popen(cmd, shell=True, close_fds=True,
+                             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        rf, ef = p.stdout, p.stderr
     errors = ef.read()
     if errors:
-        print "ERROR:", errors
-        print "** make sure the development packages of libxml2 and libxslt are installed **"
-        print
-    return rf.read().split()
+        print("ERROR: %s" % errors)
+        print("** make sure the development packages of libxml2 and libxslt are installed **\n")
+    return str(rf.read()).split()
 
 def has_option(name):
     try:

Modified: lxml/trunk/versioninfo.py
==============================================================================
--- lxml/trunk/versioninfo.py	(original)
+++ lxml/trunk/versioninfo.py	Wed Oct 10 11:22:37 2007
@@ -35,7 +35,7 @@
 
         if data.startswith('8'):
             # SVN >= 1.4
-            data = map(str.splitlines, data.split('\n\x0c\n'))
+            data = [ d.splitlines() for d in data.split('\n\x0c\n') ]
             del data[0][0] # get rid of the '8'
             dirurl = data[0][3]
             try:


More information about the lxml-checkins mailing list