Commit 6c887abf authored by jim's avatar jim

Merged -r108904:HEAD

svn+ssh://svn.zope.org/repos/main/zc.buildout/branches/gary-1

Lots of good cleanup changes, including making windows tests a bit
more robust.


git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@109502 62d5b8a3-27da-0310-9561-8e5933582275
parent 9c0ebdf3
...@@ -495,7 +495,7 @@ class Installer: ...@@ -495,7 +495,7 @@ class Installer:
if dist is None: if dist is None:
raise zc.buildout.UserError( raise zc.buildout.UserError(
"Couln't download distribution %s." % avail) "Couldn't download distribution %s." % avail)
if dist.precedence == pkg_resources.EGG_DIST: if dist.precedence == pkg_resources.EGG_DIST:
# It's already an egg, just fetch it into the dest # It's already an egg, just fetch it into the dest
...@@ -628,9 +628,9 @@ class Installer: ...@@ -628,9 +628,9 @@ class Installer:
logger.debug('Installing %s.', repr(specs)[1:-1]) logger.debug('Installing %s.', repr(specs)[1:-1])
path = self._path path = self._path
dest = self._dest destination = self._dest
if dest is not None and dest not in path: if destination is not None and destination not in path:
path.insert(0, dest) path.insert(0, destination)
requirements = [self._constrain(pkg_resources.Requirement.parse(spec)) requirements = [self._constrain(pkg_resources.Requirement.parse(spec))
for spec in specs] for spec in specs]
...@@ -661,7 +661,7 @@ class Installer: ...@@ -661,7 +661,7 @@ class Installer:
except pkg_resources.DistributionNotFound, err: except pkg_resources.DistributionNotFound, err:
[requirement] = err [requirement] = err
requirement = self._constrain(requirement) requirement = self._constrain(requirement)
if dest: if destination:
logger.debug('Getting required %r', str(requirement)) logger.debug('Getting required %r', str(requirement))
else: else:
logger.debug('Adding required %r', str(requirement)) logger.debug('Adding required %r', str(requirement))
......
...@@ -492,10 +492,14 @@ def _normalize_path(match): ...@@ -492,10 +492,14 @@ def _normalize_path(match):
path = path[1:] path = path[1:]
return '/' + path.replace(os.path.sep, '/') return '/' + path.replace(os.path.sep, '/')
if sys.platform == 'win32':
sep = r'[\\/]' # Windows uses both sometimes.
else:
sep = re.escape(os.path.sep)
normalize_path = ( normalize_path = (
re.compile( re.compile(
r'''[^'" \t\n\r]+\%(sep)s_[Tt][Ee][Ss][Tt]_\%(sep)s([^"' \t\n\r]+)''' r'''[^'" \t\n\r]+%(sep)s_[Tt][Ee][Ss][Tt]_%(sep)s([^"' \t\n\r]+)'''
% dict(sep=os.path.sep)), % dict(sep=sep)),
_normalize_path, _normalize_path,
) )
......
...@@ -2880,7 +2880,7 @@ def test_suite(): ...@@ -2880,7 +2880,7 @@ def test_suite():
'We have a develop egg: zc.buildout X.X.'), 'We have a develop egg: zc.buildout X.X.'),
(re.compile(r'\\[\\]?'), '/'), (re.compile(r'\\[\\]?'), '/'),
(re.compile('WindowsError'), 'OSError'), (re.compile('WindowsError'), 'OSError'),
(re.compile(r'\[Error 17\] Cannot create a file ' (re.compile(r'\[Error \d+\] Cannot create a file '
r'when that file already exists: '), r'when that file already exists: '),
'[Errno 17] File exists: ' '[Errno 17] File exists: '
), ),
...@@ -2933,6 +2933,7 @@ def test_suite(): ...@@ -2933,6 +2933,7 @@ def test_suite():
(re.compile('extdemo[.]pyd'), 'extdemo.so'), (re.compile('extdemo[.]pyd'), 'extdemo.so'),
(re.compile('[-d] setuptools-\S+[.]egg'), 'setuptools.egg'), (re.compile('[-d] setuptools-\S+[.]egg'), 'setuptools.egg'),
(re.compile(r'\\[\\]?'), '/'), (re.compile(r'\\[\\]?'), '/'),
(re.compile(r'\#!\S+\bpython\S*'), '#!/usr/bin/python'),
]+(sys.version_info < (2, 5) and [ ]+(sys.version_info < (2, 5) and [
(re.compile('.*No module named runpy.*', re.S), ''), (re.compile('.*No module named runpy.*', re.S), ''),
(re.compile('.*usage: pdb.py scriptfile .*', re.S), ''), (re.compile('.*usage: pdb.py scriptfile .*', re.S), ''),
......
...@@ -46,7 +46,7 @@ We have a link server that has a number of distributions: ...@@ -46,7 +46,7 @@ We have a link server that has a number of distributions:
<a href="other-1.0-py2.3.egg">other-1.0-py2.3.egg</a><br> <a href="other-1.0-py2.3.egg">other-1.0-py2.3.egg</a><br>
</body></html> </body></html>
We have a sample buildout. Let's update it's configuration file to We have a sample buildout. Let's update its configuration file to
install the demo package. install the demo package.
>>> write(sample_buildout, 'buildout.cfg', >>> write(sample_buildout, 'buildout.cfg',
...@@ -187,7 +187,7 @@ Let's add an interpreter option: ...@@ -187,7 +187,7 @@ Let's add an interpreter option:
... interpreter = py-demo ... interpreter = py-demo
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
Note that we ommitted the entry point name from the recipe Note that we omitted 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.
......
...@@ -95,6 +95,7 @@ We can see that the options were augmented with additional data ...@@ -95,6 +95,7 @@ We can see that the options were augmented with additional data
computed by the egg recipe by looking at .installed.cfg: computed by the egg recipe by looking at .installed.cfg:
>>> cat(sample_buildout, '.installed.cfg') >>> cat(sample_buildout, '.installed.cfg')
... # doctest: +NORMALIZE_WHITESPACE
[buildout] [buildout]
installed_develop_eggs = /sample-buildout/develop-eggs/sample.egg-link installed_develop_eggs = /sample-buildout/develop-eggs/sample.egg-link
parts = sample-part parts = sample-part
......
...@@ -24,7 +24,7 @@ We have a link server: ...@@ -24,7 +24,7 @@ We have a link server:
<a href="other-1.0-py2.4.egg">other-1.0-py2.4.egg</a><br> <a href="other-1.0-py2.4.egg">other-1.0-py2.4.egg</a><br>
</body></html> </body></html>
We have a sample buildout. Let's update it's configuration file to We have a sample buildout. Let's update its configuration file to
install the demo package using Python 2.4. install the demo package using Python 2.4.
>>> write(sample_buildout, 'buildout.cfg', >>> write(sample_buildout, 'buildout.cfg',
......
...@@ -67,7 +67,7 @@ def test_suite(): ...@@ -67,7 +67,7 @@ def test_suite():
'setuptools-\S+\s+' 'setuptools-\S+\s+'
'zc.buildout-\S+\s*' 'zc.buildout-\S+\s*'
), ),
'__buildout_signature__ = sample- zc.recipe.egg-'), '__buildout_signature__ = sample- zc.recipe.egg-\n'),
(re.compile('executable = [\S ]+python\S*', re.I), (re.compile('executable = [\S ]+python\S*', re.I),
'executable = python'), 'executable = python'),
(re.compile('find-links = http://localhost:\d+/'), (re.compile('find-links = http://localhost:\d+/'),
......
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