[Checkins] SVN: zc.buildout/branches/regebro-python3/ More tests passing. Now we are stuck because of bugs in Distutils 0.6.14.
Lennart Regebro
regebro at gmail.com
Tue Nov 23 07:46:27 EST 2010
Log message for revision 118530:
More tests passing. Now we are stuck because of bugs in Distutils 0.6.14.
Changed:
U zc.buildout/branches/regebro-python3/bootstrap/bootstrap.py
U zc.buildout/branches/regebro-python3/src/zc/buildout/allowhosts.txt
U zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py
-=-
Modified: zc.buildout/branches/regebro-python3/bootstrap/bootstrap.py
===================================================================
--- zc.buildout/branches/regebro-python3/bootstrap/bootstrap.py 2010-11-23 11:59:20 UTC (rev 118529)
+++ zc.buildout/branches/regebro-python3/bootstrap/bootstrap.py 2010-11-23 12:46:26 UTC (rev 118530)
@@ -21,6 +21,12 @@
import os, shutil, sys, tempfile, textwrap, urllib, urllib.request, urllib.error, urllib.parse, subprocess
from optparse import OptionParser
+try:
+ from imp import reload
+except ImportError:
+ # Python 2, do nothing
+ pass
+
if sys.platform == 'win32':
def quote(c):
if ' ' in c:
@@ -34,11 +40,11 @@
stdout, stderr = subprocess.Popen(
[sys.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()
has_broken_dash_S = bool(int(stdout.strip()))
@@ -145,7 +151,7 @@
eggs_dir = tempfile.mkdtemp()
if options.setup_source is None:
- if options.use_distribute:
+ if options.use_distribute or sys.version_info > (3,):
options.setup_source = distribute_source
else:
options.setup_source = setuptools_source
@@ -161,7 +167,11 @@
raise ImportError
except ImportError:
ez_code = urllib.request.urlopen(
- options.setup_source).read().replace('\r\n', '\n')
+ options.setup_source).read()
+ if not isinstance(ez_code, str):
+ # In Python 3 it's bytes, convert to str:
+ ez_code = ez_code.decode()
+ ez_code.replace('\r\n', '\n')
ez = {}
exec(ez_code, ez)
setup_args = dict(to_dir=eggs_dir, download_delay=0)
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/allowhosts.txt
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/allowhosts.txt 2010-11-23 11:59:20 UTC (rev 118529)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/allowhosts.txt 2010-11-23 12:46:26 UTC (rev 118530)
@@ -64,7 +64,6 @@
Installing eggs.
Getting distribution for 'kss.core'.
Error: Couldn't find a distribution for 'kss.core'.
- <BLANKLINE>
That's what we wanted : this will prevent any attempt to access
unwanted domains. For instance, some packages are listing in their
@@ -97,7 +96,6 @@
Installing eggs.
Getting distribution for 'kss.core'.
Error: Couldn't find a distribution for 'kss.core'.
- <BLANKLINE>
Test for issues
---------------
@@ -120,7 +118,6 @@
Installing python.
Generated script '/sample-buildout/bin/buildout'.
Generated interpreter '/sample-buildout/bin/python'.
- <BLANKLINE>
The bug 239212 above would have got us an *AttributeError* on *buildout._allow_hosts*.
This was fixed in this changeset:
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py 2010-11-23 11:59:20 UTC (rev 118529)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py 2010-11-23 12:46:26 UTC (rev 118530)
@@ -23,6 +23,7 @@
import zc.buildout.easy_install
import zc.buildout.testing
import zc.buildout.testselectingpython
+from zc.buildout.pycompat import b
import zipfile
os_path_sep = os.path.sep
@@ -2840,11 +2841,14 @@
>>> src = tmpdir('src')
>>> write(src, 'wacky_handler.py',
... '''
- ... import urllib2
- ... class Wacky(urllib2.HTTPHandler):
- ... wacky_open = urllib2.HTTPHandler.http_open
+ ... try:
+ ... from urllib2 as request
+ ... except ImportError:
+ ... from urllib import request
+ ... class Wacky(request.HTTPHandler):
+ ... wacky_open = request.HTTPHandler.http_open
... def install(buildout=None):
- ... urllib2.install_opener(urllib2.build_opener(Wacky))
+ ... request.install_opener(request.build_opener(Wacky))
... ''')
>>> write(src, 'setup.py',
... '''
@@ -3870,8 +3874,8 @@
zip = zipfile.ZipFile(dest, 'a')
zip.writestr(
'EGG-INFO/PKG-INFO',
- zip.read('EGG-INFO/PKG-INFO').replace("Version: %s" % oldver,
- "Version: %s" % version)
+ zip.read('EGG-INFO/PKG-INFO').replace(b("Version: %s" % oldver),
+ b("Version: %s" % version))
)
zip.close()
else:
More information about the checkins
mailing list