Can't generate console script with buildout - even when using zc.recipe.egg
Hi there, I was hoping a buildout guru could give a hand on this one: The "RelStorage" package comes as an egg and installing it in a buildout environment works fine. However I can't find a way to let buildout generate the zodbconvert console script that comes with RelStorage. easy_install RelStorage adds the script fine. I know you should use zc.recipe.egg in this case, but no result. The RelStorage setup.py comes with this: scripts=['scripts/zodbconvert.py'] but no "console_scripts" entry points (maybe that is needed?) I found a kind-of workaround: entry-points = zodbconvert=zodbconvert:main extra-paths = /home/stonor/projects/mybuildout/eggs/RelStorage-1.0.1-py2.4.egg/EGG-INFO/scripts But it is annoying to hard code the path to RelStorage-1.0.1-py2.4.egg/EGG-INFO/scripts. Is there a way to dynamically look up the path to an egg with bulidout or a another way to solve my issue? /Anton Stonor
On Apr 1, 2008, at 11:07 AM, Anton Stonor wrote:
Hi there,
I was hoping a buildout guru could give a hand on this one:
The "RelStorage" package comes as an egg and installing it in a buildout environment works fine.
However I can't find a way to let buildout generate the zodbconvert console script that comes with RelStorage.
easy_install RelStorage adds the script fine.
I know you should use zc.recipe.egg in this case, but no result.
The RelStorage setup.py comes with this:
scripts=['scripts/zodbconvert.py']
but no "console_scripts" entry points (maybe that is needed?)
Yes, buildout needs that. buildout only installs scripts declared as entry points. As you discovered, you can specify the entry points yourself. Buildout also needs the entry point to be importable from the egg. Unfortunately, old-style distutils script handling doesn't put the scripts in a place where they are importable.
I found a kind-of workaround:
entry-points = zodbconvert=zodbconvert:main extra-paths = /home/stonor/projects/mybuildout/eggs/RelStorage-1.0.1-py2.4.egg/EGG- INFO/scripts
But it is annoying to hard code the path to RelStorage-1.0.1-py2.4.egg/EGG-INFO/scripts.
Is there a way to dynamically look up the path to an egg with bulidout or a another way to solve my issue?
No, because the scripts aren't included in the RelStorage Python package and aren't in the egg path. You should get Shane to move this script into a module that can be imported from the egg. This is what I did with the ZODB scripts a while back. Perhaps buildout should support the traditional script-installation mechanism, but that mechanism assumes that the modules needed by the script are installed into site packages and that's not a model that buildout provides. Virtualenv supports this use case because it emulates a Python install. Jim -- Jim Fulton Zope Corporation
Jim Fulton wrote:
The RelStorage setup.py comes with this:
scripts=['scripts/zodbconvert.py']
but no "console_scripts" entry points (maybe that is needed?)
Yes, buildout needs that. buildout only installs scripts declared as entry points. As you discovered, you can specify the entry points yourself. Buildout also needs the entry point to be importable from the egg. Unfortunately, old-style distutils script handling doesn't put the scripts in a place where they are importable.
Thanks for a quick and precise answer. I'll poke Shane. Anton
Hi Jim, I wrote a little patch to add support for old style scripts. I don't know if it is a good solution (maybe I missed something) Can you please review it and help me to get it done if I misunderstood. Many thanks, /Mustapha Jim Fulton wrote:
On Apr 1, 2008, at 11:07 AM, Anton Stonor wrote:
Hi there,
I was hoping a buildout guru could give a hand on this one:
The "RelStorage" package comes as an egg and installing it in a buildout environment works fine.
However I can't find a way to let buildout generate the zodbconvert console script that comes with RelStorage.
easy_install RelStorage adds the script fine.
I know you should use zc.recipe.egg in this case, but no result.
The RelStorage setup.py comes with this:
scripts=['scripts/zodbconvert.py']
but no "console_scripts" entry points (maybe that is needed?)
Yes, buildout needs that. buildout only installs scripts declared as entry points. As you discovered, you can specify the entry points yourself. Buildout also needs the entry point to be importable from the egg. Unfortunately, old-style distutils script handling doesn't put the scripts in a place where they are importable.
I found a kind-of workaround:
entry-points = zodbconvert=zodbconvert:main extra-paths = /home/stonor/projects/mybuildout/eggs/RelStorage-1.0.1-py2.4.egg/EGG- INFO/scripts
But it is annoying to hard code the path to RelStorage-1.0.1-py2.4.egg/EGG-INFO/scripts.
Is there a way to dynamically look up the path to an egg with bulidout or a another way to solve my issue?
No, because the scripts aren't included in the RelStorage Python package and aren't in the egg path. You should get Shane to move this script into a module that can be imported from the egg. This is what I did with the ZODB scripts a while back.
Perhaps buildout should support the traditional script-installation mechanism, but that mechanism assumes that the modules needed by the script are installed into site packages and that's not a model that buildout provides. Virtualenv supports this use case because it emulates a Python install.
Jim
-- Jim Fulton Zope Corporation
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig
participants (3)
-
Anton Stonor
-
Jim Fulton
-
mustapha