Commit f548437e authored by Reinout van Rees's avatar Reinout van Rees

Trying to get scripts working. Not working yet...

parent 84ac008c
...@@ -927,6 +927,7 @@ def scripts(reqs, working_set, executable, dest, ...@@ -927,6 +927,7 @@ def scripts(reqs, working_set, executable, dest,
initialization = '\n'+initialization+'\n' initialization = '\n'+initialization+'\n'
entry_points = [] entry_points = []
distutils_scripts = []
for req in reqs: for req in reqs:
if isinstance(req, str): if isinstance(req, str):
req = pkg_resources.Requirement.parse(req) req = pkg_resources.Requirement.parse(req)
......
...@@ -912,6 +912,32 @@ We specified an interpreter and its paths are adjusted too: ...@@ -912,6 +912,32 @@ We specified an interpreter and its paths are adjusted too:
__import__("code").interact(banner="", local=globals()) __import__("code").interact(banner="", local=globals())
Installing distutils-style scripts
----------------------------------
Most python libraries use the console_scripts entry point nowadays. But
several still have a ``scripts=['bin/something']`` in their setup() call.
Buildout also installs those:
>>> distdir = tmpdir('distutilsscriptdir')
>>> distbin = tmpdir('distutilsscriptbin')
>>> ws = zc.buildout.easy_install.install(
... ['other'], distdir,
... links=[link_server], index=link_server+'index/')
>>> scripts = zc.buildout.easy_install.scripts(
... ['other'], ws, sys.executable, distbin)
>>> ls(distbin)
- distutilsscript
Distutils copies the specified script files verbatim, apart from a line at the
top that looks like ``#!/usr/bin/python``, which gets replaced by the actual
python interpreter. Buildout does the same, but additionally also adds the
sys.path like for the console_scripts:
>>> cat(distbin, 'distutilsscript')
TODO
Handling custom build options for extensions provided in source distributions Handling custom build options for extensions provided in source distributions
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
......
...@@ -2675,14 +2675,17 @@ def create_sample_eggs(test, executable=sys.executable): ...@@ -2675,14 +2675,17 @@ def create_sample_eggs(test, executable=sys.executable):
) )
zc.buildout.testing.sdist(tmp, dest) zc.buildout.testing.sdist(tmp, dest)
write(tmp, 'distutilsscript', '#!/usr/bin/python\nprint "distutils!"')
write( write(
tmp, 'setup.py', tmp, 'setup.py',
"from setuptools import setup\n" "from setuptools import setup\n"
"setup(name='other', zip_safe=False, version='1.0', " "setup(name='other', zip_safe=False, version='1.0', "
"scripts=['distutilsscript'],"
"py_modules=['eggrecipedemoneeded'])\n" "py_modules=['eggrecipedemoneeded'])\n"
) )
zc.buildout.testing.bdist_egg(tmp, executable, dest) zc.buildout.testing.bdist_egg(tmp, executable, dest)
os.remove(os.path.join(tmp, 'distutilsscript'))
os.remove(os.path.join(tmp, 'eggrecipedemoneeded.py')) os.remove(os.path.join(tmp, 'eggrecipedemoneeded.py'))
for i in (1, 2, 3, 4): for i in (1, 2, 3, 4):
......
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