Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ecdf54d

Browse files
committed
Some basic changes that allow setup.py to work with both Python 2 and 3.
svn path=/trunk/matplotlib/; revision=8537
1 parent 852b41c commit ecdf54d

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

setup.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676

7777
ext_modules = []
7878

79-
for line in file('lib/matplotlib/__init__.py').readlines():
79+
for line in open('lib/matplotlib/__init__.py').readlines():
8080
if (line.startswith('__version__')):
8181
exec(line.strip())
8282

@@ -235,7 +235,7 @@ def add_dateutil():
235235
# only add them if we need them
236236
if provide_pytz:
237237
add_pytz()
238-
print 'adding pytz'
238+
print_raw("adding pytz")
239239
if provide_dateutil: add_dateutil()
240240

241241
print_raw("")
@@ -251,14 +251,14 @@ def add_dateutil():
251251

252252
# Write the default matplotlibrc file
253253
if options['backend']: rc['backend'] = options['backend']
254-
template = file('matplotlibrc.template').read()
255-
file('lib/matplotlib/mpl-data/matplotlibrc', 'w').write(template%rc)
254+
template = open('matplotlibrc.template').read()
255+
open('lib/matplotlib/mpl-data/matplotlibrc', 'w').write(template%rc)
256256

257257
# Write the default matplotlib.conf file
258-
template = file('lib/matplotlib/mpl-data/matplotlib.conf.template').read()
258+
template = open('lib/matplotlib/mpl-data/matplotlib.conf.template').read()
259259
template = template.replace("datapath = ", "#datapath = ")
260260
template = template.replace(" use = 'Agg'", " use = '%s'"%rc['backend'])
261-
file('lib/matplotlib/mpl-data/matplotlib.conf', 'w').write(template)
261+
open('lib/matplotlib/mpl-data/matplotlib.conf', 'w').write(template)
262262

263263
try: additional_params # has setupegg.py provided
264264
except NameError: additional_params = {}
@@ -267,8 +267,8 @@ def add_dateutil():
267267
if options['verbose']:
268268
mod.extra_compile_args.append('-DVERBOSE')
269269

270-
print 'pymods', py_modules
271-
print 'packages', packages
270+
print_raw("pymods %s" % py_modules)
271+
print_raw("packages %s" % packages)
272272
distrib = setup(name="matplotlib",
273273
version= __version__,
274274
description = "Python plotting package",

0 commit comments

Comments
 (0)