Commit 243bd1c4 authored by Gary Poster's avatar Gary Poster

make the buildout script itself safe for a Python with site packages.

parent 49f0fd01
......@@ -391,9 +391,11 @@ class Buildout(UserDict.DictMixin):
# Create buildout script
ws = pkg_resources.WorkingSet(entries)
ws.require('zc.buildout')
zc.buildout.easy_install.scripts(
['zc.buildout'], ws, options['executable'],
options['bin-directory'])
partsdir = os.path.join(options['parts-directory'], 'buildout')
os.mkdir(partsdir)
zc.buildout.easy_install.sitepackage_safe_scripts(
options['bin-directory'], ws, options['executable'], partsdir,
reqs=['zc.buildout'])
init = bootstrap
......
......@@ -56,10 +56,9 @@ The bin directory contains scripts.
- setuptools-0.6-py2.4.egg
- zc.buildout-1.0-py2.4.egg
The develop-eggs and parts directories are initially empty:
The develop-eggs directory is initially empty:
>>> ls(sample_buildout, 'develop-eggs')
>>> ls(sample_buildout, 'parts')
The develop-eggs directory holds egg links for software being
developed in the buildout. We separate develop-eggs and other eggs to
......@@ -69,6 +68,12 @@ directory in their home that all non-develop eggs are stored in. This
allows larger buildouts to be set up much more quickly and saves disk
space.
The parts directory just contains some helpers for the buildout script
itself.
>>> ls(sample_buildout, 'parts')
d buildout
The parts directory provides an area where recipes can install
part data. For example, if we built a custom Python, we would
install it in the part directory. Part data is stored in a
......
......@@ -374,19 +374,6 @@ def buildoutSetUp(test):
return (
os.path.join(buildout, 'bin', 'py'), site_packages_dir)
buildout = os.path.join(sample, 'bin', 'buildout')
def do_build(buildout=buildout, python=None, args=()):
if python is None:
return system(buildout)
if sys.platform == 'win32':
# We need to find the "real" script.
buildout += '-script.py'
cmd = [python, buildout]
cmd.extend(args)
return system(zc.buildout.easy_install._safe_arg(
' '.join(zc.buildout.easy_install._safe_arg(arg) for arg in cmd)))
test.globs.update(dict(
sample_buildout = sample,
ls = ls,
......@@ -397,7 +384,6 @@ def buildoutSetUp(test):
tmpdir = tmpdir,
write = write,
system = system,
do_build=do_build,
call_py = call_py,
get = get,
cd = (lambda *path: os.chdir(os.path.join(*path))),
......@@ -405,7 +391,7 @@ def buildoutSetUp(test):
sdist = sdist,
bdist_egg = bdist_egg,
start_server = start_server,
buildout = buildout,
buildout = os.path.join(sample, 'bin', 'buildout'),
wait_until = wait_until,
make_py = make_py
))
......
......@@ -420,7 +420,7 @@ Now here is the output. The lines that begin with "Egg from site-packages:"
indicate the eggs from site-packages that have been selected. You'll see
we have two: demo 0.3 and demoneeded 1.1.
>>> print do_build(python=py_path, args=['-v'])
>>> print system(buildout+" -v")
Installing 'zc.buildout', 'setuptools'.
We have a develop egg: zc.buildout V
We have the best distribution that satisfies 'setuptools'.
......
......@@ -325,7 +325,7 @@ document do not affect this example.)
... eggs = demoneeded
... ''' % globals())
>>> print do_build(python=py_path)
>>> print system(buildout)
Creating directory '/sample-buildout/tmpeggs'.
Uninstalling py.
Installing eggs.
......@@ -354,10 +354,11 @@ is not allowed to come from site-packages, and the buildout fails.
... allowed-eggs-from-site-packages =
... eggs = demoneeded
... ''' % globals())
>>> print do_build(python=py_path)
>>> print system(buildout)
Creating directory '/sample-buildout/tmpeggs'.
Uninstalling eggs.
Installing eggs.
Couldn't find index page for 'demoneeded' (maybe misspelled?)
Getting distribution for 'demoneeded'.
While:
Installing eggs.
......@@ -458,6 +459,7 @@ Note that the parts/py directory has been cleaned up, and parts/python has
been created.
>>> ls(sample_buildout, 'parts')
d buildout
d demo
d python
......
......@@ -267,7 +267,7 @@ The eggs are not found.
... python = primed_python
... eggs = demoneeded
... ''' % globals())
>>> print do_build(python=py_path)
>>> print system(buildout)
Installing eggs.
Couldn't find index page for 'demoneeded' (maybe misspelled?)
Getting distribution for 'demoneeded'.
......@@ -297,7 +297,7 @@ they are in the executable's path.
... eggs = demoneeded
... ''' % globals())
>>> print do_build(python=py_path)
>>> print system(buildout)
Installing eggs.
<BLANKLINE>
......@@ -315,7 +315,7 @@ We get an error if we specify anything but true or false:
... eggs = other
... ''' % globals())
>>> print do_build(python=py_path)
>>> print system(buildout)
While:
Installing.
Getting section eggs.
......@@ -357,7 +357,7 @@ correctly parse a single-line value.
... eggs = demoneeded
... ''' % globals())
>>> print do_build(python=py_path)
>>> print system(buildout)
Installing eggs.
<BLANKLINE>
......@@ -383,7 +383,7 @@ parse a multi-line value.
... eggs = demoneeded
... ''' % globals())
>>> print do_build(python=py_path)
>>> print system(buildout)
Uninstalling eggs.
Installing eggs.
<BLANKLINE>
......
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