> On Jan 20, 2015, at 10:27 PM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > > Carl Meyer <c...@oddbird.net> writes: > >> On 01/20/2015 07:28 PM, Ben Finney wrote: >>> What I need is a way to express “ensure Docutils is installed before >>> continuing with other Setuptools actions” in ‘setup.py’. I don't >>> know of a neat way to tell Setuptools that. >> >> That is the precise purpose of the `setup_requires` kwarg. > > That's too late though. What I need is to be able to instruct the build > process to install Docutils so I can get stuff done *before ‘setup()’ is > called*. > > Is there an API within Distutils or Setuptools that allows me to say “I > haven't declared anything yet but go get and install distribution FOO > right now”? I could do that before importing the module which needs > Docutils. >
You could also add setup_requires=[“docutils”], and then pass in a Distclass (defined in your setup.py) and/or custom cmdclass entries which delay the import until the body of the methods on those classes. This should be after the setup_requires code has ran so the docutils import should work. --- Donald Stufft PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig