Commit 70c9ae13 authored by Jim Fulton's avatar Jim Fulton

checkpoint

parent 83d53da5
...@@ -55,19 +55,15 @@ local files:: ...@@ -55,19 +55,15 @@ local files::
Now we can run the buildout and make sure all attempts to dist.plone.org fails:: Now we can run the buildout and make sure all attempts to dist.plone.org fails::
>>> print_(system(buildout)) >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/allowdemo' Develop: '/sample-buildout/allowdemo'
Installing eggs. Installing eggs...
<BLANKLINE>
Link to http://dist.plone.org ***BLOCKED*** by --allow-hosts Link to http://dist.plone.org ***BLOCKED*** by --allow-hosts
<BLANKLINE> ...
Couldn't find index page for 'kss.core' (maybe misspelled?)
Getting distribution for 'kss.core'.
While: While:
Installing eggs. Installing eggs.
Getting distribution for 'kss.core'. Getting distribution for 'kss.core'.
Error: Couldn't find a 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 That's what we wanted : this will prevent any attempt to access
unwanted domains. For instance, some packages are listing in their unwanted domains. For instance, some packages are listing in their
...@@ -91,19 +87,15 @@ XXX (showcase with a svn:// file) ...@@ -91,19 +87,15 @@ XXX (showcase with a svn:// file)
Now we can run the buildout and make sure all attempts to dist.plone.org fails:: Now we can run the buildout and make sure all attempts to dist.plone.org fails::
>>> print_(system(buildout)) >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/allowdemo' Develop: '/sample-buildout/allowdemo'
Installing eggs. Installing eggs...
<BLANKLINE>
Link to http://dist.plone.org ***BLOCKED*** by --allow-hosts Link to http://dist.plone.org ***BLOCKED*** by --allow-hosts
<BLANKLINE> ...
Couldn't find index page for 'kss.core' (maybe misspelled?)
Getting distribution for 'kss.core'.
While: While:
Installing eggs. Installing eggs.
Getting distribution for 'kss.core'. Getting distribution for 'kss.core'.
Error: Couldn't find a distribution for 'kss.core'. Error: Couldn't find a distribution for 'kss.core'.
<BLANKLINE>
Test for issues Test for issues
--------------- ---------------
...@@ -121,15 +113,14 @@ Test for 1.0.5 breakage as in https://bugs.launchpad.net/zc.buildout/+bug/239212 ...@@ -121,15 +113,14 @@ Test for 1.0.5 breakage as in https://bugs.launchpad.net/zc.buildout/+bug/239212
... eggs=zc.buildout ... eggs=zc.buildout
... interpreter=python ... interpreter=python
... ''') ... ''')
>>> print_('XX'; print system(buildout)) # doctest: +ELLIPSIS >>> print_('XX'); print_(system(buildout), end='') # doctest: +ELLIPSIS
X... X...
Unused options for buildout: 'foo'. Unused options for buildout: 'foo'.
Installing python. Installing python.
Generated script '/sample-buildout/bin/buildout'. Generated script '/sample-buildout/bin/buildout'.
Generated interpreter '/sample-buildout/bin/python'. Generated interpreter '/sample-buildout/bin/python'.
<BLANKLINE>
The bug 239212 above would have got us an *AttributeError* on *buildout._allow_hosts*. The bug 239212 above would have got us an *AttributeError* on
This was fixed in this changeset: *buildout._allow_hosts*. This was fixed in this changeset:
http://svn.zope.org/zc.buildout/trunk/src/zc/buildout/buildout.py?rev=87309&r1=87277&r2=87309 http://svn.zope.org/zc.buildout/trunk/src/zc/buildout/buildout.py?rev=87309&r1=87277&r2=87309
...@@ -20,7 +20,7 @@ Make sure the bootstrap script actually works:: ...@@ -20,7 +20,7 @@ Make sure the bootstrap script actually works::
... parts = ... parts =
... ''') ... ''')
>>> write('bootstrap.py', open(bootstrap_py).read()) >>> write('bootstrap.py', open(bootstrap_py).read())
>>> print_('X'; print system( >>> print_('X'); print_(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+ ... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py')); print_('X') # doctest: +ELLIPSIS ... 'bootstrap.py')); print_('X') # doctest: +ELLIPSIS
X... X...
......
...@@ -82,11 +82,10 @@ buildout to see where the egg comes from this time. ...@@ -82,11 +82,10 @@ buildout to see where the egg comes from this time.
... for egg in glob(join(sample_buildout, 'eggs', 'demoneeded*.egg')): ... for egg in glob(join(sample_buildout, 'eggs', 'demoneeded*.egg')):
... remove(sample_buildout, 'eggs', egg) ... remove(sample_buildout, 'eggs', egg)
>>> remove_demoneeded_egg() >>> remove_demoneeded_egg()
>>> print_(system(buildout), end='') >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/depdemo' Develop: '/sample-buildout/depdemo'
Updating eggs. Updating eggs.
Couldn't find index page for 'demoneeded' (maybe misspelled?) ...
Getting distribution for 'demoneeded'.
While: While:
Updating eggs. Updating eggs.
Getting distribution for 'demoneeded'. Getting distribution for 'demoneeded'.
......
...@@ -23,6 +23,7 @@ import os ...@@ -23,6 +23,7 @@ import os
import os.path import os.path
import re import re
import shutil import shutil
import sys
import tempfile import tempfile
import urllib.request, urllib.parse, urllib.error import urllib.request, urllib.parse, urllib.error
import urllib.parse import urllib.parse
...@@ -183,7 +184,7 @@ class Download(object): ...@@ -183,7 +184,7 @@ class Download(object):
e = sys.exc_info()[1] e = sys.exc_info()[1]
os.remove(tmp_path) os.remove(tmp_path)
raise zc.buildout.UserError("Error downloading extends for URL " raise zc.buildout.UserError("Error downloading extends for URL "
"%s: %r" % (url, e[1:3])) "%s: %s" % (url, e))
except Exception: except Exception:
os.remove(tmp_path) os.remove(tmp_path)
raise raise
...@@ -201,7 +202,7 @@ class Download(object): ...@@ -201,7 +202,7 @@ class Download(object):
""" """
if self.hash_name: if self.hash_name:
return md5(url).hexdigest() return md5(url.encode()).hexdigest()
else: else:
if re.match(r"^[A-Za-z]:\\", url): if re.match(r"^[A-Za-z]:\\", url):
url = 'file:' + url url = 'file:' + url
......
...@@ -75,13 +75,13 @@ We can also have the downloaded file's MD5 sum checked: ...@@ -75,13 +75,13 @@ We can also have the downloaded file's MD5 sum checked:
... except ImportError: from md5 import new as md5 ... except ImportError: from md5 import new as md5
>>> path, is_temp = download(server_url+'foo.txt', >>> path, is_temp = download(server_url+'foo.txt',
... md5('This is a foo text.').hexdigest()) ... md5('This is a foo text.'.encode()).hexdigest())
>>> is_temp >>> is_temp
True True
>>> remove(path) >>> remove(path)
>>> download(server_url+'foo.txt', >>> download(server_url+'foo.txt',
... md5('The wrong text.').hexdigest()) ... md5('The wrong text.'.encode()).hexdigest())
Traceback (most recent call last): Traceback (most recent call last):
ChecksumError: MD5 checksum mismatch downloading 'http://localhost/foo.txt' ChecksumError: MD5 checksum mismatch downloading 'http://localhost/foo.txt'
...@@ -89,11 +89,11 @@ The error message in the event of an MD5 checksum mismatch for a local file ...@@ -89,11 +89,11 @@ The error message in the event of an MD5 checksum mismatch for a local file
reads somewhat differently: reads somewhat differently:
>>> download(join(server_data, 'foo.txt'), >>> download(join(server_data, 'foo.txt'),
... md5('This is a foo text.').hexdigest()) ... md5('This is a foo text.'.encode()).hexdigest())
('/sample_files/foo.txt', False) ('/sample_files/foo.txt', False)
>>> download(join(server_data, 'foo.txt'), >>> download(join(server_data, 'foo.txt'),
... md5('The wrong text.').hexdigest()) ... md5('The wrong text.'.encode()).hexdigest())
Traceback (most recent call last): Traceback (most recent call last):
ChecksumError: MD5 checksum mismatch for local resource at '/sample_files/foo.txt'. ChecksumError: MD5 checksum mismatch for local resource at '/sample_files/foo.txt'.
...@@ -168,7 +168,7 @@ This is a foo text. ...@@ -168,7 +168,7 @@ This is a foo text.
If we specify an MD5 checksum for a file that is already in the cache, the If we specify an MD5 checksum for a file that is already in the cache, the
cached copy's checksum will be verified: cached copy's checksum will be verified:
>>> download(server_url+'foo.txt', md5('The wrong text.').hexdigest()) >>> download(server_url+'foo.txt', md5('The wrong text.'.encode()).hexdigest())
Traceback (most recent call last): Traceback (most recent call last):
ChecksumError: MD5 checksum mismatch for cached download ChecksumError: MD5 checksum mismatch for cached download
from 'http://localhost/foo.txt' at '/download-cache/foo.txt' from 'http://localhost/foo.txt' at '/download-cache/foo.txt'
...@@ -247,7 +247,7 @@ This is a foo text. ...@@ -247,7 +247,7 @@ This is a foo text.
However, resources with checksum mismatches will not be copied to the cache: However, resources with checksum mismatches will not be copied to the cache:
>>> download(server_url+'foo.txt', md5('The wrong text.').hexdigest()) >>> download(server_url+'foo.txt', md5('The wrong text.'.encode()).hexdigest())
Traceback (most recent call last): Traceback (most recent call last):
ChecksumError: MD5 checksum mismatch downloading 'http://localhost/foo.txt' ChecksumError: MD5 checksum mismatch downloading 'http://localhost/foo.txt'
>>> ls(cache) >>> ls(cache)
...@@ -256,9 +256,11 @@ ChecksumError: MD5 checksum mismatch downloading 'http://localhost/foo.txt' ...@@ -256,9 +256,11 @@ ChecksumError: MD5 checksum mismatch downloading 'http://localhost/foo.txt'
If the file is completely missing it should notify the user of the error: If the file is completely missing it should notify the user of the error:
>>> download(server_url+'bar.txt') >>> download(server_url+'bar.txt') # doctest: +NORMALIZE_WHITESPACE
Traceback (most recent call last): Traceback (most recent call last):
UserError: Error downloading extends for URL http://localhost/bar.txt: (404, 'Not Found') ...
UserError: Error downloading extends for URL http://localhost/bar.txt:
HTTP Error 404: Not Found
>>> ls(cache) >>> ls(cache)
Finally, let's see what happens if the download cache to be used doesn't exist Finally, let's see what happens if the download cache to be used doesn't exist
...@@ -344,7 +346,8 @@ checksum since we don't know which port the server happens to listen at when ...@@ -344,7 +346,8 @@ checksum since we don't know which port the server happens to listen at when
the test is run, so we don't actually know the full URL of the file. Let's the test is run, so we don't actually know the full URL of the file. Let's
check that the checksum actually belongs to the particular URL used: check that the checksum actually belongs to the particular URL used:
>>> path.lower() == join(cache, md5(server_url+'foo.txt').hexdigest()).lower() >>> (path.lower() ==
... join(cache, md5((server_url+'foo.txt').encode()).hexdigest()).lower())
True True
The cached copy is used when downloading the file again: The cached copy is used when downloading the file again:
...@@ -366,7 +369,9 @@ cache under a different name: ...@@ -366,7 +369,9 @@ cache under a different name:
/download-cache/537b6d73267f8f4447586989af8c470e /download-cache/537b6d73267f8f4447586989af8c470e
>>> path == path2 >>> path == path2
False False
>>> path2.lower() == join(cache, md5(server_url+'other/foo.txt').hexdigest()).lower() >>> (path2.lower() ==
... join(cache, md5((server_url+'other/foo.txt').encode()).hexdigest()
... ).lower())
True True
>>> cat(path) >>> cat(path)
This is a foo text. This is a foo text.
...@@ -446,7 +451,7 @@ When trying to download a resource whose checksum does not match, the cached ...@@ -446,7 +451,7 @@ When trying to download a resource whose checksum does not match, the cached
copy will neither be used nor overwritten: copy will neither be used nor overwritten:
>>> write(server_data, 'foo.txt', 'This is a foo text.') >>> write(server_data, 'foo.txt', 'This is a foo text.')
>>> download(server_url+'foo.txt', md5('The wrong text.').hexdigest()) >>> download(server_url+'foo.txt', md5('The wrong text.'.encode()).hexdigest())
Traceback (most recent call last): Traceback (most recent call last):
ChecksumError: MD5 checksum mismatch downloading 'http://localhost/foo.txt' ChecksumError: MD5 checksum mismatch downloading 'http://localhost/foo.txt'
>>> cat(cache, 'foo.txt') >>> cat(cache, 'foo.txt')
...@@ -539,9 +544,10 @@ conversions: ...@@ -539,9 +544,10 @@ conversions:
>>> text = 'First line of text.\r\nSecond line.\r\n' >>> text = 'First line of text.\r\nSecond line.\r\n'
>>> f = open(join(server_data, 'foo.txt'), 'wb') >>> f = open(join(server_data, 'foo.txt'), 'wb')
>>> f.write(text) >>> _ = f.write(text.encode())
>>> f.close() >>> f.close()
>>> path, is_temp = Download()(server_url+'foo.txt', md5(text).hexdigest()) >>> path, is_temp = Download()(server_url+'foo.txt',
... md5(text.encode()).hexdigest())
>>> remove(path) >>> remove(path)
When "downloading" a directory given by file-system path or ``file:`` URL and When "downloading" a directory given by file-system path or ``file:`` URL and
......
...@@ -22,7 +22,7 @@ To see how this works, we'll create two versions of a recipe egg: ...@@ -22,7 +22,7 @@ To see how this works, we'll create two versions of a recipe egg:
>>> write('recipe', 'recipe.py', >>> write('recipe', 'recipe.py',
... ''' ... '''
... import sys ... import sys
... print_ = lambda *a: sys.stdout.write(' '.join(map(str, a))+'\n') ... print_ = lambda *a: sys.stdout.write(' '.join(map(str, a))+'\\n')
... class Recipe: ... class Recipe:
... def __init__(*a): pass ... def __init__(*a): pass
... def install(self): ... def install(self):
...@@ -50,7 +50,7 @@ To see how this works, we'll create two versions of a recipe egg: ...@@ -50,7 +50,7 @@ To see how this works, we'll create two versions of a recipe egg:
>>> write('recipe', 'recipe.py', >>> write('recipe', 'recipe.py',
... ''' ... '''
... import sys ... import sys
... print_ = lambda *a: sys.stdout.write(' '.join(map(str, a))+'\n') ... print_ = lambda *a: sys.stdout.write(' '.join(map(str, a))+'\\n')
... class Recipe: ... class Recipe:
... def __init__(*a): pass ... def __init__(*a): pass
... def install(self): ... def install(self):
......
...@@ -18,7 +18,7 @@ To illustrate this, we'll create a package in a sample buildout: ...@@ -18,7 +18,7 @@ To illustrate this, we'll create a package in a sample buildout:
>>> mkdir('hello') >>> mkdir('hello')
>>> write('hello', 'hello.py', >>> write('hello', 'hello.py',
... 'import sys; sys.stdout.write("Hello World!\n")\n') ... 'import sys; sys.stdout.write("Hello World!\\n")\n')
>>> write('hello', 'README', 'This is hello') >>> write('hello', 'README', 'This is hello')
>>> write('hello', 'setup.py', >>> write('hello', 'setup.py',
... """ ... """
......
This diff is collapsed.
...@@ -35,7 +35,7 @@ zc.buildout used: ...@@ -35,7 +35,7 @@ zc.buildout used:
... """ ... """
... import pkg_resources ... import pkg_resources
... import sys ... import sys
... print_ = lambda *a: sys.stdout.write(' '.join(map(str, a))+'\n') ... print_ = lambda *a: sys.stdout.write(' '.join(map(str, a))+'\\n')
... ...
... class Recipe: ... class Recipe:
... ...
...@@ -66,15 +66,18 @@ Now if we run the buildout, the buildout will upgrade itself to the ...@@ -66,15 +66,18 @@ Now if we run the buildout, the buildout will upgrade itself to the
new versions found in new releases: new versions found in new releases:
>>> print_(system(buildout), end='') >>> print_(system(buildout), end='')
Getting distribution for 'zc.buildout'.
Got zc.buildout 99.99.
Getting distribution for 'distribute'. Getting distribution for 'distribute'.
Got distribute 99.99. Got distribute 99.99.
Upgraded: Upgraded:
zc.buildout version 99.99,
distribute version 99.99; distribute version 99.99;
restarting. restarting.
Generated script '/sample-buildout/bin/buildout'. Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/showversions' Develop: '/sample-buildout/showversions'
Installing show-versions. Installing show-versions.
zc.buildout 1.4.4 zc.buildout 99.99
distribute 99.99 distribute 99.99
Our buildout script has been updated to use the new eggs: Our buildout script has been updated to use the new eggs:
...@@ -84,7 +87,7 @@ Our buildout script has been updated to use the new eggs: ...@@ -84,7 +87,7 @@ Our buildout script has been updated to use the new eggs:
<BLANKLINE> <BLANKLINE>
import sys import sys
sys.path[0:0] = [ sys.path[0:0] = [
'/sample-buildout/eggs/zc.buildout-1.4.4-py2.4.egg', '/sample-buildout/eggs/zc.buildout-99.99-py2.4.egg',
'/sample-buildout/eggs/distribute-99.99-py2.4.egg', '/sample-buildout/eggs/distribute-99.99-py2.4.egg',
] ]
<BLANKLINE> <BLANKLINE>
...@@ -115,6 +118,7 @@ Now we can see that we actually "upgrade" to an earlier version. ...@@ -115,6 +118,7 @@ Now we can see that we actually "upgrade" to an earlier version.
>>> print_(system(buildout), end='') >>> print_(system(buildout), end='')
Upgraded: Upgraded:
zc.buildout version 1.4.4;
distribute version 0.6; distribute version 0.6;
restarting. restarting.
Generated script '/sample-buildout/bin/buildout'. Generated script '/sample-buildout/bin/buildout'.
...@@ -140,7 +144,7 @@ We won't upgrade in offline mode: ...@@ -140,7 +144,7 @@ We won't upgrade in offline mode:
... recipe = showversions ... recipe = showversions
... """ % dict(new_releases=new_releases)) ... """ % dict(new_releases=new_releases))
>>> print_(system(buildout+' -o'), ed='') >>> print_(system(buildout+' -o'), end='')
Develop: '/sample-buildout/showversions' Develop: '/sample-buildout/showversions'
Updating show-versions. Updating show-versions.
zc.buildout 1.0.0 zc.buildout 1.0.0
...@@ -173,6 +177,8 @@ directory: ...@@ -173,6 +177,8 @@ directory:
Creating directory '/sample_buildout2/parts'. Creating directory '/sample_buildout2/parts'.
Creating directory '/sample_buildout2/eggs'. Creating directory '/sample_buildout2/eggs'.
Creating directory '/sample_buildout2/develop-eggs'. Creating directory '/sample_buildout2/develop-eggs'.
Getting distribution for 'zc.buildout'.
Got zc.buildout 99.99.
Getting distribution for 'distribute'. Getting distribution for 'distribute'.
Got distribute 99.99. Got distribute 99.99.
Not upgrading because not running a local buildout command. Not upgrading because not running a local buildout command.
......
...@@ -25,7 +25,7 @@ index ...@@ -25,7 +25,7 @@ index
We have a link server that has a number of distributions: We have a link server that has a number of distributions:
>>> print get(link_server), >>> print_(get(link_server), end='')
<html><body> <html><body>
<a href="bigdemo-0.1-py2.3.egg">bigdemo-0.1-py2.3.egg</a><br> <a href="bigdemo-0.1-py2.3.egg">bigdemo-0.1-py2.3.egg</a><br>
<a href="demo-0.1-py2.3.egg">demo-0.1-py2.3.egg</a><br> <a href="demo-0.1-py2.3.egg">demo-0.1-py2.3.egg</a><br>
...@@ -62,7 +62,7 @@ specified where to find distributions using the find-links option. ...@@ -62,7 +62,7 @@ specified where to find distributions using the find-links option.
Let's run the buildout: Let's run the buildout:
>>> import os >>> import os
>>> print system(buildout), >>> print_(system(buildout), end='')
Installing demo. Installing demo.
Getting distribution for 'demo<0.3'. Getting distribution for 'demo<0.3'.
Got demo 0.2. Got demo 0.2.
...@@ -106,7 +106,7 @@ scripts recipe: ...@@ -106,7 +106,7 @@ scripts recipe:
... index = %(server)s/index ... index = %(server)s/index
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Uninstalling demo. Uninstalling demo.
Installing demo. Installing demo.
Generated script '/sample-buildout/bin/demo'. Generated script '/sample-buildout/bin/demo'.
...@@ -186,7 +186,7 @@ Note that we ommitted the entry point name from the recipe ...@@ -186,7 +186,7 @@ Note that we ommitted the entry point name from the recipe
specification. We were able to do this because the scripts recipe is specification. We were able to do this because the scripts recipe is
the default entry point for the zc.recipe.egg egg. the default entry point for the zc.recipe.egg egg.
>>> print system(buildout), >>> print_(system(buildout), end='')
Uninstalling demo. Uninstalling demo.
Installing demo. Installing demo.
Generated script '/sample-buildout/bin/demo'. Generated script '/sample-buildout/bin/demo'.
...@@ -203,20 +203,20 @@ This is useful for debugging and testing. ...@@ -203,20 +203,20 @@ This is useful for debugging and testing.
If we run the demo script, it prints out some minimal data: If we run the demo script, it prints out some minimal data:
>>> print system(join(sample_buildout, 'bin', 'demo')), >>> print_(system(join(sample_buildout, 'bin', 'demo')), end='')
2 2 2 2
The value it prints out happens to be some values defined in the The value it prints out happens to be some values defined in the
modules installed. modules installed.
We can also run the py-demo script. Here we'll just print out We can also run the py-demo script. Here we'll just print_(out)
the bits if the path added to reflect the eggs: the bits if the path added to reflect the eggs:
>>> print system(join(sample_buildout, 'bin', 'py-demo'), >>> print_(system(join(sample_buildout, 'bin', 'py-demo'), end='')
... """import os, sys ... """import os, sys
... for p in sys.path: ... for p in sys.path:
... if 'demo' in p: ... if 'demo' in p:
... print os.path.basename(p) ... print_(os.path.basename(p))
... ...
... """).replace('>>> ', '').replace('... ', ''), ... """).replace('>>> ', '').replace('... ', ''),
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE ... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
...@@ -244,7 +244,7 @@ remove the restriction on demo: ...@@ -244,7 +244,7 @@ remove the restriction on demo:
and run the buildout in non-newest mode: and run the buildout in non-newest mode:
>>> print system(buildout+' -N'), >>> print_(system(buildout+' -N'), end='')
Uninstalling demo. Uninstalling demo.
Installing demo. Installing demo.
Generated script '/sample-buildout/bin/demo'. Generated script '/sample-buildout/bin/demo'.
...@@ -255,7 +255,7 @@ reinstalled. ...@@ -255,7 +255,7 @@ reinstalled.
We'll also run the buildout in off-line mode: We'll also run the buildout in off-line mode:
>>> print system(buildout+' -o'), >>> print_(system(buildout+' -o'), end='')
Updating demo. Updating demo.
We didn't get an update for demo: We didn't get an update for demo:
...@@ -269,7 +269,7 @@ We didn't get an update for demo: ...@@ -269,7 +269,7 @@ We didn't get an update for demo:
If we run the buildout on the default online and newest modes, If we run the buildout on the default online and newest modes,
we'll get an update for demo: we'll get an update for demo:
>>> print system(buildout), >>> print_(system(buildout), end='')
Updating demo. Updating demo.
Getting distribution for 'demo'. Getting distribution for 'demo'.
Got demo 0.4c1. Got demo 0.4c1.
...@@ -286,7 +286,7 @@ Then we'll get a new demo egg: ...@@ -286,7 +286,7 @@ Then we'll get a new demo egg:
The script is updated too: The script is updated too:
>>> print system(join(sample_buildout, 'bin', 'demo')), >>> print_(system(join(sample_buildout, 'bin', 'demo')), end='')
4 2 4 2
Controlling script generation Controlling script generation
...@@ -309,7 +309,7 @@ arguments: ...@@ -309,7 +309,7 @@ arguments:
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Uninstalling demo. Uninstalling demo.
Installing demo. Installing demo.
...@@ -330,7 +330,7 @@ You can also control the name used for scripts: ...@@ -330,7 +330,7 @@ You can also control the name used for scripts:
... scripts = demo=foo ... scripts = demo=foo
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Uninstalling demo. Uninstalling demo.
Installing demo. Installing demo.
Generated script '/sample-buildout/bin/foo'. Generated script '/sample-buildout/bin/foo'.
...@@ -360,7 +360,7 @@ extra-paths option: ...@@ -360,7 +360,7 @@ extra-paths option:
... ${buildout:directory}/spam ... ${buildout:directory}/spam
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Uninstalling demo. Uninstalling demo.
Installing demo. Installing demo.
Generated script '/sample-buildout/bin/foo'. Generated script '/sample-buildout/bin/foo'.
...@@ -407,7 +407,7 @@ breaking scripts. ...@@ -407,7 +407,7 @@ breaking scripts.
... ${buildout:directory}/spam ... ${buildout:directory}/spam
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Uninstalling demo. Uninstalling demo.
Installing demo. Installing demo.
Generated script '/sample-buildout/bin/foo'. Generated script '/sample-buildout/bin/foo'.
...@@ -456,7 +456,7 @@ each individual script section: ...@@ -456,7 +456,7 @@ each individual script section:
... ${buildout:directory}/spam ... ${buildout:directory}/spam
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Uninstalling demo. Uninstalling demo.
Installing demo. Installing demo.
Generated script '/sample-buildout/bin/foo'. Generated script '/sample-buildout/bin/foo'.
...@@ -509,7 +509,7 @@ to be included in generated scripts: ...@@ -509,7 +509,7 @@ to be included in generated scripts:
... arguments = a, 2 ... arguments = a, 2
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Uninstalling demo. Uninstalling demo.
Installing demo. Installing demo.
Generated script '/sample-buildout/bin/foo'. Generated script '/sample-buildout/bin/foo'.
...@@ -559,7 +559,7 @@ declare entry points using the entry-points option: ...@@ -559,7 +559,7 @@ declare entry points using the entry-points option:
... entry-points = alt=eggrecipedemo:alt other=foo.bar:a.b.c ... entry-points = alt=eggrecipedemo:alt other=foo.bar:a.b.c
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Uninstalling demo. Uninstalling demo.
Installing demo. Installing demo.
Generated script '/sample-buildout/bin/demo'. Generated script '/sample-buildout/bin/demo'.
...@@ -606,7 +606,7 @@ generate all scripts in required packages: ...@@ -606,7 +606,7 @@ generate all scripts in required packages:
... index = %(server)s/index ... index = %(server)s/index
... dependent-scripts = true ... dependent-scripts = true
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout+' -N'), >>> print_(system(buildout+' -N'), end='')
Uninstalling demo. Uninstalling demo.
Installing bigdemo. Installing bigdemo.
Getting distribution for 'bigdemo'. Getting distribution for 'bigdemo'.
...@@ -631,7 +631,7 @@ be made to contact an index server: ...@@ -631,7 +631,7 @@ be made to contact an index server:
... scripts = demo=foo ... scripts = demo=foo
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Uninstalling bigdemo. Uninstalling bigdemo.
Installing demo. Installing demo.
Generated script '/sample-buildout/bin/foo'. Generated script '/sample-buildout/bin/foo'.
...@@ -17,9 +17,12 @@ around the egg recipe: ...@@ -17,9 +17,12 @@ around the egg recipe:
>>> mkdir(sample_buildout, 'sample') >>> mkdir(sample_buildout, 'sample')
>>> write(sample_buildout, 'sample', 'sample.py', >>> write(sample_buildout, 'sample', 'sample.py',
... """ ... """
... import logging, os ... import logging, os, sys
... import zc.recipe.egg ... import zc.recipe.egg
... ...
... def print_(*args):
... sys.stdout.write(' '.join(map(str, args)))
...
... class Sample: ... class Sample:
... ...
... def __init__(self, buildout, name, options): ... def __init__(self, buildout, name, options):
...@@ -30,14 +33,14 @@ around the egg recipe: ...@@ -30,14 +33,14 @@ around the egg recipe:
... def install(self): ... def install(self):
... extras = self.options['extras'].split() ... extras = self.options['extras'].split()
... requirements, ws = self.egg.working_set(extras) ... requirements, ws = self.egg.working_set(extras)
... print 'Part:', self.name ... print_('Part:', self.name)
... print 'Egg requirements:' ... print_('Egg requirements:')
... for r in requirements: ... for r in requirements:
... print r ... print_(r)
... print 'Working set:' ... print_('Working set:')
... for d in ws: ... for d in ws:
... print d ... print_(d)
... print 'extra paths:', self.egg.extra_paths ... print_('extra paths:', self.egg.extra_paths)
... return () ... return ()
... ...
... update = install ... update = install
...@@ -81,7 +84,7 @@ of extra requirements to be included in the working set. ...@@ -81,7 +84,7 @@ of extra requirements to be included in the working set.
>>> import os >>> import os
>>> os.chdir(sample_buildout) >>> os.chdir(sample_buildout)
>>> buildout = os.path.join(sample_buildout, 'bin', 'buildout') >>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
>>> print system(buildout + ' -q'), >>> print_(system(buildout + ' -q'), end='')
Part: sample-part Part: sample-part
Egg requirements: Egg requirements:
demo<0.3 demo<0.3
...@@ -139,7 +142,7 @@ If we use the extra-paths option: ...@@ -139,7 +142,7 @@ If we use the extra-paths option:
Then we'll see that reflected in the extra_paths attribute in the egg Then we'll see that reflected in the extra_paths attribute in the egg
recipe instance: recipe instance:
>>> print system(buildout + ' -q'), >>> print_(system(buildout + ' -q'), end='')
Part: sample-part Part: sample-part
Egg requirements: Egg requirements:
demo<0.3 demo<0.3
......
...@@ -131,7 +131,7 @@ the egg: ...@@ -131,7 +131,7 @@ the egg:
... ...
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Installing extdemo. Installing extdemo.
zip_safe flag not set; analyzing archive contents... zip_safe flag not set; analyzing archive contents...
...@@ -156,9 +156,11 @@ Let's define a script that uses out ext demo: ...@@ -156,9 +156,11 @@ Let's define a script that uses out ext demo:
>>> mkdir('demo') >>> mkdir('demo')
>>> write('demo', 'demo.py', >>> write('demo', 'demo.py',
... """ ... """
... import extdemo ... import extdemo, sys
... def print_(*args):
... sys.stdout.write(' '.join(map(str, args)))
... def main(): ... def main():
... print extdemo.val ... print_(extdemo.val)
... """) ... """)
>>> write('demo', 'setup.py', >>> write('demo', 'setup.py',
...@@ -187,7 +189,7 @@ Let's define a script that uses out ext demo: ...@@ -187,7 +189,7 @@ Let's define a script that uses out ext demo:
... entry-points = demo=demo:main ... entry-points = demo=demo:main
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Develop: '/sample-buildout/demo' Develop: '/sample-buildout/demo'
Updating extdemo. Updating extdemo.
Installing demo. Installing demo.
...@@ -195,7 +197,7 @@ Let's define a script that uses out ext demo: ...@@ -195,7 +197,7 @@ Let's define a script that uses out ext demo:
When we run the script, we'll 42 printed: When we run the script, we'll 42 printed:
>>> print system(join('bin', 'demo')), >>> print_(system(join('bin', 'demo')), end='')
42 42
Updating Updating
...@@ -210,12 +212,12 @@ distribution for extdemo: ...@@ -210,12 +212,12 @@ distribution for extdemo:
If we run the buildout in non-newest or offline modes: If we run the buildout in non-newest or offline modes:
>>> print system(buildout+' -N'), >>> print_(system(buildout+' -N'), end='')
Develop: '/sample-buildout/demo' Develop: '/sample-buildout/demo'
Updating extdemo. Updating extdemo.
Updating demo. Updating demo.
>>> print system(buildout+' -o'), >>> print_(system(buildout+' -o'), end='')
Develop: '/sample-buildout/demo' Develop: '/sample-buildout/demo'
Updating extdemo. Updating extdemo.
Updating demo. Updating demo.
...@@ -231,7 +233,7 @@ But if we run the buildout in the default on-line and newest modes, we ...@@ -231,7 +233,7 @@ But if we run the buildout in the default on-line and newest modes, we
will. This time we also get the test-variable message again, because the new will. This time we also get the test-variable message again, because the new
version is imported: version is imported:
>>> print system(buildout), >>> print_(system(buildout), end='')
Develop: '/sample-buildout/demo' Develop: '/sample-buildout/demo'
Updating extdemo. Updating extdemo.
zip_safe flag not set; analyzing archive contents... zip_safe flag not set; analyzing archive contents...
...@@ -269,7 +271,7 @@ We can specify a specific version using the egg option: ...@@ -269,7 +271,7 @@ We can specify a specific version using the egg option:
... entry-points = demo=demo:main ... entry-points = demo=demo:main
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout+' -D'), >>> print_(system(buildout+' -D'), end='')
Develop: '/sample-buildout/demo' Develop: '/sample-buildout/demo'
Uninstalling demo. Uninstalling demo.
Uninstalling extdemo. Uninstalling extdemo.
...@@ -345,7 +347,7 @@ Create our buildout: ...@@ -345,7 +347,7 @@ Create our buildout:
... recipe = recipes:environ ... recipe = recipes:environ
... ...
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes' Develop: '/sample-buildout/recipes'
Uninstalling demo. Uninstalling demo.
Uninstalling extdemo. Uninstalling extdemo.
...@@ -365,7 +367,7 @@ the original value will be restored: ...@@ -365,7 +367,7 @@ the original value will be restored:
>>> import os >>> import os
>>> os.environ['test-variable'] = 'bar' >>> os.environ['test-variable'] = 'bar'
>>> print system(buildout), >>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes' Develop: '/sample-buildout/recipes'
Updating extdemo. Updating extdemo.
Updating checkenv. Updating checkenv.
...@@ -399,7 +401,7 @@ are interpolated with os.environ before the're set: ...@@ -399,7 +401,7 @@ are interpolated with os.environ before the're set:
... recipe = recipes:environ ... recipe = recipes:environ
... ...
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes' Develop: '/sample-buildout/recipes'
Uninstalling extdemo. Uninstalling extdemo.
Installing extdemo. Installing extdemo.
...@@ -428,7 +430,7 @@ Create a clean buildout.cfg w/o the checkenv recipe, and delete the recipe: ...@@ -428,7 +430,7 @@ Create a clean buildout.cfg w/o the checkenv recipe, and delete the recipe:
... include-dirs = include ... include-dirs = include
... ...
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
>>> print system(buildout), >>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes' Develop: '/sample-buildout/recipes'
Uninstalling checkenv. Uninstalling checkenv.
Uninstalling extdemo. Uninstalling extdemo.
...@@ -529,7 +531,7 @@ Note that we added a define option to cause the preprocessor variable ...@@ -529,7 +531,7 @@ Note that we added a define option to cause the preprocessor variable
TWO to be defined. This will cause the module-variable, 'val', to be TWO to be defined. This will cause the module-variable, 'val', to be
set with a value of 2. set with a value of 2.
>>> print system(buildout), >>> print_(system(buildout), end='')
Develop: '/sample-buildout/demo' Develop: '/sample-buildout/demo'
Uninstalling extdemo. Uninstalling extdemo.
Installing extdemo. Installing extdemo.
...@@ -558,5 +560,5 @@ and the extdemo now has a built extension: ...@@ -558,5 +560,5 @@ and the extdemo now has a built extension:
Because develop eggs take precedence over non-develop eggs, the demo Because develop eggs take precedence over non-develop eggs, the demo
script will use the new develop egg: script will use the new develop egg:
>>> print system(join('bin', 'demo')), >>> print_(system(join('bin', 'demo')), end='')
2 2
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment