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
...@@ -126,7 +126,7 @@ If I need to run a previous version of zc.buildout, I use the ...@@ -126,7 +126,7 @@ If I need to run a previous version of zc.buildout, I use the
`--version` option of the bootstrap.py script:: `--version` option of the bootstrap.py script::
$ python bootstrap.py --version 1.1.3 $ python bootstrap.py --version 1.1.3
The `zc.buildout project <http://svn.zope.org/zc.buildout/trunk>`_ The `zc.buildout project <http://svn.zope.org/zc.buildout/trunk>`_
is a slightly more complex example of this type of buildout. is a slightly more complex example of this type of buildout.
......
...@@ -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.
......
...@@ -15,7 +15,7 @@ To illustrate, we create a sample recipe that is a very thin layer ...@@ -15,7 +15,7 @@ To illustrate, we create a sample recipe that is a very thin layer
around the egg recipe: 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
... import zc.recipe.egg ... import zc.recipe.egg
...@@ -53,7 +53,7 @@ of extra requirements to be included in the working set. ...@@ -53,7 +53,7 @@ of extra requirements to be included in the working set.
>>> write(sample_buildout, 'sample', 'setup.py', >>> write(sample_buildout, 'sample', 'setup.py',
... """ ... """
... from setuptools import setup ... from setuptools import setup
... ...
... setup( ... setup(
... name = "sample", ... name = "sample",
... entry_points = {'zc.buildout': ['default = sample:Sample']}, ... entry_points = {'zc.buildout': ['default = sample:Sample']},
...@@ -95,12 +95,13 @@ We can see that the options were augmented with additional data ...@@ -95,12 +95,13 @@ 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
<BLANKLINE> <BLANKLINE>
[sample-part] [sample-part]
__buildout_installed__ = __buildout_installed__ =
__buildout_signature__ = sample-6aWMvV2EJ9Ijq+bR8ugArQ== __buildout_signature__ = sample-6aWMvV2EJ9Ijq+bR8ugArQ==
zc.recipe.egg-cAsnudgkduAa/Fd+WJIM6Q== zc.recipe.egg-cAsnudgkduAa/Fd+WJIM6Q==
setuptools-0.6-py2.4.egg setuptools-0.6-py2.4.egg
......
...@@ -50,7 +50,7 @@ compiler ...@@ -50,7 +50,7 @@ compiler
swig swig
The path to the swig executable The path to the swig executable
swig-cpp swig-cpp
Make SWIG create C++ files (default is C) Make SWIG create C++ files (default is C)
swig-opts swig-opts
...@@ -73,14 +73,14 @@ index ...@@ -73,14 +73,14 @@ index
alternate index with this option. If you use the links option and alternate index with this option. If you use the links option and
if the links point to the needed distributions, then the index can if the links point to the needed distributions, then the index can
be anything and will be largely ignored. In the examples, here, be anything and will be largely ignored. In the examples, here,
we'll just point to an empty directory on our link server. This we'll just point to an empty directory on our link server. This
will make our examples run a little bit faster. will make our examples run a little bit faster.
python python
The name of a section to get the Python executable from. The name of a section to get the Python executable from.
If not specified, then the buildout python option is used. The If not specified, then the buildout python option is used. The
Python executable is found in the executable option of the named Python executable is found in the executable option of the named
section. section.
environment environment
The name of a section with additional environment variables. The The name of a section with additional environment variables. The
...@@ -188,7 +188,7 @@ Let's define a script that uses out ext demo: ...@@ -188,7 +188,7 @@ Let's define a script that uses out ext demo:
... ...
... [demo] ... [demo]
... recipe = zc.recipe.egg ... recipe = zc.recipe.egg
... eggs = demo ... eggs = demo
... extdemo ... extdemo
... entry-points = demo=demo:main ... entry-points = demo=demo:main
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
...@@ -270,7 +270,7 @@ We can specify a specific version using the egg option: ...@@ -270,7 +270,7 @@ We can specify a specific version using the egg option:
... ...
... [demo] ... [demo]
... recipe = zc.recipe.egg ... recipe = zc.recipe.egg
... eggs = demo ... eggs = demo
... extdemo ==1.4 ... extdemo ==1.4
... entry-points = demo=demo:main ... entry-points = demo=demo:main
... """ % dict(server=link_server)) ... """ % dict(server=link_server))
...@@ -440,7 +440,7 @@ Create a clean buildout.cfg w/o the checkenv recipe, and delete the recipe: ...@@ -440,7 +440,7 @@ Create a clean buildout.cfg w/o the checkenv recipe, and delete the recipe:
Uninstalling extdemo. Uninstalling extdemo.
Installing extdemo. Installing extdemo.
zip_safe flag not set; analyzing archive contents... zip_safe flag not set; analyzing archive contents...
>>> rmdir(sample_buildout, 'recipes') >>> rmdir(sample_buildout, 'recipes')
...@@ -496,7 +496,7 @@ compiler ...@@ -496,7 +496,7 @@ compiler
swig swig
The path to the swig executable The path to the swig executable
swig-cpp swig-cpp
Make SWIG create C++ files (default is C) Make SWIG create C++ files (default is C)
swig-opts swig-opts
...@@ -506,7 +506,7 @@ python ...@@ -506,7 +506,7 @@ python
The name of a section to get the Python executable from. The name of a section to get the Python executable from.
If not specified, then the buildout python option is used. The If not specified, then the buildout python option is used. The
Python executable is found in the executable option of the named Python executable is found in the executable option of the named
section. section.
To illustrate this, we'll use a directory containing the extdemo To illustrate this, we'll use a directory containing the extdemo
example from the earlier section: example from the earlier section:
...@@ -532,7 +532,7 @@ example from the earlier section: ...@@ -532,7 +532,7 @@ example from the earlier section:
... ...
... [demo] ... [demo]
... recipe = zc.recipe.egg ... recipe = zc.recipe.egg
... eggs = demo ... eggs = demo
... extdemo ... extdemo
... entry-points = demo=demo:main ... entry-points = demo=demo:main
... """ % dict(extdemo=extdemo)) ... """ % dict(extdemo=extdemo))
......
...@@ -24,8 +24,8 @@ We have a link server: ...@@ -24,8 +24,8 @@ 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',
... """ ... """
...@@ -69,7 +69,7 @@ we'll get the Python 2.4 eggs for demo and demoneeded: ...@@ -69,7 +69,7 @@ we'll get the Python 2.4 eggs for demo and demoneeded:
d setuptools-0.6-py2.4.egg d setuptools-0.6-py2.4.egg
d setuptools-0.6-py2.5.egg d setuptools-0.6-py2.5.egg
- zc.buildout-1.0-py2.5.egg - zc.buildout-1.0-py2.5.egg
And the generated scripts invoke Python 2.4: And the generated scripts invoke Python 2.4:
>>> import sys >>> import sys
......
...@@ -36,7 +36,7 @@ def setUp(test): ...@@ -36,7 +36,7 @@ def setUp(test):
def setUpSelecting(test): def setUpSelecting(test):
zc.buildout.testselectingpython.setup(test) zc.buildout.testselectingpython.setup(test)
zc.buildout.testing.install_develop('zc.recipe.egg', test) zc.buildout.testing.install_develop('zc.recipe.egg', test)
def test_suite(): def test_suite():
suite = unittest.TestSuite(( suite = unittest.TestSuite((
doctest.DocFileSuite( doctest.DocFileSuite(
...@@ -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+/'),
...@@ -89,7 +89,7 @@ def test_suite(): ...@@ -89,7 +89,7 @@ def test_suite():
(re.compile('extdemo[.]pyd'), 'extdemo.so') (re.compile('extdemo[.]pyd'), 'extdemo.so')
]), ]),
), ),
)) ))
if sys.version_info[:2] == (2, 5): if sys.version_info[:2] == (2, 5):
...@@ -115,7 +115,7 @@ def test_suite(): ...@@ -115,7 +115,7 @@ def test_suite():
]), ]),
), ),
) )
return suite return suite
if __name__ == '__main__': if __name__ == '__main__':
......
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