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