[Checkins] SVN: zc.buildout/branches/regebro-python3/ easy_install.txt passes under Python 3.1.
Lennart Regebro
regebro at gmail.com
Mon Nov 22 14:09:43 EST 2010
Log message for revision 118522:
easy_install.txt passes under Python 3.1.
Changed:
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/testing.py
U zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py
U zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt
-=-
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-22 17:39:25 UTC (rev 118521)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/easy_install.py 2010-11-22 19:09:43 UTC (rev 118522)
@@ -1547,7 +1547,7 @@
if _opt == '-i':
_interactive = True
elif _opt == '-c':
- exec _val
+ exec(_val)
elif _opt == '-m':
sys.argv[1:] = _args
_args = []
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-22 17:39:25 UTC (rev 118521)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/easy_install.txt 2010-11-22 19:09:43 UTC (rev 118522)
@@ -129,7 +129,7 @@
>>> ws = zc.buildout.easy_install.install(
... ['demo==0.2'], dest,
... links=[link_server], index=link_server+'index/')
-
+
We requested version 0.2 of the demo distribution to be installed into
the destination server. We specified that we should search for links
on the link server and that we should use the (empty) link server
@@ -313,13 +313,11 @@
>>> import logging
>>> logging.getLogger('zc.buildout.easy_install').propagate = False
- >>> ws = zc.buildout.easy_install.install(
- ... ['demo >0.2'], dest, links=[link_server],
- ... index=link_server+'index/',
- ... versions = dict(demo='0.2', demoneeded='1.0'))
- Traceback (most recent call last):
- ...
- IncompatibleVersionError: Bad version 0.2
+ >>> assertRaises(zc.buildout.easy_install.IncompatibleVersionError,
+ ... zc.buildout.easy_install.install,
+ ... ['demo >0.2'], dest, links=[link_server],
+ ... index=link_server+'index/',
+ ... versions = dict(demo='0.2', demoneeded='1.0'))
>>> print(handler)
zc.buildout.easy_install DEBUG
@@ -362,12 +360,10 @@
(The old setting is returned.)
- >>> ws = zc.buildout.easy_install.install(
+ >>> assertRaises(zc.buildout.UserError,
+ ... zc.buildout.easy_install.install,
... ['demo'], dest, links=[link_server], index=link_server+'index/',
... )
- Traceback (most recent call last):
- ...
- UserError: Picked: demo = 0.3
>>> zc.buildout.easy_install.allow_picked_versions(True)
False
@@ -455,13 +451,10 @@
>>> zc.buildout.easy_install.clear_index_cache()
>>> rmdir(example_dest)
>>> example_dest = tmpdir('site-packages-example-install')
- >>> workingset = zc.buildout.easy_install.install(
+ >>> assertRaises(zc.buildout.easy_install.MissingDistribution,
+ ... zc.buildout.easy_install.install,
... ['demoneeded'], example_dest, links=[], executable=py_path,
... index=None)
- Traceback (most recent call last):
- ...
- MissingDistribution: Couldn't find a distribution for 'demoneeded'.
- >>> zc.buildout.easy_install.clear_index_cache()
Now we'll reset the default.
@@ -494,7 +487,7 @@
>>> get(link_server2 + 'enable_server_logging')
GET 200 /enable_server_logging
- ''
+ b''
Now we can create an egg that specifies that its dependencies are
found on this server.
@@ -764,7 +757,7 @@
if _opt == '-i':
_interactive = True
elif _opt == '-c':
- exec _val
+ exec(_val)
elif _opt == '-m':
sys.argv[1:] = _args
_args = []
@@ -786,7 +779,7 @@
>>> write('ascript', '''
... "demo doc"
... print(sys.argv)
- ... print(__name__, __file__, __doc__)
+ ... print((__name__, __file__, __doc__))
... ''')
>>> bprint(system(join(bin, 'py')+' ascript a b c'), )
['ascript', 'a', 'b', 'c']
@@ -979,7 +972,7 @@
if _opt == '-i':
_interactive = True
elif _opt == '-c':
- exec _val
+ exec(_val)
elif _opt == '-m':
sys.argv[1:] = _args
_args = []
@@ -1065,7 +1058,8 @@
sitecustomization, so sitecustomize.py is empty.
>>> cat(sitecustomize_path)
-
+ <BLANKLINE>
+
The interpreter script is simple. It puts the directory with the
site.py and sitecustomize.py on the PYTHONPATH and (re)starts Python.
@@ -1110,11 +1104,11 @@
Here are some examples of the interpreter in use.
- >>> print(call_py(interpreter_path, "print(16+26)"))
+ >>> bprint(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
+ >>> bprint(res) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
['',
'/interpreter/parts/interpreter',
...,
@@ -1144,9 +1138,8 @@
>>> cat(sitecustomize_path)
import os
os.environ['FOO'] = 'bar baz bing shazam'
- >>> print(call_py(interpreter_path, "import os; print(os.environ['FOO'])"))
+ >>> bprint(call_py(interpreter_path, "import os; print(os.environ['FOO'])"))
bar baz bing shazam
- <BLANKLINE>
If you use relative paths, this affects the interpreter and site.py. (This is
again the UNIX version; the Windows version uses subprocess instead of
@@ -1194,7 +1187,7 @@
The paths resolve in practice as you would expect.
- >>> print(call_py(interpreter_path,
+ >>> bprint(call_py(interpreter_path,
... "import sys, pprint; pprint.pprint(sys.path)"))
... # doctest: +ELLIPSIS
['',
@@ -1202,7 +1195,6 @@
...,
'/interpreter/eggs/demo-0.3-pyN.N.egg',
'/interpreter/eggs/demoneeded-1.1-pyN.N.egg']
- <BLANKLINE>
The ``extra_paths`` argument affects the path in site.py. Notice that
/interpreter/other is added after the eggs.
@@ -1224,7 +1216,7 @@
'/interpreter/other'
]...
- >>> print(call_py(interpreter_path,
+ >>> bprint(call_py(interpreter_path,
... "import sys, pprint; pprint.pprint(sys.path)"))
... # doctest: +ELLIPSIS
['',
@@ -1233,7 +1225,6 @@
'/interpreter/eggs/demo-0.3-pyN.N.egg',
'/interpreter/eggs/demoneeded-1.1-pyN.N.egg',
'/interpreter/other']
- <BLANKLINE>
The ``sitepackage_safe_scripts`` function: using site-packages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1306,14 +1297,13 @@
give you an idea of the feature.
>>> res = call_py(interpreter_path, "import sys; print(sys.path)")
- >>> print(res) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
+ >>> bprint(res) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
['',
'/interpreter/parts/interpreter',
...,
'/interpreter/eggs/demo-0.3-py2.4.egg',
'/interpreter/eggs/demoneeded-1.1-py2.4.egg',
...]
- <BLANKLINE>
The clean_paths gathered earlier is a subset of this full list of paths.
@@ -1376,7 +1366,7 @@
<BLANKLINE>
def original_addsitepackages(known_paths):...
- >>> print(call_py(interpreter_path, "import sys; print(sys.path)"))
+ >>> bprint(call_py(interpreter_path, "import sys; print(sys.path)"))
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
['',
'/interpreter/parts/interpreter',
@@ -1441,7 +1431,7 @@
<BLANKLINE>
def original_addsitepackages(known_paths):...
- >>> print(call_py(interpreter_path, "import sys; print(sys.path)"))
+ >>> bprint(call_py(interpreter_path, "import sys; print(sys.path)"))
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
['',
'/interpreter/parts/interpreter',
@@ -1525,7 +1515,6 @@
... demo_call = '"%s"' % demo_call
>>> bprint(system(demo_call))
3 1
- <BLANKLINE>
There are a few differences from the ``scripts`` function. First, the
``reqs`` argument (an iterable of string requirements or entry point
@@ -1849,7 +1838,7 @@
>>> get(link_server+'enable_server_logging')
GET 200 /enable_server_logging
- ''
+ b''
Now, if we install demo, and extdemo:
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/testing.py
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/testing.py 2010-11-22 17:39:25 UTC (rev 118521)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/testing.py 2010-11-22 19:09:43 UTC (rev 118522)
@@ -44,6 +44,16 @@
setuptools_location = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('setuptools')).location
+def assertRaises(eclass, method, *args, **kw):
+ try:
+ method(*args, **kw)
+ except:
+ e = sys.exc_info()[1]
+ if not isinstance(e, eclass):
+ raise
+ return
+ raise Exception("Expected exception %s not raised" % str(eclass))
+
def cat(dir, *names):
path = os.path.join(dir, *names)
if (not os.path.exists(path)
@@ -406,6 +416,7 @@
wait_until = wait_until,
make_py = make_py,
bprint = zc.buildout.pycompat.bprint,
+ assertRaises = assertRaises,
))
def buildoutTearDown(test):
@@ -458,12 +469,12 @@
):
self.send_response(404, 'Not Found')
#self.send_response(200)
- out = '<html><body>Not Found</body></html>'
+ out = b('<html><body>Not Found</body></html>')
#out = '\n'.join(self.tree, self.path, path)
self.send_header('Content-Length', str(len(out)))
self.send_header('Content-Type', 'text/html')
self.end_headers()
- self.wfile.write(b(out))
+ self.wfile.write(out)
return
self.send_response(200)
@@ -476,7 +487,7 @@
name += '/'
out.append('<a href="%s">%s</a><br>\n' % (name, name))
out.append('</body></html>\n')
- out = ''.join(out)
+ out = b(''.join(out))
self.send_header('Content-Length', str(len(out)))
self.send_header('Content-Type', 'text/html')
else:
@@ -492,7 +503,7 @@
self.send_header('Content-Type', 'text/html')
self.end_headers()
- self.wfile.write(b(out))
+ self.wfile.write(out)
def log_request(self, code):
if self.__server.__log:
Modified: zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py 2010-11-22 17:39:25 UTC (rev 118521)
+++ zc.buildout/branches/regebro-python3/src/zc/buildout/tests.py 2010-11-22 19:09:43 UTC (rev 118522)
@@ -3704,7 +3704,7 @@
tmp, 'eggrecipedemo.py',
'import eggrecipedemoneeded\n'
'x=%s\n'
- 'def main(): print(x, eggrecipedemoneeded).y\n'
+ 'def main(): print(x, eggrecipedemoneeded.y)\n'
% minor_version)
write(
tmp, 'setup.py',
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-22 17:39:25 UTC (rev 118521)
+++ zc.buildout/branches/regebro-python3/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt 2010-11-22 19:09:43 UTC (rev 118522)
@@ -120,7 +120,7 @@
if _opt == '-i':
_interactive = True
elif _opt == '-c':
- exec _val
+ exec(_val)
elif _opt == '-m':
sys.argv[1:] = _args
_args = []
More information about the checkins
mailing list