[Checkins] SVN: zc.buildout/branches/regebro-python3/ You can run dev.py with Python 3 now.
Lennart Regebro
regebro at gmail.com
Sun Nov 21 09:36:47 EST 2010
Log message for revision 118515:
You can run dev.py with Python 3 now.
Changed:
U zc.buildout/branches/regebro-python3/bootstrap/bootstrap.py
U zc.buildout/branches/regebro-python3/dev.py
U zc.buildout/branches/regebro-python3/src/zc/buildout/allowhosts.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/bootstrap.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/buildout.py
U zc.buildout/branches/regebro-python3/src/zc/buildout/buildout.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/debugging.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/dependencylinks.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/download.py
U zc.buildout/branches/regebro-python3/src/zc/buildout/download.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/downloadcache.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/easy_install.py
U zc.buildout/branches/regebro-python3/src/zc/buildout/easy_install.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/extends-cache.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/repeatable.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/rmtree.py
U zc.buildout/branches/regebro-python3/src/zc/buildout/runsetup.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/setup.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/testing.py
U zc.buildout/branches/regebro-python3/src/zc/buildout/testrecipes.py
U zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py
U zc.buildout/branches/regebro-python3/src/zc/buildout/update.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/virtualenv.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/windows.txt
U zc.buildout/branches/regebro-python3/test_all_pythons.cfg
U zc.buildout/branches/regebro-python3/z3c.recipe.scripts_/src/z3c/recipe/scripts/scripts.py
U zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/custom.py
U zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/egg.py
U zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt
-=-
Modified: zc.buildout/branches/regebro-python3/bootstrap/bootstrap.py
===================================================================
--- zc.buildout/branches/regebro-python3/bootstrap/bootstrap.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/bootstrap/bootstrap.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -18,7 +18,7 @@
use the -c option to specify an alternate configuration file.
"""
-import os, shutil, sys, tempfile, textwrap, urllib, urllib2, subprocess
+import os, shutil, sys, tempfile, textwrap, urllib, urllib.request, urllib.error, urllib.parse, subprocess
from optparse import OptionParser
if sys.platform == 'win32':
@@ -50,7 +50,7 @@
# We will restart with python -S.
args = sys.argv[:]
args[0:0] = [sys.executable, '-S']
- args = map(quote, args)
+ args = list(map(quote, args))
os.execv(sys.executable, args)
# Now we are running with -S. We'll get the clean sys.path, import site
# because distutils will do it later, and then reset the path and clean
@@ -59,7 +59,7 @@
clean_path = sys.path[:]
import site
sys.path[:] = clean_path
-for k, v in sys.modules.items():
+for k, v in list(sys.modules.items()):
if k in ('setuptools', 'pkg_resources') or (
hasattr(v, '__path__') and
len(v.__path__)==1 and
@@ -77,7 +77,7 @@
if value:
if '://' not in value: # It doesn't smell like a URL.
value = 'file://%s' % (
- urllib.pathname2url(
+ urllib.request.pathname2url(
os.path.abspath(os.path.expanduser(value))),)
if opt_str == '--download-base' and not value.endswith('/'):
# Download base needs a trailing slash to make the world happy.
@@ -160,10 +160,10 @@
if not hasattr(pkg_resources, '_distribute'):
raise ImportError
except ImportError:
- ez_code = urllib2.urlopen(
+ ez_code = urllib.request.urlopen(
options.setup_source).read().replace('\r\n', '\n')
ez = {}
- exec ez_code in ez
+ exec(ez_code, ez)
setup_args = dict(to_dir=eggs_dir, download_delay=0)
if options.download_base:
setup_args['download_base'] = options.download_base
Modified: zc.buildout/branches/regebro-python3/dev.py
===================================================================
--- zc.buildout/branches/regebro-python3/dev.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/dev.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -19,7 +19,7 @@
$Id$
"""
-import os, shutil, sys, subprocess, urllib2, subprocess
+import os, shutil, sys, subprocess, urllib.request, urllib.error, urllib.parse, subprocess
from optparse import OptionParser
if sys.platform == 'win32':
@@ -33,7 +33,7 @@
# Detect https://bugs.launchpad.net/virtualenv/+bug/572545 .
has_broken_dash_S = subprocess.call(
- [sys.executable, '-Sc', 'import ConfigParser'])
+ [sys.executable, '-Sc', 'import pprint'])
# In order to be more robust in the face of system Pythons, we want to
# run without site-packages loaded. This is somewhat tricky, in
@@ -43,7 +43,7 @@
# We will restart with python -S.
args = sys.argv[:]
args[0:0] = [sys.executable, '-S']
- args = map(quote, args)
+ args = list(map(quote, args))
os.execv(sys.executable, args)
# Now we are running with -S. We'll get the clean sys.path, import site
# because distutils will do it later, and then reset the path and clean
@@ -52,7 +52,7 @@
clean_path = sys.path[:]
import site
sys.path[:] = clean_path
-for k, v in sys.modules.items():
+for k, v in list(sys.modules.items()):
if (hasattr(v, '__path__') and
len(v.__path__)==1 and
not os.path.exists(os.path.join(v.__path__[0],'__init__.py'))):
@@ -83,7 +83,7 @@
if args:
parser.error('This script accepts no arguments other than its options.')
-if options.use_distribute:
+if options.use_distribute or sys.version > '3':
setup_source = distribute_source
else:
setup_source = setuptools_source
@@ -102,9 +102,9 @@
raise ImportError
import setuptools # A flag. Sometimes pkg_resources is installed alone.
except ImportError:
- ez_code = urllib2.urlopen(setup_source).read().replace('\r\n', '\n')
+ ez_code = urllib.request.urlopen(setup_source).read().replace(b'\r\n', b'\n')
ez = {}
- exec ez_code in ez
+ exec(ez_code, ez)
setup_args = dict(to_dir='eggs', download_delay=0)
if options.use_distribute:
setup_args['no_fake'] = True
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/allowhosts.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/allowhosts.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/allowhosts.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -55,7 +55,7 @@
Now we can run the buildout and make sure all attempts to dist.plone.org fails::
- >>> print system(buildout) # doctest: +ELLIPSIS
+ >>> print(system(buildout)) # doctest: +ELLIPSIS
Develop: '/sample-buildout/allowdemo'
...
Link to http://dist.plone.org ***BLOCKED*** by --allow-hosts
@@ -88,7 +88,7 @@
Now we can run the buildout and make sure all attempts to dist.plone.org fails::
- >>> print system(buildout) # doctest: +ELLIPSIS
+ >>> print(system(buildout)) # doctest: +ELLIPSIS
Develop: '/sample-buildout/allowdemo'
...
Link to http://dist.plone.org ***BLOCKED*** by --allow-hosts
@@ -115,7 +115,7 @@
... eggs=zc.buildout
... interpreter=python
... ''')
- >>> print system(buildout)
+ >>> print(system(buildout))
Unused options for buildout: 'foo'.
Installing python.
Generated script '/sample-buildout/bin/buildout'.
@@ -126,3 +126,4 @@
This was fixed in this changeset:
http://svn.zope.org/zc.buildout/trunk/src/zc/buildout/buildout.py?rev=87309&r1=87277&r2=87309
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/bootstrap.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/bootstrap.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/bootstrap.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -20,9 +20,9 @@
... parts =
... ''')
>>> write('bootstrap.py', open(bootstrap_py).read())
- >>> print 'X'; print system(
+ >>> print('X'); print(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
- ... 'bootstrap.py'); print 'X' # doctest: +ELLIPSIS
+ ... 'bootstrap.py')); print('X') # doctest: +ELLIPSIS
X...
Creating directory '/sample/bin'.
Creating directory '/sample/parts'.
@@ -43,7 +43,7 @@
>>> ls(sample_buildout, 'bin')
- buildout
- >>> print 'X'; ls(sample_buildout, 'eggs') # doctest: +ELLIPSIS
+ >>> print('X'); ls(sample_buildout, 'eggs') # doctest: +ELLIPSIS
X...
d zc.buildout-...egg
@@ -53,7 +53,7 @@
>>> buildout_script = join(sample_buildout, 'bin', 'buildout')
>>> if sys.platform.startswith('win'):
... buildout_script += '-script.py'
- >>> print open(buildout_script).read() # doctest: +ELLIPSIS
+ >>> print(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
<BLANKLINE>
import sys
@@ -82,7 +82,7 @@
>>> buildout_site_py = join(
... sample_buildout, 'parts', 'buildout', 'site.py')
- >>> print open(buildout_site_py).read() # doctest: +ELLIPSIS
+ >>> print(open(buildout_site_py).read()) # doctest: +ELLIPSIS
"...
buildout_paths = [
'/sample/eggs/setuptools-...egg',
@@ -102,7 +102,7 @@
>>> ignored = system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py --accept-buildout-test-releases')
- >>> print open(buildout_site_py).read() # doctest: +ELLIPSIS
+ >>> print(open(buildout_site_py).read()) # doctest: +ELLIPSIS
"...
buildout_paths = [
'/sample/eggs/setuptools-...egg',
@@ -115,7 +115,7 @@
The buildout script remembers the decision to accept early releases, and
alerts the user.
- >>> print system(join('bin', 'buildout')),
+ >>> print(system(join('bin', 'buildout')), end=' ')
... # doctest: +NORMALIZE_WHITESPACE
NOTE: Accepting early releases of build system packages. Rerun bootstrap
without --accept-buildout-test-releases (-t) to return to default
@@ -123,7 +123,7 @@
This is accomplished within the script itself.
- >>> print open(buildout_script).read() # doctest: +ELLIPSIS
+ >>> print(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
sys.argv.insert(1, 'buildout:accept-buildout-test-releases=true')
print ('NOTE: Accepting early releases of build system packages. Rerun '
@@ -137,7 +137,7 @@
>>> ignored = system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py')
- >>> print open(buildout_site_py).read() # doctest: +ELLIPSIS
+ >>> print(open(buildout_site_py).read()) # doctest: +ELLIPSIS
"...
buildout_paths = [
'/sample/eggs/setuptools-...egg',
@@ -153,20 +153,20 @@
Let's try with an unknown version::
- >>> print 'XX'; print system(
+ >>> print('XX'); print(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
- ... 'bootstrap.py --version UNKNOWN'); print 'X' # doctest: +ELLIPSIS
- ...
+ ... 'bootstrap.py --version UNKNOWN')); print('X') # doctest: +ELLIPSIS
+ ...
X...
No local packages or download links found for zc.buildout==UNKNOWN...
...
Now let's try with `1.1.2`, which happens to exist::
- >>> print 'X'; print system(
+ >>> print('X'); print(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
- ... 'bootstrap.py --version 1.1.2'); print 'X'
- ...
+ ... 'bootstrap.py --version 1.1.2')); print('X')
+ ...
X
Generated script '/sample/bin/buildout'.
<BLANKLINE>
@@ -175,7 +175,7 @@
Versions older than 1.5.0 put their egg dependencies in the ``buildout`` script.
Let's make sure it was generated as we expect::
- >>> print open(buildout_script).read() # doctest: +ELLIPSIS
+ >>> print(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
<BLANKLINE>
import sys
@@ -192,10 +192,10 @@
Let's try with `1.2.1`::
- >>> print 'X'; print system(
+ >>> print('X'); print(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
- ... 'bootstrap.py --version 1.2.1'); print 'X' # doctest: +ELLIPSIS
- ...
+ ... 'bootstrap.py --version 1.2.1')); print('X') # doctest: +ELLIPSIS
+ ...
X
Generated script '/sample/bin/buildout'.
<BLANKLINE>
@@ -203,7 +203,7 @@
Let's make sure the generated ``buildout`` script uses it::
- >>> print open(buildout_script).read() # doctest: +ELLIPSIS
+ >>> print(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
<BLANKLINE>
import sys
@@ -221,17 +221,17 @@
``zc.buildout`` now can also run with `Distribute` with the `--distribute`
option::
- >>> print 'X'; print system(
+ >>> print('X'); print(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
- ... 'bootstrap.py --distribute'); print 'X' # doctest: +ELLIPSIS
- ...
+ ... 'bootstrap.py --distribute')); print('X') # doctest: +ELLIPSIS
+ ...
X
...
Generated script '/sample/bin/buildout'...
X
Let's make sure the generated ``site.py`` uses it::
- >>> print open(buildout_site_py).read() # doctest: +ELLIPSIS
+ >>> print(open(buildout_site_py).read()) # doctest: +ELLIPSIS
"...
buildout_paths = [
'/sample/eggs/distribute-...egg',
@@ -241,11 +241,11 @@
Make sure both options can be used together::
- >>> print 'X'; print system(
+ >>> print('X'); print(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
- ... 'bootstrap.py --distribute --version 1.2.1'); print 'X'
+ ... 'bootstrap.py --distribute --version 1.2.1')); print('X')
... # doctest: +ELLIPSIS
- ...
+ ...
X
...
Generated script '/sample/bin/buildout'...
@@ -254,7 +254,7 @@
Let's make sure the old-style generated ``buildout`` script uses
``Distribute`` *and* ``zc.buildout-1.2.1``::
- >>> print open(buildout_script).read() # doctest: +ELLIPSIS
+ >>> print(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
<BLANKLINE>
import sys
@@ -275,10 +275,10 @@
>>> f = open(conf_file, 'w')
>>> f.write('[buildout]\nparts=\n\n')
>>> f.close()
- >>> print 'X'; print system(
+ >>> print('X'); print(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
- ... 'bootstrap.py -c %s --distribute' % conf_file); print 'X' # doctest: +ELLIPSIS
- ...
+ ... 'bootstrap.py -c %s --distribute' % conf_file)); print('X') # doctest: +ELLIPSIS
+ ...
X
...
Generated script '/sample/bin/buildout'...
@@ -294,9 +294,9 @@
... pprint.pprint(kwargs, width=40)
... sys.exit()
... ''')
- >>> print system(
+ >>> print(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
- ... 'bootstrap.py --setup-source=./ez_setup.py')
+ ... 'bootstrap.py --setup-source=./ez_setup.py'))
... # doctest: +ELLIPSIS
{'download_delay': 0,
'to_dir': '...'}
@@ -305,10 +305,10 @@
You can also pass a download-cache, and a place in which eggs should be stored
(they are normally stored in a temporary directory).
- >>> print system(
+ >>> print(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py --setup-source=./ez_setup.py '+
- ... '--download-base=./download-cache --eggs=eggs')
+ ... '--download-base=./download-cache --eggs=eggs'))
... # doctest: +ELLIPSIS
{'download_base': '/sample/download-cache/',
'download_delay': 0,
@@ -317,9 +317,9 @@
Here's the entire help text.
- >>> print system(
+ >>> print(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
- ... 'bootstrap.py --help'),
+ ... 'bootstrap.py --help'), end=' ')
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Usage: [DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
<BLANKLINE>
@@ -358,3 +358,4 @@
or betas.
-c CONFIG_FILE Specify the path to the buildout configuration file to
be used.
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/buildout.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/buildout.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -14,14 +14,15 @@
"""Buildout main script
"""
-from rmtree import rmtree
+from .rmtree import rmtree
try:
from hashlib import md5
except ImportError:
# Python 2.4 and older
from md5 import md5
-
-import ConfigParser
+
+import base64
+import configparser
import copy
import distutils.errors
import glob
@@ -33,7 +34,10 @@
import shutil
import sys
import tempfile
-import UserDict
+try:
+ from collections import MutableMapping
+except ImportError:
+ from UserDict import DictMixin as MutableMapping
import warnings
import zc.buildout
import zc.buildout.download
@@ -78,20 +82,20 @@
return data
def _print_annotate(data):
- sections = data.keys()
+ sections = list(data.keys())
sections.sort()
- print
- print "Annotated sections"
- print "="*len("Annotated sections")
+ print()
+ print("Annotated sections")
+ print("="*len("Annotated sections"))
for section in sections:
- print
- print '[%s]' % section
- keys = data[section].keys()
+ print()
+ print('[%s]' % section)
+ keys = list(data[section].keys())
keys.sort()
for key in keys:
value, notes = data[section][key]
keyvalue = "%s= %s" % (key, value)
- print keyvalue
+ print(keyvalue)
line = ' '
for note in notes.split():
if note == '[+]':
@@ -99,9 +103,9 @@
elif note == '[-]':
line = '-= '
else:
- print line, note
+ print(line, note)
line = ' '
- print
+ print()
def _unannotate_section(section):
@@ -143,7 +147,7 @@
}, 'DEFAULT_VALUE')
-class Buildout(UserDict.DictMixin):
+class Buildout(MutableMapping):
def __init__(self, config_file, cloptions,
user_defaults=True, windows_restart=False, command=None):
@@ -161,7 +165,7 @@
base = os.path.dirname(config_file)
if not os.path.exists(config_file):
if command == 'init':
- print 'Creating %r.' % config_file
+ print('Creating %r.' % config_file)
open(config_file, 'w').write('[buildout]\nparts = \n')
elif command == 'setup':
# Sigh. This model of a buildout instance
@@ -472,11 +476,11 @@
if self._log_level < logging.DEBUG:
sections = list(self)
sections.sort()
- print
- print 'Configuration data:'
+ print()
+ print('Configuration data:')
for section in self._data:
_save_options(section, self[section], sys.stdout)
- print
+ print()
# compute new part recipe signatures
@@ -623,7 +627,7 @@
installed = self['buildout']['installed']
f = open(installed, 'a')
f.write('\n[buildout]\n')
- for option, value in buildout_options.items():
+ for option, value in list(buildout_options.items()):
_save_option(option, value, f)
f.close()
@@ -639,7 +643,7 @@
recipe, 'zc.buildout.uninstall', entry, self)
self._logger.info('Running uninstall recipe.')
uninstaller(part, installed_part_options[part])
- except (ImportError, pkg_resources.DistributionNotFound), v:
+ except (ImportError, pkg_resources.DistributionNotFound) as v:
pass
# remove created files and directories
@@ -729,7 +733,7 @@
def _read_installed_part_options(self):
old = self['buildout']['installed']
if old and os.path.isfile(old):
- parser = ConfigParser.RawConfigParser()
+ parser = configparser.RawConfigParser()
parser.optionxform = lambda s: s
parser.read(old)
result = {}
@@ -779,7 +783,7 @@
installed = recipe_class(self, part, options).install()
if installed is None:
installed = []
- elif isinstance(installed, basestring):
+ elif isinstance(installed, str):
installed = [installed]
base = self._buildout_path('')
installed = [d.startswith(base) and d[len(base):] or d
@@ -794,7 +798,7 @@
f = open(installed, 'w')
_save_options('buildout', installed_options['buildout'], f)
for part in installed_options['buildout']['parts'].split():
- print >>f
+ print(file=f)
_save_options(part, installed_options[part], f)
f.close()
@@ -891,7 +895,7 @@
return
if sys.platform == 'win32' and not self.__windows_restart:
- args = map(zc.buildout.easy_install._safe_arg, sys.argv)
+ args = list(map(zc.buildout.easy_install._safe_arg, sys.argv))
args.insert(1, '-W')
if not __debug__:
args.insert(0, '-O')
@@ -941,7 +945,7 @@
)
# Restart
- args = map(zc.buildout.easy_install._safe_arg, sys.argv)
+ args = list(map(zc.buildout.easy_install._safe_arg, sys.argv))
if not __debug__:
args.insert(0, '-O')
args.insert(0, zc.buildout.easy_install._safe_arg(sys.executable))
@@ -1063,11 +1067,13 @@
raise NotImplementedError('__delitem__')
def keys(self):
- return self._raw.keys()
+ return list(self._raw.keys())
def __iter__(self):
return iter(self._raw)
+ def __len__(self):
+ return len(self._raw)
def _install_and_load(spec, group, entry, buildout):
__doing__ = 'Loading recipe %r.', spec
@@ -1100,7 +1106,7 @@
return pkg_resources.load_entry_point(
req.project_name, group, entry)
- except Exception, v:
+ except Exception as v:
buildout._logger.log(
1,
"Could't load %s entry point %s\nfrom %s:\n%s.",
@@ -1108,7 +1114,7 @@
raise
-class Options(UserDict.DictMixin):
+class Options(MutableMapping):
def __init__(self, buildout, section, data):
self.buildout = buildout
@@ -1125,7 +1131,7 @@
self._raw = self._do_extend_raw(name, self._raw, [])
# force substitutions
- for k, v in self._raw.items():
+ for k, v in list(self._raw.items()):
if '${' in v:
self._dosub(k, v)
@@ -1276,8 +1282,14 @@
elif key in self._data:
del self._data[key]
else:
- raise KeyError, key
+ raise KeyError(key)
+
+ def __len__(self):
+ return len(self._raw)
+ def __iter__(self):
+ return iter(self._raw)
+
def keys(self):
raw = self._raw
return list(self._raw) + [k for k in self._data if k not in raw]
@@ -1378,11 +1390,11 @@
value = '%(__buildout_space_n__)s' + value[2:]
if value.endswith('\n\t'):
value = value[:-2] + '%(__buildout_space_n__)s'
- print >>f, option, '=', value
+ print(option, '=', value, file=f)
def _save_options(section, options, f):
- print >>f, '[%s]' % section
- items = options.items()
+ print('[%s]' % section, file=f)
+ items = list(options.items())
items.sort()
for option, value in items:
_save_option(option, value, f)
@@ -1427,7 +1439,7 @@
result = {}
- parser = ConfigParser.RawConfigParser()
+ parser = configparser.RawConfigParser()
parser.optionxform = lambda s: s
parser.readfp(fp)
if is_temp:
@@ -1475,11 +1487,11 @@
if (not (f.endswith('pyc') or f.endswith('pyo'))
and os.path.exists(os.path.join(dirpath, f)))
]
- hash.update(' '.join(dirnames))
- hash.update(' '.join(filenames))
+ hash.update((' '.join(dirnames)).encode())
+ hash.update((' '.join(filenames)).encode())
for name in filenames:
- hash.update(open(os.path.join(dirpath, name)).read())
- return hash.digest().encode('base64').strip()
+ hash.update(open(os.path.join(dirpath, name)).read().encode())
+ return base64.b64encode(hash.digest()).strip().decode()
def _dists_sig(dists):
result = []
@@ -1493,7 +1505,7 @@
def _update_section(s1, s2):
s2 = s2.copy() # avoid mutating the second argument, which is unexpected
- for k, v in s2.items():
+ for k, v in list(s2.items()):
v2, note2 = v
if k.endswith('+'):
key = k.rstrip(' +')
@@ -1692,7 +1704,7 @@
"""
def _help():
- print _usage
+ print(_usage)
sys.exit(0)
def main(args=None):
@@ -1756,7 +1768,7 @@
_error("No timeout value must be numeric", orig_op)
import socket
- print 'Setting socket time out to %d seconds' % timeout
+ print('Setting socket time out to %d seconds' % timeout)
socket.setdefaulttimeout(timeout)
elif op:
@@ -1805,7 +1817,7 @@
getattr(buildout, command)(args)
except SystemExit:
pass
- except Exception, v:
+ except Exception as v:
_doing()
exc_info = sys.exc_info()
import pdb, traceback
@@ -1815,7 +1827,7 @@
pdb.post_mortem(exc_info[2])
else:
if isinstance(v, (zc.buildout.UserError,
- distutils.errors.DistutilsError,
+ distutils.errors.DistutilsError
)
):
_error(str(v))
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/buildout.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/buildout.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/buildout.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -289,7 +289,7 @@
>>> import os
>>> os.chdir(sample_buildout)
>>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Installing data-dir.
data-dir: Creating directory mystuff
@@ -338,7 +338,7 @@
... path = mydata
... """)
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Installing data-dir.
@@ -358,7 +358,7 @@
the part will be reinstalled:
>>> rmdir(sample_buildout, 'mydata')
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Installing data-dir.
@@ -389,7 +389,7 @@
We'll get a user error, not a traceback.
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
data-dir: Cannot create /xxx/mydata. /xxx is not a directory.
While:
@@ -454,7 +454,7 @@
... path = foo bin
... """)
- >>> print system(buildout), # doctest: +ELLIPSIS
+ >>> print(system(buildout), end=' ') # doctest: +ELLIPSIS
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Installing data-dir.
@@ -488,7 +488,7 @@
... path = foo bins
... """)
- >>> print system(buildout), # doctest: +ELLIPSIS
+ >>> print(system(buildout), end=' ') # doctest: +ELLIPSIS
Develop: '/sample-buildout/recipes'
Installing data-dir.
data-dir: Creating directory foo
@@ -564,7 +564,7 @@
When we rerun the buildout:
- >>> print system(buildout), # doctest: +ELLIPSIS
+ >>> print(system(buildout), end=' ') # doctest: +ELLIPSIS
Develop: '/sample-buildout/recipes'
Installing data-dir.
data-dir: Creating directory foo
@@ -645,7 +645,7 @@
If we rerun the buildout, again, we'll get the error and no
directories will be created:
- >>> print system(buildout), # doctest: +ELLIPSIS
+ >>> print(system(buildout), end=' ') # doctest: +ELLIPSIS
Develop: '/sample-buildout/recipes'
Installing data-dir.
data-dir: Creating directory foo
@@ -675,7 +675,7 @@
... path = foo bins
... """)
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Installing data-dir.
data-dir: Creating directory foo
@@ -722,7 +722,7 @@
the origin of the value (file name or COMPUTED_VALUE, DEFAULT_VALUE,
COMMAND_LINE_VALUE).
- >>> print system(buildout+ ' annotate'),
+ >>> print(system(buildout+ ' annotate'), end=' ')
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
<BLANKLINE>
Annotated sections
@@ -867,7 +867,7 @@
Now, if we run the buildout, we'll see the options with the values
substituted.
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Installing data-dir.
@@ -886,7 +886,7 @@
recipe, so it assumed it could and reinstalled mydata. If we rerun
the buildout:
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Updating data-dir.
Updating debug.
@@ -925,7 +925,7 @@
... path = mydata
... """)
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Updating data-dir.
@@ -963,7 +963,7 @@
It will still be treated as a part:
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Updating data-dir.
@@ -1002,7 +1002,7 @@
It will still be treated as a part:
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Updating data-dir.
Updating debug.
@@ -1051,7 +1051,7 @@
... path = mydata
... """)
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Uninstalling data-dir.
@@ -1167,7 +1167,7 @@
... """)
>>> os.chdir(sample_buildout)
- >>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
+ >>> print(system(os.path.join(sample_buildout, 'bin', 'buildout')), end=' ')
Develop: '/sample-buildout/demo'
Uninstalling myfiles.
Getting distribution for 'recipes'.
@@ -1185,14 +1185,14 @@
... extends = extension2.cfg
... """)
- >>> print system(os.path.join('bin', 'buildout')),
+ >>> print(system(os.path.join('bin', 'buildout')), end=' ')
['a1 a2/na3 a4/na5', 'b1 b2 b3 b4', 'c1 c2/nc3 c4 c5', 'h1 h2']
Develop: '/sample-buildout/demo'
Annotated sections output shows which files are responsible for which
operations.
- >>> print system(os.path.join('bin', 'buildout') + ' annotate'),
+ >>> print(system(os.path.join('bin', 'buildout') + ' annotate'), end=' ')
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
<BLANKLINE>
Annotated sections
@@ -1268,7 +1268,7 @@
... op = base
... """)
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Installing debug.
op buildout
@@ -1338,7 +1338,7 @@
... name = base
... """)
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
@@ -1400,7 +1400,7 @@
... """ % dict(url=server_url))
- >>> print system(buildout+ ' -c client.cfg'),
+ >>> print(system(buildout+ ' -c client.cfg'), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
@@ -1431,7 +1431,7 @@
... name = remote
... """)
- >>> print system(buildout + ' -c ' + server_url + '/remote.cfg'),
+ >>> print(system(buildout + ' -c ' + server_url + '/remote.cfg'), end=' ')
While:
Initializing.
Error: Missing option: buildout:directory
@@ -1441,10 +1441,10 @@
files loaded from URLs. In this case, the buildout directory would
normally be defined on the command line:
- >>> print system(buildout
+ >>> print(system(buildout
... + ' -c ' + server_url + '/remote.cfg'
... + ' buildout:directory=' + sample_buildout
- ... ),
+ ... ), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
@@ -1473,7 +1473,7 @@
... """)
>>> os.environ['HOME'] = home
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
@@ -1490,7 +1490,7 @@
A buildout command-line argument, -U, can be used to suppress reading
user defaults:
- >>> print system(buildout + ' -U'),
+ >>> print(system(buildout + ' -U'), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
@@ -1519,7 +1519,7 @@
... extends = b1.cfg b2.cfg
... """)
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
name base
op1 b1 1
op2 b2 2
@@ -1609,7 +1609,7 @@
When the buildout is run the service will be installed
- >>> print system(buildout)
+ >>> print(system(buildout))
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing service.
@@ -1619,7 +1619,7 @@
The service has been installed. If the buildout is run again with no
changes, the service shouldn't be changed.
- >>> print system(buildout)
+ >>> print(system(buildout))
Develop: '/sample-buildout/recipes'
Updating service.
<BLANKLINE>
@@ -1638,7 +1638,7 @@
... script = /path/to/a/different/script
... """)
- >>> print system(buildout)
+ >>> print(system(buildout))
Develop: '/sample-buildout/recipes'
Uninstalling service.
Running uninstall recipe.
@@ -1659,7 +1659,7 @@
... recipe = recipes:debug
... """)
- >>> print system(buildout)
+ >>> print(system(buildout))
Develop: '/sample-buildout/recipes'
Uninstalling service.
Running uninstall recipe.
@@ -1726,7 +1726,7 @@
Run the buildout to install the part.
- >>> print system(buildout)
+ >>> print(system(buildout))
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing dir.
@@ -1750,7 +1750,7 @@
When the buildout is run the part is removed, and the uninstall recipe
is run before the directory is deleted.
- >>> print system(buildout)
+ >>> print(system(buildout))
Develop: '/sample-buildout/recipes'
Uninstalling dir.
Running uninstall recipe.
@@ -1855,7 +1855,7 @@
Note that we used the installed buildout option to specify an
alternate file to store information about installed parts.
- >>> print system(buildout+' -c other.cfg debug:op1=foo -v'),
+ >>> print(system(buildout+' -c other.cfg debug:op1=foo -v'), end=' ')
Develop: '/sample-buildout/recipes'
Installing debug.
name other
@@ -1868,7 +1868,7 @@
Options can also be combined in the usual Unix way, as in:
- >>> print system(buildout+' -vcother.cfg debug:op1=foo'),
+ >>> print(system(buildout+' -vcother.cfg debug:op1=foo'), end=' ')
Develop: '/sample-buildout/recipes'
Updating debug.
name other
@@ -1909,7 +1909,7 @@
... recipe = recipes:debug
... """)
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
@@ -1993,7 +1993,7 @@
and run the buildout specifying just d3 and d4:
- >>> print system(buildout+' install d3 d4'),
+ >>> print(system(buildout+' install d3 d4'), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling d3.
Installing d3.
@@ -2064,7 +2064,7 @@
Now, if we run the buildout without the install command:
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Uninstalling d2.
Uninstalling d1.
@@ -2121,7 +2121,7 @@
... work = os.path.join(alt, 'work'),
... ))
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Creating directory '/sample-alt/scripts'.
Creating directory '/sample-alt/work'.
Creating directory '/sample-alt/basket'.
@@ -2157,7 +2157,7 @@
... recipes=os.path.join(sample_buildout, 'recipes'),
... ))
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Creating directory '/sample-alt/bin'.
Creating directory '/sample-alt/parts'.
Creating directory '/sample-alt/eggs'.
@@ -2209,7 +2209,7 @@
configuration file. Because the verbosity is subtracted from the log
level, we get a final log level of 20, which is the INFO level.
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
INFO Develop: '/sample-buildout/recipes'
Predefined buildout options
@@ -2227,7 +2227,7 @@
... parts =
... """)
- >>> print system(buildout+' -vv'), # doctest: +NORMALIZE_WHITESPACE
+ >>> print(system(buildout+' -vv'), end=' ') # doctest: +NORMALIZE_WHITESPACE
Installing 'zc.buildout', 'setuptools'.
We have a develop egg: zc.buildout X.X.
We have the best distribution that satisfies 'setuptools'.
@@ -2410,9 +2410,9 @@
>>> sample_bootstrapped = tmpdir('sample-bootstrapped')
- >>> print system(buildout
+ >>> print(system(buildout
... +' -c'+os.path.join(sample_bootstrapped, 'setup.cfg')
- ... +' init'),
+ ... +' init'), end=' ')
Creating '/sample-bootstrapped/setup.cfg'.
Creating directory '/sample-bootstrapped/bin'.
Creating directory '/sample-bootstrapped/parts'.
@@ -2451,16 +2451,16 @@
... parts =
... ''')
- >>> print system(buildout
+ >>> print(system(buildout
... +' -c'+os.path.join(sample_bootstrapped, 'setup.cfg')
- ... +' bootstrap'),
+ ... +' bootstrap'), end=' ')
Generated script '/sample-bootstrapped/bin/buildout'.
>>> buildout_script = join(sample_bootstrapped, 'bin', 'buildout')
>>> import sys
>>> if sys.platform.startswith('win'):
... buildout_script += '-script.py'
- >>> print open(buildout_script).read() # doctest: +ELLIPSIS
+ >>> print(open(buildout_script).read()) # doctest: +ELLIPSIS
#!... -S
<BLANKLINE>
import os
@@ -2500,9 +2500,9 @@
>>> sample_bootstrapped2 = tmpdir('sample-bootstrapped2')
- >>> print system(buildout
+ >>> print(system(buildout
... +' -c'+os.path.join(sample_bootstrapped2, 'setup.cfg')
- ... +' bootstrap'),
+ ... +' bootstrap'), end=' ')
While:
Initializing.
Error: Couldn't open /sample-bootstrapped2/setup.cfg
@@ -2513,9 +2513,9 @@
... parts =
... """)
- >>> print system(buildout
+ >>> print(system(buildout
... +' -c'+os.path.join(sample_bootstrapped2, 'setup.cfg')
- ... +' bootstrap'),
+ ... +' bootstrap'), end=' ')
Creating directory '/sample-bootstrapped2/bin'.
Creating directory '/sample-bootstrapped2/parts'.
Creating directory '/sample-bootstrapped2/eggs'.
@@ -2653,7 +2653,7 @@
... recipe = recipes:debug
... """)
- >>> print system(buildout+' buildout:installed=inst.cfg'),
+ >>> print(system(buildout+' buildout:installed=inst.cfg'), end=' ')
Develop: '/sample-buildout/recipes'
Installing debug.
recipe recipes:debug
@@ -2675,7 +2675,7 @@
buildout installed option:
>>> os.remove('inst.cfg')
- >>> print system(buildout+' buildout:installed='),
+ >>> print(system(buildout+' buildout:installed='), end=' ')
Develop: '/sample-buildout/recipes'
Installing debug.
recipe recipes:debug
@@ -2701,7 +2701,7 @@
... parts =
... """)
- >>> print system(buildout+' buildout:installed=inst.cfg'),
+ >>> print(system(buildout+' buildout:installed=inst.cfg'), end=' ')
>>> ls(sample_buildout)
- b1.cfg
@@ -2770,7 +2770,7 @@
... """)
>>> os.chdir(sample_bootstrapped)
- >>> print system(os.path.join(sample_bootstrapped, 'bin', 'buildout')),
+ >>> print(system(os.path.join(sample_bootstrapped, 'bin', 'buildout')), end=' ')
Develop: '/sample-bootstrapped/demo'
Now we can add the extensions option. We were a bit tricky and ran
@@ -2790,7 +2790,7 @@
We see that our extension is loaded and executed:
- >>> print system(os.path.join(sample_bootstrapped, 'bin', 'buildout')),
+ >>> print(system(os.path.join(sample_bootstrapped, 'bin', 'buildout')), end=' ')
ext ['buildout']
Develop: '/sample-bootstrapped/demo'
unload ['buildout']
@@ -2829,3 +2829,4 @@
package, we would need specify much more information. See the
`setuptools documentation
<http://peak.telecommunity.com/DevCenter/setuptools>`_.
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/debugging.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/debugging.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/debugging.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -56,7 +56,7 @@
If we run the buildout, we'll get an error:
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Develop: '/sample-buildout/recipes'
Installing data-dir.
While:
@@ -67,11 +67,11 @@
If we want to debug the error, we can add the -D option. Here's we'll
supply some input:
- >>> print system(buildout+" -D", """\
+ >>> print(system(buildout+" -D", """\
... up
... p self.options.keys()
... q
- ... """),
+ ... """), end=' ')
Develop: '/sample-buildout/recipes'
Installing data-dir.
> /zc/buildout/buildout.py(925)__getitem__()
@@ -95,3 +95,4 @@
MissingOption: Missing option: data-dir:directory
<BLANKLINE>
Starting pdb:
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/dependencylinks.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/dependencylinks.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/dependencylinks.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -54,7 +54,7 @@
Now we can run the buildout.
- >>> print system(buildout)
+ >>> print(system(buildout))
GET 200 /
GET 200 /demoneeded-1.2c1.zip
Develop: '/sample-buildout/depdemo'
@@ -83,7 +83,7 @@
... for egg in glob(join(sample_buildout, 'eggs', 'demoneeded*.egg')):
... remove(sample_buildout, 'eggs', egg)
>>> remove_demoneeded_egg()
- >>> print system(buildout) # doctest: +ELLIPSIS
+ >>> print(system(buildout)) # doctest: +ELLIPSIS
Develop: '/sample-buildout/depdemo'
...
Getting distribution for 'demoneeded'.
@@ -111,7 +111,7 @@
... eggs = depdemo
... ''' % link_server)
- >>> print system(buildout)
+ >>> print(system(buildout))
Develop: '/sample-buildout/depdemo'
Installing eggs.
Getting distribution for 'demoneeded'.
@@ -133,7 +133,7 @@
... ''' % link_server2)
>>> remove_demoneeded_egg()
- >>> print system(buildout) #doctest: +ELLIPSIS
+ >>> print(system(buildout)) #doctest: +ELLIPSIS
GET 200 /...
Develop: '/sample-buildout/depdemo'
Updating eggs.
@@ -165,7 +165,7 @@
... ''' % link_server)
>>> remove_demoneeded_egg()
- >>> print system(buildout)
+ >>> print(system(buildout))
Develop: '/sample-buildout/depdemo'
Updating eggs.
Getting distribution for 'demoneeded'.
@@ -190,10 +190,11 @@
... eggs = depdemo
... ''' % link_server)
>>> remove_demoneeded_egg()
- >>> print system(buildout) #doctest: +ELLIPSIS
+ >>> print(system(buildout)) #doctest: +ELLIPSIS
GET 200 /...
Develop: '/sample-buildout/depdemo'
Updating eggs.
Getting distribution for 'demoneeded'.
Got demoneeded 1.2c1.
<BLANKLINE>
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/download.py
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/download.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/download.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -24,13 +24,13 @@
import re
import shutil
import tempfile
-import urllib
-import urlparse
+import urllib.request, urllib.parse, urllib.error
+import urllib.parse
import zc.buildout
-class URLOpener(urllib.FancyURLopener):
- http_error_default = urllib.URLopener.http_error_default
+class URLOpener(urllib.request.FancyURLopener):
+ http_error_default = urllib.request.URLopener.http_error_default
class ChecksumError(zc.buildout.UserError):
@@ -151,7 +151,7 @@
"""
if re.match(r"^[A-Za-z]:\\", url):
url = 'file:' + url
- parsed_url = urlparse.urlparse(url, 'file')
+ parsed_url = urllib.parse.urlparse(url, 'file')
url_scheme, _, url_path = parsed_url[:3]
if url_scheme == 'file':
self.logger.debug('Using local resource %s' % url)
@@ -166,11 +166,11 @@
"Couldn't download %r in offline mode." % url)
self.logger.info('Downloading %s' % url)
- urllib._urlopener = url_opener
+ urllib.request._urlopener = url_opener
handle, tmp_path = tempfile.mkstemp(prefix='buildout-')
try:
try:
- tmp_path, headers = urllib.urlretrieve(url, tmp_path)
+ tmp_path, headers = urllib.request.urlretrieve(url, tmp_path)
if not check_md5sum(tmp_path, md5sum):
raise ChecksumError(
'MD5 checksum mismatch downloading %r' % url)
@@ -195,7 +195,7 @@
else:
if re.match(r"^[A-Za-z]:\\", url):
url = 'file:' + url
- parsed = urlparse.urlparse(url, 'file')
+ parsed = urllib.parse.urlparse(url, 'file')
url_path = parsed[2]
if parsed[0] == 'file':
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/download.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/download.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/download.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -28,7 +28,7 @@
>>> from zc.buildout.download import Download
>>> download = Download()
->>> print download.cache_dir
+>>> print(download.cache_dir)
None
Downloading a file is achieved by calling the utility with the URL as an
@@ -37,7 +37,7 @@
meant to be cleaned up during the same buildout run:
>>> path, is_temp = download(server_url+'foo.txt')
->>> print path
+>>> print(path)
/.../buildout-...
>>> cat(path)
This is a foo text.
@@ -59,8 +59,8 @@
When trying to access a file that doesn't exist, we'll get an exception:
>>> try: download(server_url+'not-there') # doctest: +ELLIPSIS
-... except: print 'download error'
-... else: print 'woops'
+... except: print('download error')
+... else: print('woops')
download error
Downloading a local file doesn't produce a temporary file but simply returns
@@ -102,7 +102,7 @@
>>> target_dir = tmpdir('download-target')
>>> path, is_temp = download(server_url+'foo.txt',
... path=join(target_dir, 'downloaded.txt'))
->>> print path
+>>> print(path)
/download-target/downloaded.txt
>>> cat(path)
This is a foo text.
@@ -136,7 +136,7 @@
>>> cache = tmpdir('download-cache')
>>> download = Download(cache=cache)
->>> print download.cache_dir
+>>> print(download.cache_dir)
/download-cache/
Simple usage
@@ -148,7 +148,7 @@
>>> ls(cache)
>>> path, is_temp = download(server_url+'foo.txt')
->>> print path
+>>> print(path)
/download-cache/foo.txt
>>> cat(path)
This is a foo text.
@@ -160,7 +160,7 @@
>>> write(server_data, 'foo.txt', 'The wrong text.')
>>> path, is_temp = download(server_url+'foo.txt')
->>> print path
+>>> print(path)
/download-cache/foo.txt
>>> cat(path)
This is a foo text.
@@ -179,7 +179,7 @@
>>> mkdir(server_data, 'other')
>>> write(server_data, 'other', 'foo.txt', 'The wrong text.')
>>> path, is_temp = download(server_url+'other/foo.txt')
->>> print path
+>>> print(path)
/download-cache/foo.txt
>>> cat(path)
This is a foo text.
@@ -194,7 +194,7 @@
>>> path, is_temp = download(server_url+'foo.txt',
... path=join(target_dir, 'downloaded.txt'))
->>> print path
+>>> print(path)
/download-target/downloaded.txt
>>> cat(path)
This is a foo text.
@@ -208,7 +208,7 @@
>>> path, is_temp = download(server_url+'foo.txt',
... path=join(target_dir, 'downloaded.txt'))
->>> print path
+>>> print(path)
/download-target/downloaded.txt
>>> cat(path)
This is a foo text.
@@ -274,7 +274,7 @@
download cache. Let's use a namespace "test" instead:
>>> download = Download(cache=cache, namespace='test')
->>> print download.cache_dir
+>>> print(download.cache_dir)
/download-cache/test
The namespace sub-directory hasn't been created yet:
@@ -285,7 +285,7 @@
of the file inside it:
>>> path, is_temp = download(server_url+'foo.txt')
->>> print path
+>>> print(path)
/download-cache/test/foo.txt
>>> ls(cache)
d test
@@ -304,7 +304,7 @@
>>> write(cache, 'foo.txt', 'The wrong text.')
>>> path, is_temp = download(server_url+'foo.txt')
->>> print path
+>>> print(path)
/download-cache/test/foo.txt
>>> cat(path)
This is a foo text.
@@ -325,7 +325,7 @@
>>> download = Download(cache=cache, hash_name=True)
>>> path, is_temp = download(server_url+'foo.txt')
->>> print path
+>>> print(path)
/download-cache/09f5793fcdc1716727f72d49519c688d
>>> cat(path)
This is a foo text.
@@ -355,7 +355,7 @@
cache under a different name:
>>> path2, is_temp = download(server_url+'other/foo.txt')
->>> print path2
+>>> print(path2)
/download-cache/537b6d73267f8f4447586989af8c470e
>>> path == path2
False
@@ -383,7 +383,7 @@
cache is configured in the first place:
>>> download = Download(cache=cache, fallback=True)
->>> print download.cache_dir
+>>> print(download.cache_dir)
/download-cache/
A downloaded file will be cached:
@@ -401,8 +401,8 @@
>>> remove(server_data, 'foo.txt')
>>> try: Download()(server_url+'foo.txt') # doctest: +ELLIPSIS
-... except: print 'download error'
-... else: print 'woops'
+... except: print('download error')
+... else: print('woops')
download error
>>> path, is_temp = download(server_url+'foo.txt')
>>> cat(path)
@@ -419,7 +419,7 @@
>>> offline_download = Download(cache=cache, offline=True, fallback=True)
>>> path, is_temp = offline_download(server_url+'foo.txt')
->>> print path
+>>> print(path)
/download-cache/foo.txt
>>> cat(path)
This is a foo text.
@@ -459,7 +459,7 @@
option:
>>> download = Download({'download-cache': cache}, namespace='cmmi')
->>> print download.cache_dir
+>>> print(download.cache_dir)
/download-cache/cmmi
If the ``download-cache`` option specifies a relative path, it is understood
@@ -467,18 +467,18 @@
that is given:
>>> download = Download({'download-cache': 'relative-cache'})
->>> print download.cache_dir
+>>> print(download.cache_dir)
/sample-buildout/relative-cache/
>>> download = Download({'directory': join(sample_buildout, 'root'),
... 'download-cache': 'relative-cache'})
->>> print download.cache_dir
+>>> print(download.cache_dir)
/sample-buildout/root/relative-cache/
Keyword parameters take precedence over the corresponding options:
>>> download = Download({'download-cache': cache}, cache=None)
->>> print download.cache_dir
+>>> print(download.cache_dir)
None
Whether to assume offline mode can be inferred from either the ``offline`` or
@@ -548,3 +548,4 @@
Reset the global temporary directory:
>>> tempfile.tempdir = old_tempdir
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/downloadcache.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/downloadcache.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/downloadcache.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -31,7 +31,7 @@
We specified a link server that has some distributions available for
download:
- >>> print get(link_server),
+ >>> print(get(link_server), end=' ')
<html><body>
<a href="bigdemo-0.1-py2.4.egg">bigdemo-0.1-py2.4.egg</a><br>
<a href="demo-0.1-py2.4.egg">demo-0.1-py2.4.egg</a><br>
@@ -58,7 +58,7 @@
If we run the buildout, we'll see the eggs installed from the link
server as usual:
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
GET 200 /
GET 200 /demo-0.2-py2.4.egg
GET 200 /demoneeded-1.2c1.zip
@@ -88,7 +88,7 @@
... if f.startswith('demo'):
... remove('eggs', f)
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
GET 200 /
Updating eggs.
Getting distribution for 'demo==0.2'.
@@ -131,7 +131,7 @@
... eggs = demo
... ''' % globals())
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Uninstalling eggs.
Installing eggs.
Getting distribution for 'demo'.
@@ -139,3 +139,4 @@
Getting distribution for 'demoneeded'.
Got demoneeded 1.2c1.
Generated script '/sample-buildout/bin/demo'.
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/easy_install.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/easy_install.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -94,11 +94,11 @@
stdout, stderr = subprocess.Popen(
[executable, '-Sc',
'try:\n'
- ' import ConfigParser\n'
+ ' import pprint\n'
'except ImportError:\n'
- ' print 1\n'
+ ' print(1)\n'
'else:\n'
- ' print 0\n'],
+ ' print(0)\n'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
return bool(int(stdout.strip()))
@@ -129,7 +129,7 @@
cmd.extend(args)
cmd.extend([
"-c", "import sys, os;"
- "print repr([os.path.normpath(p) for p in sys.path if p])"])
+ "print(repr([os.path.normpath(p) for p in sys.path if p]))"])
# Windows needs some (as yet to be determined) part of the real env.
env = os.environ.copy()
# We need to make sure that PYTHONPATH, which will often be set
@@ -924,7 +924,7 @@
if dist is None:
try:
dist = best[req.key] = env.best_match(req, ws)
- except pkg_resources.VersionConflict, err:
+ except pkg_resources.VersionConflict as err:
raise VersionConflict(err, ws)
if dist is None or (
dist.location in self._site_packages and not
@@ -1157,12 +1157,12 @@
undo.append(lambda: os.remove(tsetup))
undo.append(lambda: os.close(fd))
- os.write(fd, runsetup_template % dict(
+ os.write(fd, (runsetup_template % dict(
setuptools=setuptools_loc,
setupdir=directory,
setup=setup,
__file__ = setup,
- ))
+ )).encode())
tmp3 = tempfile.mkdtemp('build', dir=dest)
undo.append(lambda : shutil.rmtree(tmp3))
@@ -1301,7 +1301,7 @@
"""Given working set and extra paths, return a normalized path list."""
path = [dist.location for dist in working_set]
path.extend(extra_paths)
- return map(realpath, path)
+ return list(map(realpath, path))
def _generate_scripts(reqs, working_set, dest, path, scripts, relative_paths,
initialization, executable, arguments,
@@ -1459,7 +1459,7 @@
if changed:
open(script_name, 'w').write(contents)
try:
- os.chmod(script_name, 0755)
+ os.chmod(script_name, 0o755)
except (AttributeError, os.error):
pass
logger.info("Generated %s %r.", logged_type, full_name)
@@ -1555,7 +1555,7 @@
sys.argv[:] = _args
__file__ = _args[0]
del _options, _args
- execfile(__file__)
+ exec(open(__file__).read())
if _interactive:
del _interactive
@@ -1574,7 +1574,7 @@
"import imp; "
"fp, path, desc = imp.find_module(%r); "
"fp.close(); "
- "print path" % (name,)]
+ "print(path)" % (name,)]
env = os.environ.copy()
# We need to make sure that PYTHONPATH, which will often be set to
# include a custom buildout-generated site.py, is not set, or else
@@ -1591,7 +1591,7 @@
return None
# else: ...
res = stdout.strip()
- if res.endswith('.pyc') or res.endswith('.pyo'):
+ if res.endswith(b'.pyc') or res.endswith(b'.pyo'):
raise RuntimeError('Cannot find uncompiled version of %s' % (name,))
if not os.path.exists(res):
raise RuntimeError(
@@ -1812,7 +1812,7 @@
os.chdir(%(setupdir)r)
sys.argv[0] = %(setup)r
-execfile(%(setup)r)
+exec(open(%(setup)r).read())
"""
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/easy_install.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/easy_install.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/easy_install.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -107,7 +107,7 @@
We have a link server that has a number of eggs:
- >>> print get(link_server),
+ >>> print(get(link_server), end=' ')
<html><body>
<a href="bigdemo-0.1-py2.4.egg">bigdemo-0.1-py2.4.egg</a><br>
<a href="demo-0.1-py2.4.egg">demo-0.1-py2.4.egg</a><br>
@@ -138,7 +138,7 @@
The working set contains the distributions we retrieved.
>>> for dist in ws:
- ... print dist
+ ... print(dist)
demo 0.2
demoneeded 1.1
@@ -182,7 +182,7 @@
>>> ws = zc.buildout.easy_install.install(
... ['demo'], dest, links=[link_server], index=link_server+'index/')
>>> for dist in ws:
- ... print dist
+ ... print(dist)
demo 0.4c1
demoneeded 1.2c1
@@ -207,7 +207,7 @@
... links=[link_server], index=link_server+'index/')
>>> for dist in ws:
- ... print dist
+ ... print(dist)
demo 0.3
other 1.0
demoneeded 1.0
@@ -321,7 +321,7 @@
...
IncompatibleVersionError: Bad version 0.2
- >>> print handler
+ >>> print(handler)
zc.buildout.easy_install DEBUG
Installing 'demo >0.2'.
zc.buildout.easy_install ERROR
@@ -336,7 +336,7 @@
... ['demo'], dest, links=[link_server], index=link_server+'index/',
... )
- >>> print handler
+ >>> print(handler)
zc.buildout.easy_install DEBUG
Installing 'demo'.
zc.buildout.easy_install DEBUG
@@ -775,7 +775,7 @@
sys.argv[:] = _args
__file__ = _args[0]
del _options, _args
- execfile(__file__)
+ exec(open(__file__).read())
<BLANKLINE>
if _interactive:
del _interactive
@@ -788,17 +788,17 @@
... print sys.argv
... print (__name__, __file__, __doc__)
... ''')
- >>> print system(join(bin, 'py')+' ascript a b c'),
+ >>> print(system(join(bin, 'py')+' ascript a b c'), end=' ')
['ascript', 'a', 'b', 'c']
('__main__', 'ascript', 'demo doc')
For Python 2.5 and higher, you can also use the -m option to run a
module:
- >>> print system(join(bin, 'py')+' -m pdb'),
+ >>> print(system(join(bin, 'py')+' -m pdb'), end=' ')
usage: pdb.py scriptfile [arg] ...
- >>> print system(join(bin, 'py')+' -m pdb what'),
+ >>> print(system(join(bin, 'py')+' -m pdb what'), end=' ')
Error: what does not exist
An additional argument can be passed to define which scripts to install
@@ -818,7 +818,7 @@
>>> ls(bin)
- run
- >>> print system(os.path.join(bin, 'run')),
+ >>> print(system(os.path.join(bin, 'run')), end=' ')
3 1
The ``scripts`` function: Including extra paths in scripts
@@ -948,7 +948,7 @@
Of course, running the script works:
- >>> print system(join(bo, 'bin', 'run')),
+ >>> print(system(join(bo, 'bin', 'run')), end=' ')
3 1
We specified an interpreter and its paths are adjusted too:
@@ -990,7 +990,7 @@
sys.argv[:] = _args
__file__ = _args[0]
del _options, _args
- execfile(__file__)
+ exec(open(__file__).read())
<BLANKLINE>
if _interactive:
del _interactive
@@ -1110,11 +1110,11 @@
Here are some examples of the interpreter in use.
- >>> print call_py(interpreter_path, "print 16+26")
+ >>> print(call_py(interpreter_path, "print 16+26"))
42
<BLANKLINE>
>>> res = call_py(interpreter_path, "import sys; print sys.path")
- >>> print res # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
+ >>> print(res) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
['',
'/interpreter/parts/interpreter',
...,
@@ -1144,7 +1144,7 @@
>>> cat(sitecustomize_path)
import os
os.environ['FOO'] = 'bar baz bing shazam'
- >>> print call_py(interpreter_path, "import os; print os.environ['FOO']")
+ >>> print(call_py(interpreter_path, "import os; print os.environ['FOO']"))
bar baz bing shazam
<BLANKLINE>
@@ -1194,8 +1194,8 @@
The paths resolve in practice as you would expect.
- >>> print call_py(interpreter_path,
- ... "import sys, pprint; pprint.pprint(sys.path)")
+ >>> print(call_py(interpreter_path,
+ ... "import sys, pprint; pprint.pprint(sys.path)"))
... # doctest: +ELLIPSIS
['',
'/interpreter/parts/interpreter',
@@ -1224,8 +1224,8 @@
'/interpreter/other'
]...
- >>> print call_py(interpreter_path,
- ... "import sys, pprint; pprint.pprint(sys.path)")
+ >>> print(call_py(interpreter_path,
+ ... "import sys, pprint; pprint.pprint(sys.path)"))
... # doctest: +ELLIPSIS
['',
'/interpreter/parts/interpreter',
@@ -1306,7 +1306,7 @@
give you an idea of the feature.
>>> res = call_py(interpreter_path, "import sys; print sys.path")
- >>> print res # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
+ >>> print(res) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
['',
'/interpreter/parts/interpreter',
...,
@@ -1376,7 +1376,7 @@
<BLANKLINE>
def original_addsitepackages(known_paths):...
- >>> print call_py(interpreter_path, "import sys; print sys.path")
+ >>> print(call_py(interpreter_path, "import sys; print sys.path"))
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
['',
'/interpreter/parts/interpreter',
@@ -1441,7 +1441,7 @@
<BLANKLINE>
def original_addsitepackages(known_paths):...
- >>> print call_py(interpreter_path, "import sys; print sys.path")
+ >>> print(call_py(interpreter_path, "import sys; print sys.path"))
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
['',
'/interpreter/parts/interpreter',
@@ -1523,7 +1523,7 @@
>>> demo_call = join(interpreter_bin_dir, 'demo')
>>> if sys.platform == 'win32':
... demo_call = '"%s"' % demo_call
- >>> print system(demo_call)
+ >>> print(system(demo_call))
3 1
<BLANKLINE>
@@ -1680,7 +1680,7 @@
Let's update our link server with a new version of extdemo:
>>> update_extdemo()
- >>> print get(link_server),
+ >>> print(get(link_server), end=' ')
<html><body>
<a href="bigdemo-0.1-py2.4.egg">bigdemo-0.1-py2.4.egg</a><br>
<a href="demo-0.1-py2.4.egg">demo-0.1-py2.4.egg</a><br>
@@ -1983,3 +1983,4 @@
>>> zc.buildout.easy_install.install_from_cache(False)
True
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/extends-cache.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/extends-cache.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/extends-cache.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -41,20 +41,20 @@
When trying to run this buildout offline, we'll find that we cannot read all
of the required configuration:
->>> print system(buildout + ' -o')
+>>> print(system(buildout + ' -o'))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
Trying the same online, we can:
->>> print system(buildout)
+>>> print(system(buildout))
Unused options for buildout: 'foo'.
As long as we haven't said anything about caching downloaded configuration,
nothing gets cached. Offline mode will still cause the buildout to fail:
->>> print system(buildout + ' -o')
+>>> print(system(buildout + ' -o'))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
@@ -73,7 +73,7 @@
... extends-cache = cache
... """ % server_url)
->>> print system(buildout)
+>>> print(system(buildout))
Unused options for buildout: 'foo'.
>>> cache = join(sample_buildout, 'cache')
@@ -88,7 +88,7 @@
We can now run buildout offline as it will read base.cfg from the cache:
->>> print system(buildout + ' -o')
+>>> print(system(buildout + ' -o'))
Unused options for buildout: 'foo'.
The cache is being used purely as a fall-back in case we are offline or don't
@@ -104,18 +104,18 @@
... bar = baz
... """)
->>> print system(buildout + ' -o')
+>>> print(system(buildout + ' -o'))
Unused options for buildout: 'foo'.
In online mode, buildout will download and use the modified version:
->>> print system(buildout)
+>>> print(system(buildout))
Unused options for buildout: 'bar'.
Trying offline mode again, the new version will be used as it has been put in
the cache now:
->>> print system(buildout + ' -o')
+>>> print(system(buildout + ' -o'))
Unused options for buildout: 'bar'.
Clean up:
@@ -203,7 +203,7 @@
Buildout will now assemble its configuration from all of these 6 files,
defaults first. The online resources end up in the respective extends caches:
->>> print system(buildout)
+>>> print(system(buildout))
Unused options for buildout: 'foo'.
>>> ls('user-cache')
@@ -249,7 +249,7 @@
>>> remove('user-cache', os.listdir('user-cache')[0])
>>> remove('cache', os.listdir('cache')[0])
->>> print system(buildout)
+>>> print(system(buildout))
Unused options for buildout: 'foo'.
>>> ls('user-cache')
@@ -272,7 +272,7 @@
If we run buildout in offline mode now, it will fail because it cannot get at
the remote configuration file needed by the user's defaults:
->>> print system(buildout + ' -o')
+>>> print(system(buildout + ' -o'))
While:
Initializing.
Error: Couldn't download 'http://localhost/base_default.cfg' in offline mode.
@@ -285,7 +285,7 @@
... extends = fancy_default.cfg
... offline = true
... """)
->>> print system(buildout)
+>>> print(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base_default.cfg' in offline mode.
@@ -299,7 +299,7 @@
... extends = %sbase_default.cfg
... offline = true
... """ % server_url)
->>> print system(buildout)
+>>> print(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
@@ -313,7 +313,7 @@
... extends = fancy.cfg
... offline = true
... """)
->>> print system(buildout)
+>>> print(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
@@ -327,7 +327,7 @@
... extends = %sbase.cfg
... offline = true
... """ % server_url)
->>> print system(buildout)
+>>> print(system(buildout))
Unused options for buildout: 'foo'.
The ``install-from-cache`` option is treated accordingly:
@@ -337,7 +337,7 @@
... extends = fancy_default.cfg
... install-from-cache = true
... """)
->>> print system(buildout)
+>>> print(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base_default.cfg' in offline mode.
@@ -351,7 +351,7 @@
... extends = %sbase_default.cfg
... install-from-cache = true
... """ % server_url)
->>> print system(buildout)
+>>> print(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
@@ -365,7 +365,7 @@
... extends = fancy.cfg
... install-from-cache = true
... """)
->>> print system(buildout)
+>>> print(system(buildout))
While:
Initializing.
Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
@@ -379,7 +379,7 @@
... extends = %sbase.cfg
... install-from-cache = true
... """ % server_url)
->>> print system(buildout)
+>>> print(system(buildout))
While:
Installing.
Checking for upgrades.
@@ -397,3 +397,4 @@
Reset the global temporary directory:
>>> tempfile.tempdir = old_tempdir
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/repeatable.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/repeatable.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/repeatable.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -39,7 +39,7 @@
>>> write('recipe', 'README', '')
- >>> print system(buildout+' setup recipe bdist_egg'), # doctest: +ELLIPSIS
+ >>> print(system(buildout+' setup recipe bdist_egg'), end=' ') # doctest: +ELLIPSIS
Running setup script 'recipe/setup.py'.
...
@@ -64,7 +64,7 @@
... ''')
- >>> print system(buildout+' setup recipe bdist_egg'), # doctest: +ELLIPSIS
+ >>> print(system(buildout+' setup recipe bdist_egg'), end=' ') # doctest: +ELLIPSIS
Running setup script 'recipe/setup.py'.
...
@@ -82,7 +82,7 @@
If we run the buildout, it will use version 2:
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Getting distribution for 'spam'.
Got spam 2.
Installing foo.
@@ -112,7 +112,7 @@
Now, if we run the buildout, we'll use version 1 of the spam recipe:
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Getting distribution for 'spam==1'.
Got spam 1.
Uninstalling foo.
@@ -123,7 +123,7 @@
about versions used. If we run the buildout in verbose mode without
specifying a versions section:
- >>> print system(buildout+' buildout:versions= -v'), # doctest: +ELLIPSIS
+ >>> print(system(buildout+' buildout:versions= -v'), end=' ') # doctest: +ELLIPSIS
Installing 'zc.buildout', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
@@ -145,7 +145,7 @@
If we run the buildout with the versions section:
- >>> print system(buildout+' -v'), # doctest: +ELLIPSIS
+ >>> print(system(buildout+' -v'), end=' ') # doctest: +ELLIPSIS
Installing 'zc.buildout', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
@@ -178,3 +178,4 @@
... [foo]
... recipe = spam
... ''' % join('recipe', 'dist'))
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/rmtree.py
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/rmtree.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/rmtree.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -54,7 +54,7 @@
0
"""
def retry_writeable (func, path, exc):
- os.chmod (path, 0600)
+ os.chmod (path, 0o600)
func (path)
shutil.rmtree (path, onerror = retry_writeable)
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/runsetup.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/runsetup.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/runsetup.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -32,7 +32,7 @@
We can use the buildout command to generate the hello egg:
- >>> print system(buildout +' setup hello -q bdist_egg'),
+ >>> print(system(buildout +' setup hello -q bdist_egg'), end=' ')
Running setup script 'hello/setup.py'.
zip_safe flag not set; analyzing archive contents...
@@ -40,3 +40,4 @@
>>> ls('hello', 'dist')
- hello-1.0-py2.4.egg
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/setup.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/setup.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/setup.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -28,14 +28,14 @@
doesn't import setuptools. Let's try running it to create an egg.
We'll use the buildout script from our sample buildout:
- >>> print system(buildout+' setup'),
+ >>> print(system(buildout+' setup'), end=' ')
... # doctest: +NORMALIZE_WHITESPACE
Error: The setup command requires the path to a setup script or
directory containing a setup script, and its arguments.
Oops, we forgot to give the name of the setup script:
- >>> print system(buildout+' setup setup.py bdist_egg'),
+ >>> print(system(buildout+' setup setup.py bdist_egg'), end=' ')
... # doctest: +ELLIPSIS
Running setup script 'setup.py'.
...
@@ -46,6 +46,7 @@
Note that we can specify a directory name. This is often shorter and
preferred by the lazy :)
- >>> print system(buildout+' setup . bdist_egg'), # doctest: +ELLIPSIS
+ >>> print(system(buildout+' setup . bdist_egg'), end=' ') # doctest: +ELLIPSIS
Running setup script './setup.py'.
...
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/testing.py
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/testing.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/testing.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -16,7 +16,7 @@
$Id$
"""
-import BaseHTTPServer
+import http.server
import errno
import logging
import os
@@ -31,7 +31,7 @@
import textwrap
import threading
import time
-import urllib2
+import urllib.request, urllib.error, urllib.parse
import zc.buildout.buildout
import zc.buildout.easy_install
@@ -50,7 +50,7 @@
and os.path.exists(path+'-script.py')
):
path = path+'-script.py'
- print open(path).read(),
+ print(open(path).read(), end=' ')
def ls(dir, *subs):
if subs:
@@ -59,12 +59,12 @@
names.sort()
for name in names:
if os.path.isdir(os.path.join(dir, name)):
- print 'd ',
+ print('d ', end=' ')
elif os.path.islink(os.path.join(dir, name)):
- print 'l ',
+ print('l ', end=' ')
else:
- print '- ',
- print name
+ print('- ', end=' ')
+ print(name)
def mkdir(*path):
os.mkdir(os.path.join(*path))
@@ -121,7 +121,7 @@
' '.join(arg for arg in (interpreter, flags, '-c', cmd) if arg))
def get(url):
- return urllib2.urlopen(url).read()
+ return urllib.request.urlopen(url).read()
def _runsetup(setup, executable, *args):
if os.path.isdir(setup):
@@ -245,7 +245,7 @@
def set_installer_values(values):
"""Set the given values on the installer."""
- for name, value in values.items():
+ for name, value in list(values.items()):
getattr(zc.buildout.easy_install, name)(value)
def make_buildout(executable=None):
@@ -410,10 +410,10 @@
for f in test.globs['__tear_downs']:
f()
-class Server(BaseHTTPServer.HTTPServer):
+class Server(http.server.HTTPServer):
def __init__(self, tree, *args):
- BaseHTTPServer.HTTPServer.__init__(self, *args)
+ http.server.HTTPServer.__init__(self, *args)
self.tree = os.path.abspath(tree)
__run = True
@@ -424,14 +424,14 @@
def handle_error(self, *_):
self.__run = False
-class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
+class Handler(http.server.BaseHTTPRequestHandler):
Server.__log = False
def __init__(self, request, address, server):
self.__server = server
self.tree = server.tree
- BaseHTTPServer.BaseHTTPRequestHandler.__init__(
+ http.server.BaseHTTPRequestHandler.__init__(
self, request, address, server)
def do_GET(self):
@@ -494,7 +494,7 @@
def log_request(self, code):
if self.__server.__log:
- print '%s %s %s' % (self.command, code, self.path)
+ print('%s %s %s' % (self.command, code, self.path))
def _run(tree, port):
server_address = ('localhost', port)
@@ -512,7 +512,7 @@
return port
finally:
s.close()
- raise RuntimeError, "Can't find port"
+ raise RuntimeError("Can't find port")
def _start_server(tree, name=''):
port = get_port()
@@ -527,7 +527,7 @@
def stop_server(url, thread=None):
try:
- urllib2.urlopen(url+'__stop__')
+ urllib.request.urlopen(url+'__stop__')
except Exception:
pass
if thread is not None:
@@ -543,7 +543,7 @@
s.close()
if up:
break
- except socket.error, e:
+ except socket.error as e:
if e[0] not in (errno.ECONNREFUSED, errno.ECONNRESET):
raise
s.close()
@@ -556,7 +556,7 @@
raise SystemError("Couln't stop server")
def install(project, destination):
- if not isinstance(destination, basestring):
+ if not isinstance(destination, str):
destination = os.path.join(destination.globs['sample_buildout'],
'eggs')
@@ -576,7 +576,7 @@
).write(dist.location)
def install_develop(project, destination):
- if not isinstance(destination, basestring):
+ if not isinstance(destination, str):
destination = os.path.join(destination.globs['sample_buildout'],
'develop-eggs')
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/testrecipes.py
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/testrecipes.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/testrecipes.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -7,10 +7,10 @@
self.options = options
def install(self):
- items = self.options.items()
+ items = list(self.options.items())
items.sort()
for option, value in items:
- print " %s=%r" % (option, value)
+ print(" %s=%r" % (option, value))
return ()
update = install
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -2963,9 +2963,9 @@
)
if dist.extras:
- print 'downloaded', dist.version
+ print('downloaded', dist.version)
else:
- print 'had', dist.version
+ print('had', dist.version)
sys.path_importer_cache.clear()
def prefer_final():
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/update.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/update.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/update.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -64,7 +64,7 @@
Now if we run the buildout, the buildout will upgrade itself to the
new versions found in new releases:
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Getting distribution for 'zc.buildout'.
Got zc.buildout 99.99.
Getting distribution for 'setuptools'.
@@ -140,7 +140,7 @@
Now we can see that we actually "upgrade" to an earlier version.
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Upgraded:
zc.buildout version 1.0.0,
setuptools version 0.6;
@@ -167,7 +167,7 @@
... recipe = showversions
... """ % dict(new_releases=new_releases))
- >>> print system(buildout+' -o'),
+ >>> print(system(buildout+' -o'), end=' ')
Develop: '/sample-buildout/showversions'
Updating show-versions.
zc.buildout 1.0.0
@@ -175,7 +175,7 @@
Or in non-newest mode:
- >>> print system(buildout+' -N'),
+ >>> print(system(buildout+' -N'), end=' ')
Develop: '/sample-buildout/showversions'
Updating show-versions.
zc.buildout 1.0.0
@@ -195,7 +195,7 @@
... """ % dict(new_releases=new_releases))
>>> cd(sample_buildout2)
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Creating directory '/sample_buildout2/bin'.
Creating directory '/sample_buildout2/parts'.
Creating directory '/sample_buildout2/eggs'.
@@ -230,8 +230,8 @@
... recipe = showversions
... """ % dict(new_releases=new_releases))
- >>> print system(buildout +
- ... ' buildout:accept-buildout-test-releases=true'),
+ >>> print(system(buildout +
+ ... ' buildout:accept-buildout-test-releases=true'), end=' ')
... # doctest: +NORMALIZE_WHITESPACE
Getting distribution for 'zc.buildout'.
Got zc.buildout 100.0b1.
@@ -254,10 +254,11 @@
>>> import sys
>>> if sys.platform.startswith('win'):
... buildout_script += '-script.py'
- >>> print open(buildout_script).read() # doctest: +ELLIPSIS
+ >>> print(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
sys.argv.insert(1, 'buildout:accept-buildout-test-releases=true')
print ('NOTE: Accepting early releases of build system packages. Rerun '
'bootstrap without --accept-buildout-test-releases (-t) to return to '
'default behavior.')
...
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/virtualenv.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/virtualenv.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/virtualenv.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -76,8 +76,8 @@
... py_file.write(line)
... if line.startswith('environ = os.environ.copy()'):
... py_file.write(extra)
- ... print 'Rewritten.'
- ...
+ ... print('Rewritten.')
+ ...
Rewritten.
>>> py_file.close()
>>> sitecustomize_path = join(os.path.dirname(site_packages_path),
@@ -114,14 +114,14 @@
... sys.meta_path.append(ImportHook)
... ''' % (py_path,))
>>> sitecustomize_file.close()
- >>> print call_py(
+ >>> print(call_py(
... _safe_arg(py_path),
- ... "import ConfigParser")
+ ... "import ConfigParser"))
<BLANKLINE>
- >>> print 'X'; print call_py(
+ >>> print('X'); print(call_py(
... _safe_arg(py_path),
... "import ConfigParser",
- ... '-S') # doctest: +ELLIPSIS
+ ... '-S')) # doctest: +ELLIPSIS
X...Traceback (most recent call last):
...
ImportError: No module named ConfigParser
@@ -157,9 +157,9 @@
... parts =
... ''')
>>> write('bootstrap.py', open(bootstrap_py).read())
- >>> print 'X'; print system(
+ >>> print('X'); print(system(
... _safe_arg(py_path)+' '+
- ... 'bootstrap.py'); print 'X' # doctest: +ELLIPSIS
+ ... 'bootstrap.py')); print('X') # doctest: +ELLIPSIS
X...
Generated script '/broken_S/bin/buildout'.
...
@@ -208,7 +208,7 @@
... eggs = demo
... ''' % globals())
- >>> print system(buildout), # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
+ >>> print(system(buildout), end=' ') # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
Installing eggs.
Getting distribution for 'demo'.
Got demo 0.4c1.
@@ -232,19 +232,19 @@
you don't want those warnings for those particular recipes that use the
new features, you can use the "-s" option to squelch the warnings.
- >>> print system(buildout + ' -s'),
+ >>> print(system(buildout + ' -s'), end=' ')
Updating eggs.
A lower verbosity (one or more -q options) also quiets the warning.
- >>> print system(buildout + ' -q'),
+ >>> print(system(buildout + ' -q'), end=' ')
Notice that, as we saw before with bin/buildout, the generated scripts
are old-style, because the new-style feature gracefully degrades to the
previous implementation when it encounters an executable with a broken
dash-S.
- >>> print 'X'; cat('bin', 'py') # doctest: +ELLIPSIS
+ >>> print('X'); cat('bin', 'py') # doctest: +ELLIPSIS
X...
<BLANKLINE>
import sys
@@ -255,3 +255,4 @@
]
...
+
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/windows.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/windows.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/windows.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -43,7 +43,7 @@
>>> write('recipe', 'README', '')
- >>> print system(buildout+' setup recipe bdist_egg'), # doctest: +ELLIPSIS
+ >>> print(system(buildout+' setup recipe bdist_egg'), end=' ') # doctest: +ELLIPSIS
Running setup script 'recipe/setup.py'.
...
@@ -59,8 +59,9 @@
... recipe = spam
... ''' % join('recipe', 'dist'))
- >>> print system(buildout),
+ >>> print(system(buildout), end=' ')
Getting distribution for 'spam'.
Got spam 1.
Installing foo.
can't remove read only files
+
Modified: zc.buildout/branches/regebro-python3/test_all_pythons.cfg
===================================================================
--- zc.buildout/branches/regebro-python3/test_all_pythons.cfg 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/test_all_pythons.cfg 2010-11-21 14:36:46 UTC (rev 118515)
@@ -28,6 +28,11 @@
recipe = ${test:recipe}
eggs = ${test:eggs}
+[test31]
+python = python3.1
+recipe = ${test:recipe}
+eggs = ${test:eggs}
+
[oltest24]
python = python2.4
recipe = ${oltest:recipe}
@@ -45,3 +50,9 @@
recipe = ${oltest:recipe}
eggs = ${oltest:eggs}
defaults = ${oltest:defaults}
+
+[oltest31]
+python = python3.1
+recipe = ${oltest:recipe}
+eggs = ${oltest:eggs}
+defaults = ${oltest:defaults}
Modified: zc.buildout/branches/regebro-python3/z3c.recipe.scripts_/src/z3c/recipe/scripts/scripts.py
===================================================================
--- zc.buildout/branches/regebro-python3/z3c.recipe.scripts_/src/z3c/recipe/scripts/scripts.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/z3c.recipe.scripts_/src/z3c/recipe/scripts/scripts.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -23,7 +23,7 @@
def __init__(self, buildout, name, options):
if 'extends' in options:
- for key, value in buildout[options['extends']].items():
+ for key, value in list(buildout[options['extends']].items()):
options.setdefault(key, value)
super(Base, self).__init__(buildout, name, options)
self.default_eggs = '' # Disables feature from zc.recipe.egg.
Modified: zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/custom.py
===================================================================
--- zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/custom.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/custom.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -62,7 +62,7 @@
self.environment = buildout[environment_section]
else:
self.environment = {}
- environment_data = self.environment.items()
+ environment_data = list(self.environment.items())
environment_data.sort()
options['_environment-data'] = repr(environment_data)
@@ -101,7 +101,7 @@
def _set_environment(self):
self._saved_environment = {}
- for key, value in self.environment.items():
+ for key, value in list(self.environment.items()):
if key in os.environ:
self._saved_environment[key] = os.environ[key]
# Interpolate value with variables from environment. Maybe there
Modified: zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/egg.py
===================================================================
--- zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/egg.py 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/egg.py 2010-11-21 14:36:46 UTC (rev 118515)
@@ -16,9 +16,13 @@
$Id$
"""
-import UserDict, logging, os, re, zipfile
+import logging, os, re, zipfile
import zc.buildout
import zc.buildout.easy_install
+try:
+ from collections import MutableMapping
+except ImportError:
+ from UserDict import DictMixin as MutableMapping
class Eggs(object):
@@ -198,7 +202,7 @@
Egg = Scripts
-class _BackwardsSupportOption(UserDict.UserDict):
+class _BackwardsSupportOption(MutableMapping):
def __init__(self, data):
self.data = data # We want to show mutations to the underlying dict.
Modified: zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt
===================================================================
--- zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt 2010-11-20 21:28:13 UTC (rev 118514)
+++ zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt 2010-11-21 14:36:46 UTC (rev 118515)
@@ -131,7 +131,7 @@
sys.argv[:] = _args
__file__ = _args[0]
del _options, _args
- execfile(__file__)
+ exec(open(__file__).read())
<BLANKLINE>
if _interactive:
del _interactive
More information about the checkins
mailing list