Rev 5314: (lifeless) Make setup.py python 3.1 compatible. (Robert Collins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Jun 22 07:52:45 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5314 [merge]
revision-id: pqm at pqm.ubuntu.com-20100622065243-mhmcsqhkkoi2uzcz
parent: pqm at pqm.ubuntu.com-20100622053452-y9i382ep257ab8f7
parent: robertc at robertcollins.net-20100622041525-3nigypxfyvm4x31e
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-06-22 07:52:43 +0100
message:
(lifeless) Make setup.py python 3.1 compatible. (Robert Collins)
modified:
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
=== modified file 'setup.py'
--- a/setup.py 2010-05-27 02:00:27 +0000
+++ b/setup.py 2010-06-22 04:15:25 +0000
@@ -125,9 +125,10 @@
f = file(batch_path, "w")
f.write(batch_str)
f.close()
- print "Created:", batch_path
- except Exception, e:
- print "ERROR: Unable to create %s: %s" % (batch_path, e)
+ print("Created: %s" % batch_path)
+ except Exception:
+ e = sys.exc_info()[1]
+ print("ERROR: Unable to create %s: %s" % (batch_path, e))
def _quoted_path(self, path):
if ' ' in path:
@@ -171,18 +172,18 @@
from Pyrex.Distutils import build_ext
from Pyrex.Compiler.Version import version as pyrex_version
except ImportError:
- print "No Pyrex, trying Cython..."
+ print("No Pyrex, trying Cython...")
from Cython.Distutils import build_ext
from Cython.Compiler.Version import version as pyrex_version
except ImportError:
have_pyrex = False
# try to build the extension from the prior generated source.
- print
- print ("The python package 'Pyrex' is not available."
- " If the .c files are available,")
- print ("they will be built,"
- " but modifying the .pyx files will not rebuild them.")
- print
+ print("")
+ print("The python package 'Pyrex' is not available."
+ " If the .c files are available,")
+ print("they will be built,"
+ " but modifying the .pyx files will not rebuild them.")
+ print("")
from distutils.command.build_ext import build_ext
else:
have_pyrex = True
@@ -204,7 +205,8 @@
def run(self):
try:
build_ext.run(self)
- except DistutilsPlatformError, e:
+ except DistutilsPlatformError:
+ e = sys.exc_info()[1]
if not self.allow_python_fallback:
log.warn('\n Cannot build extensions.\n'
' Use "build_ext --allow-python-fallback" to use'
@@ -289,11 +291,11 @@
# which is NULL safe with PY_DECREF which is not.)
# <https://bugs.edge.launchpad.net/bzr/+bug/449372>
# <https://bugs.edge.launchpad.net/bzr/+bug/276868>
- print 'Cannot build extension "bzrlib._dirstate_helpers_pyx" using'
- print 'your version of pyrex "%s". Please upgrade your pyrex' % (
- pyrex_version,)
- print 'install. For now, the non-compiled (python) version will'
- print 'be used instead.'
+ print('Cannot build extension "bzrlib._dirstate_helpers_pyx" using')
+ print('your version of pyrex "%s". Please upgrade your pyrex' % (
+ pyrex_version,))
+ print('install. For now, the non-compiled (python) version will')
+ print('be used instead.')
else:
add_pyrex_extension('bzrlib._dirstate_helpers_pyx')
add_pyrex_extension('bzrlib._readdir_pyx')
@@ -301,12 +303,12 @@
ext_modules.append(Extension('bzrlib._patiencediff_c',
['bzrlib/_patiencediff_c.c']))
if have_pyrex and pyrex_version_info < (0, 9, 6, 3):
- print
- print 'Your Pyrex/Cython version %s is too old to build the simple_set' % (
- pyrex_version)
- print 'and static_tuple extensions.'
- print 'Please upgrade to at least Pyrex 0.9.6.3'
- print
+ print("")
+ print('Your Pyrex/Cython version %s is too old to build the simple_set' % (
+ pyrex_version))
+ print('and static_tuple extensions.')
+ print('Please upgrade to at least Pyrex 0.9.6.3')
+ print("")
# TODO: Should this be a fatal error?
else:
# We only need 0.9.6.3 to build _simple_set_pyx, but static_tuple depends
@@ -318,10 +320,10 @@
if unavailable_files:
- print 'C extension(s) not found:'
- print ' %s' % ('\n '.join(unavailable_files),)
- print 'The python versions will be used instead.'
- print
+ print('C extension(s) not found:')
+ print(' %s' % ('\n '.join(unavailable_files),))
+ print('The python versions will be used instead.')
+ print("")
def get_tbzr_py2exe_info(includes, excludes, packages, console_targets,
@@ -677,8 +679,8 @@
# print this warning to stderr as output is redirected, so it is seen
# at build time. Also to stdout so it appears in the log
for f in (sys.stderr, sys.stdout):
- print >> f, \
- "Skipping TBZR binaries - please set TBZR to a directory to enable"
+ f.write("Skipping TBZR binaries - "
+ "please set TBZR to a directory to enable\n")
# MSWSOCK.dll is a system-specific library, which py2exe accidentally pulls
# in on Vista.
@@ -691,14 +693,14 @@
"optimize": 2,
},
}
-
- setup(options=options_list,
- console=console_targets,
- windows=gui_targets,
- zipfile='lib/library.zip',
- data_files=data_files,
- cmdclass={'install_data': install_data_with_bytecompile},
- )
+ if __name__ == '__main__':
+ setup(options=options_list,
+ console=console_targets,
+ windows=gui_targets,
+ zipfile='lib/library.zip',
+ data_files=data_files,
+ cmdclass={'install_data': install_data_with_bytecompile},
+ )
else:
# ad-hoc for easy_install
@@ -732,4 +734,5 @@
ARGS.update(BZRLIB)
ARGS.update(PKG_DATA)
- setup(**ARGS)
+ if __name__ == '__main__':
+ setup(**ARGS)
More information about the bazaar-commits
mailing list