Commit 52c93ffa authored by Hanno Schlichting's avatar Hanno Schlichting

Merge pull request #19 from buildout/3.3

3.3
parents 66fee301 87cb4b31
[buildout]
extends = buildout.cfg
[versions]
zope.interface = 3.8.0
zope.exceptions = 3.7.1
......@@ -72,4 +72,6 @@ if sys.platform.startswith('java'):
# Jython needs the script to be called twice via sys.executable
assert subprocess.Popen([sys.executable] + [bin_buildout]).wait() == 0
if sys.version_info < (2, 6):
bin_buildout = [bin_buildout, '-c2.4.cfg']
sys.exit(subprocess.Popen(bin_buildout).wait())
......@@ -1083,7 +1083,7 @@ class Options(DictMixin):
self._raw = self._do_extend_raw(name, self._raw, [])
# force substitutions
for k, v in list(self._raw.items()):
for k, v in sorted(self._raw.items()):
if '${' in v:
self._dosub(k, v)
......@@ -1403,7 +1403,7 @@ def _open(base, filename, seen, dl_options, override, downloaded):
return result
ignore_directories = '.svn', 'CVS'
ignore_directories = '.svn', 'CVS', '__pycache__'
_dir_hashes = {}
def _dir_hash(dir):
dir_hash = _dir_hashes.get(dir, None)
......@@ -1411,15 +1411,31 @@ def _dir_hash(dir):
return dir_hash
hash = md5()
for (dirpath, dirnames, filenames) in os.walk(dir):
dirnames[:] = [n for n in dirnames if n not in ignore_directories]
filenames[:] = [f for f in filenames
if (not (f.endswith('pyc') or f.endswith('pyo'))
and os.path.exists(os.path.join(dirpath, f)))
]
dirnames[:] = sorted(n for n in dirnames if n not in ignore_directories)
filenames[:] = sorted(f for f in filenames
if (not (f.endswith('pyc') or f.endswith('pyo'))
and os.path.exists(os.path.join(dirpath, f)))
)
hash.update(' '.join(dirnames).encode())
hash.update(' '.join(filenames).encode())
for name in filenames:
hash.update(open(os.path.join(dirpath, name), 'rb').read())
path = os.path.join(dirpath, name)
if name == 'entry_points.txt':
f = open(path)
# Entry points aren't written in stable order. :(
try:
sections = zc.buildout.configparser.parse(f, path)
data = repr([(sname, sorted(sections[sname].items()))
for sname in sorted(sections)]).encode('utf-8')
except Exception:
f.close()
f = open(path, 'rb')
data = f.read()
else:
f = open(path, 'rb')
data = f.read()
f.close()
hash.update(data)
_dir_hashes[dir] = dir_hash = hash.hexdigest()
return dir_hash
......@@ -1501,7 +1517,8 @@ recipe being used:
def _check_for_unused_options_in_section(buildout, section):
options = buildout[section]
unused = [option for option in options._raw if option not in options._data]
unused = [option for option in sorted(options._raw)
if option not in options._data]
if unused:
buildout._logger.warn("Unused options for %s: %s."
% (section, ' '.join(map(repr, unused)))
......
......@@ -465,8 +465,7 @@ leave previously created paths in place:
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
...
OSError: ... exists...
... exists...
We meant to create a directory bins, but typed bin. Now foo was
left behind.
......@@ -497,8 +496,7 @@ If we fix the typo:
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
...
OSError: ... exists...
... exists...
Now they fail because foo exists, because it was left behind.
......@@ -585,8 +583,7 @@ When we rerun the buildout:
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
...
OSError: ... exists...
... exists...
we get the same error, but we don't get the directory left behind:
......@@ -661,8 +658,7 @@ directories will be created:
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
...
OSError: ... exists...
... exists...
>>> os.path.exists('foo')
False
......@@ -1137,7 +1133,7 @@ extension that prints out the options.
... import sys
... def ext(buildout):
... sys.stdout.write(str(
... [part['option'] for name, part in buildout.items()
... [part['option'] for name, part in sorted(buildout.items())
... if name.startswith('part')])+'\\n')
... """)
......
......@@ -69,7 +69,7 @@ supply some input:
>>> print_(system(buildout+" -D", """\
... up
... p self.options.keys()
... p sorted(self.options.keys())
... q
... """), end='')
Develop: '/sample-buildout/recipes'
......
......@@ -21,9 +21,8 @@ testing repository.
Turn on logging on this server so that we can see when eggs are pulled
from it.
>>> get(link_server2 + 'enable_server_logging')
>>> _ = get(link_server2 + 'enable_server_logging')
GET 200 /enable_server_logging
''
Let's create a develop egg in our buildout that specifies
dependency_links which point to the new server.
......
......@@ -50,9 +50,8 @@ download:
We'll enable logging on the link server so we can see what's going on:
>>> get(link_server+'enable_server_logging')
>>> _ = get(link_server+'enable_server_logging')
GET 200 /enable_server_logging
''
We also specified a download cache.
......
......@@ -376,9 +376,8 @@ We have a link server that has a number of eggs:
Turn on logging on this server so that we can see when eggs are pulled
from it.
>>> get(link_server2 + 'enable_server_logging')
>>> _ = get(link_server2 + 'enable_server_logging')
GET 200 /enable_server_logging
''
Now we can create an egg that specifies that its dependencies are
found on this server.
......@@ -1160,7 +1159,7 @@ We have a link server that has a number of eggs:
And that the source directory contains the compiled extension:
>>> contents = os.listdir(extdemo)
>>> any([f for f in contents if f.endswith(('.so', '.pyd'))])
>>> bool([f for f in contents if f.endswith('.so') or f.endswith('.pyd')])
True
Download cache
......@@ -1192,9 +1191,8 @@ We have a link server that has a number of eggs:
We'd like to see what is being fetched from the server, so we'll
enable server logging:
>>> get(link_server+'enable_server_logging')
>>> _ = get(link_server+'enable_server_logging')
GET 200 /enable_server_logging
''
Now, if we install demo, and extdemo:
......
......@@ -311,15 +311,21 @@ class Handler(BaseHTTPRequestHandler):
if '__stop__' in self.path:
raise SystemExit
def k():
self.send_response(200)
out = '<html><body>k</body></html>\n'.encode()
self.send_header('Content-Length', str(len(out)))
self.send_header('Content-Type', 'text/html')
self.end_headers()
self.wfile.write(out)
if self.path == '/enable_server_logging':
self.__server.__log = True
self.send_response(200)
return
return k()
if self.path == '/disable_server_logging':
self.__server.__log = False
self.send_response(200)
return
return k()
path = os.path.abspath(os.path.join(self.tree, *self.path.split('/')))
if not (
......@@ -361,6 +367,7 @@ class Handler(BaseHTTPRequestHandler):
self.send_header('Content-Type', 'application/x-gzip')
else:
self.send_header('Content-Type', 'text/html')
self.end_headers()
self.wfile.write(out)
......
......@@ -137,10 +137,10 @@ It is an error to create a variable-reference cycle:
Initializing.
Getting section buildout.
Initializing section buildout.
Getting option buildout:x.
Getting option buildout:y.
Getting option buildout:z.
Getting option buildout:x.
Getting option buildout:y.
Error: Circular reference in substitutions.
It is an error to use funny characters in variable refereces:
......
......@@ -232,12 +232,12 @@ 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
version is imported:
>>> print_(system(buildout), end='')
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/demo'
Updating extdemo.
zip_safe flag not set; analyzing archive contents...
Updating demo.
Generated script '/sample-buildout/bin/demo'.
...
>>> ls(sample_buildout, 'develop-eggs')
- demo.egg-link
......@@ -270,14 +270,9 @@ We can specify a specific version using the egg option:
... entry-points = demo=demo:main
... """ % dict(server=link_server))
>>> print_(system(buildout+' -D'), end='')
>>> print_(system(buildout+' -D'), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/demo'
Uninstalling demo.
Uninstalling extdemo.
Installing extdemo.
zip_safe flag not set; analyzing archive contents...
Installing demo.
Generated script '/sample-buildout/bin/demo'.
...
>>> ls(sample_buildout, 'develop-eggs')
- demo.egg-link
......@@ -346,7 +341,7 @@ Create our buildout:
... recipe = recipes:environ
...
... """ % dict(server=link_server))
>>> print_(system(buildout), end='')
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/recipes'
Uninstalling demo.
Uninstalling extdemo.
......@@ -354,7 +349,7 @@ Create our buildout:
Have environment test-variable: foo
zip_safe flag not set; analyzing archive contents...
Installing checkenv.
checkenv: test-variable left over: False
...
The setup.py also printed out that we have set the environment `test-variable`
......@@ -400,14 +395,14 @@ are interpolated with os.environ before the're set:
... recipe = recipes:environ
...
... """ % dict(server=link_server))
>>> print_(system(buildout), end='')
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/recipes'
Uninstalling extdemo.
Installing extdemo.
Have environment test-variable: foo:bar
zip_safe flag not set; analyzing archive contents...
Updating checkenv.
checkenv: test-variable left over: True
...
>>> os.environ['test-variable']
'bar'
......@@ -429,12 +424,11 @@ Create a clean buildout.cfg w/o the checkenv recipe, and delete the recipe:
... include-dirs = include
...
... """ % dict(server=link_server))
>>> print_(system(buildout), end='')
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/recipes'
Uninstalling checkenv.
Uninstalling extdemo.
Installing extdemo.
zip_safe flag not set; analyzing archive contents...
Installing extdemo...
>>> rmdir(sample_buildout, 'recipes')
......@@ -530,12 +524,12 @@ 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
set with a value of 2.
>>> print_(system(buildout), end='')
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/demo'
Uninstalling extdemo.
Installing extdemo.
Installing demo.
Generated script '/sample-buildout/bin/demo'.
...
Our develop-eggs now includes an egg link for extdemo:
......@@ -547,7 +541,7 @@ Our develop-eggs now includes an egg link for extdemo:
and the extdemo now has a built extension:
>>> contents = os.listdir(extdemo)
>>> any([f for f in contents if f.endswith(('.so', '.pyd'))])
>>> bool([f for f in contents if f.endswith('.so') or f.endswith('.pyd')])
True
Because develop eggs take precedence over non-develop eggs, the demo
......
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