[buildout[ How do I use stuff specified in the distutils.command entry_point?
Hi All, Sphinx, among others, provides command in this entry point. With this buildout: [buildout] parts = sphinx [sphinx] recipe = zc.recipe.egg eggs = sphinx And based on the entry points listed here: http://bitbucket.org/birkenfeld/sphinx/src/447109cf9b01/setup.py#cl-182 I'd expect to be able to do: $ bin/buildout setup setup.py build_sphinx But I get: Running setup script 'setup.py'. usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: invalid command 'build_sphinx' Any ideas? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk
On 2009-09-08, Chris Withers
Hi All,
Sphinx, among others, provides command in this entry point.
With this buildout:
[buildout] parts = sphinx
[sphinx] recipe = zc.recipe.egg eggs = sphinx
And based on the entry points listed here:
http://bitbucket.org/birkenfeld/sphinx/src/447109cf9b01/setup.py#cl-182
I'd expect to be able to do:
$ bin/buildout setup setup.py build_sphinx
But I get:
Running setup script 'setup.py'. usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help
error: invalid command 'build_sphinx'
Any ideas?
Yes: "bin/buildout setup setup.py something" tells buildout to run the "something" command with the setup.py in the current directory. And that won't be sphinx' setup.py. Secondly: such an console_scripts entry point only tells setuptools (and buildout) to install that script in the bin directory. It is not an extra setup.py command (like "sdist" and "build"). For that, you need a different entry point. When I just take your example buildout and run it, I get the expected result $> bin/buildout Installing sphinx. Getting distribution for 'sphinx'. Got Sphinx 0.6.3. Generated script '/private/tmp/bbb/bin/sphinx-build'. Generated script '/private/tmp/bbb/bin/sphinx-quickstart'. Generated script '/private/tmp/bbb/bin/sphinx-autogen'. So buildout installs the three defined console_scripts just fine in the bin/ directory. Reinout -- Reinout van Rees - reinout@vanrees.org - http://reinout.vanrees.org Software developer at http://www.thehealthagency.com "Military engineers build missiles. Civil engineers build targets"
Hi Reinout, I'm afraid you're getting confused... Reinout van Rees wrote:
And based on the entry points listed here:
http://bitbucket.org/birkenfeld/sphinx/src/447109cf9b01/setup.py#cl-182
I'm referring to the distutils.commands entry point in the above *not* console_scripts.
Yes: "bin/buildout setup setup.py something" tells buildout to run the "something" command with the setup.py in the current directory. And that won't be sphinx' setup.py.
It doesn't need to be Sphinx's setup.py, distutils.commands, as an entry point, adds commands to disutuils (eg: bdist_egg, etc)
Secondly: such an console_scripts entry point only tells setuptools (and buildout) to install that script in the bin directory. It is not an extra setup.py command (like "sdist" and "build"). For that, you need a different entry point.
Yes, the distutils.commands entry point, which defines build_sphinx *not* sphinx_build ;-) The problem is that bin/buildout only has zc.buildout and setuptools available as eggs, so "bin/buildout setup setup.py" seems a bit limited to me :-S I found a workaround, which was to define an interpreter in my [sphinx] section and then do: bin/py setup.py build_sphinx ...but that just felt a bit wrong :-S Can anyone tell me what the *right* way is to get this to work? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk
On 2009-09-09, Chris Withers
I'm afraid you're getting confused...
You're right :-)
Reinout van Rees wrote:
And based on the entry points listed here:
http://bitbucket.org/birkenfeld/sphinx/src/447109cf9b01/setup.py#cl-182
I'm referring to the distutils.commands entry point in the above *not* console_scripts.
Missed that one.
The problem is that bin/buildout only has zc.buildout and setuptools available as eggs, so "bin/buildout setup setup.py" seems a bit limited to me :-S
I found a workaround, which was to define an interpreter in my [sphinx] section and then do:
bin/py setup.py build_sphinx
...but that just felt a bit wrong :-S
Can anyone tell me what the *right* way is to get this to work?
From what I've seen, your workaround is the right way to do it. The one item that struck me is that not even the recipe eggs end up on bin/buildout's sys.path. So buildout is about setting stuff up in the right way so that subsequent commands can run OK.
Until you talked about it, I never encountered "bin/buildout setup setup.py", so I wonder how common it is. It also means I should probably shut up about it to prevent saying dumb things :-) Btw: there is a recipe for setting up a sphinx area in your buildout: http://pypi.python.org/pypi/collective.recipe.sphinxbuilder/0.6.3 Personally I use it just once to create a directory structure in my buildout. Afterwards I store the results in svn and rip out collective.recipe.sphinxbuilder again to allow me to edit config files directly instead of having them generated. Reinout -- Reinout van Rees - reinout@vanrees.org - http://reinout.vanrees.org Software developer at http://www.thehealthagency.com "Military engineers build missiles. Civil engineers build targets"
Reinout van Rees wrote:
Personally I use it just once to create a directory structure in my buildout. Afterwards I store the results in svn and rip out collective.recipe.sphinxbuilder again to allow me to edit config files directly instead of having them generated.
Interesting, I'm actually looking at it currently for its packaging of the sphinx-build console script in a buildout-friendly fashion... cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk
participants (2)
-
Chris Withers
-
Reinout van Rees