Commit b6aae481 authored by Jim Fulton's avatar Jim Fulton

Added an extra-paths option to specify extra paths to be inclided in

generated script paths.
parent b208f821
......@@ -41,6 +41,9 @@ Custom eggs
The zc.recipe.egg:custom recipe supports building custom eggs,
currently with specialized options for building extensions.
extra-paths
Extra paths to include in a generates script.
To do
-----
......@@ -51,14 +54,6 @@ To do
- More control over script generation. In particular, some way to
specify data t be recored in the script.
- Honor the buildout offline option.
- Windows suppprt
- Generate exe files
- Make sure tests work under windows
Change History
==============
......
......@@ -37,6 +37,8 @@ scripts
disabled. If the option isn't given at all, then all scripts
defined by the named eggs will be generated.
extra-paths
Extra paths to include in a generates script.
We have a link server that has a number of eggs:
......@@ -113,7 +115,7 @@ If we run the demo script, it prints out some minimal data:
The value it prints out happens to be some values defined in the
modules installed.
We can also run the py_demo script. Here we'll just print out
We can also run the py-demo script. Here we'll just print out
the bits if the path added to reflect the eggs:
>>> print system(os.path.join(sample_buildout, 'bin', 'py-demo'),
......@@ -205,6 +207,46 @@ You can also control the name used for scripts:
- foo
- py-zc.buildout
If we need to include extra paths in a script, we can use the
extra-paths option:
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = demo
...
... [demo]
... recipe = zc.recipe.egg
... find-links = %(server)s
... index = %(server)s/index
... scripts = demo=foo
... extra-paths =
... /foo/bar
... /spam/eggs
... """ % dict(server=link_server))
>>> print system(buildout),
Let's look at the script that was generated:
>>> cat(sample_buildout, 'bin', 'foo') # doctest: +NORMALIZE_WHITESPACE
#!/usr/local/bin/python2.3
<BLANKLINE>
import sys
sys.path[0:0] = [
'/tmp/xyzsample-install/demo-0.3-py2.3.egg',
'/tmp/xyzsample-install/demoneeded-1.1-py2.3.egg',
'/foo/bar',
'/spam/eggs'
]
<BLANKLINE>
import eggrecipedemo
<BLANKLINE>
if __name__ == '__main__':
eggrecipedemo.main()
Offline mode
------------
......
......@@ -39,6 +39,14 @@ class Egg:
options['index'] = index
self.index = index
self.extra_paths = [
os.path.join(buildout['buildout']['directory'], p.strip())
for p in options.get('extra-paths', '').split('\n')
if p.strip()
]
if self.extra_paths:
options['extra-paths'] = '\n'.join(self.extra_paths)
options['_b'] = buildout['buildout']['bin-directory']
options['_e'] = buildout['buildout']['eggs-directory']
options['_d'] = buildout['buildout']['develop-eggs-directory']
......@@ -93,5 +101,7 @@ class Egg:
])
return zc.buildout.easy_install.scripts(
distributions, ws, options['executable'],
options['_b'], scripts=scripts)
options['_b'],
scripts=scripts,
extra_paths=self.extra_paths)
......@@ -73,6 +73,7 @@ def test_suite():
'zc.buildout.egg'),
(re.compile('(\n?)- ([a-zA-Z_.-]+)-script.py\n- \\2.exe\n'),
'\\1- \\2\n'),
(re.compile('#![^\n]+python[^\n]*\n'), '#!python\n'),
])
),
doctest.DocFileSuite(
......
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