[Distutils] EasyInstall --> distutils command + setuptools enhancements?
Phillip J. Eby
pje at telecommunity.com
Sun Jun 12 18:08:48 CEST 2005
At 03:24 PM 6/8/2005 -0500, Ian Bicking wrote:
>Phillip J. Eby wrote:
>>We could solve that a little better by creating an 'ez_boot' module or
>>some such, for people to use in their setup scripts. You'd just do
>>"import ez_boot" in your setup script before trying to import setuptools,
>>and it would do the job of stuff like:
>
>So ez_boot.py would get distributed alongside setup.py? That seems like a
>good idea. It would also be a sneak way to get people to install
>pkg_resources et al ;)
Not only that, but it would help with packaging "legacy" (non-distutils)
packages, because you could just stick a setup.py and a copy of ez_boot.py
together to make a source distribution that downloads the "legacy" package
before it builds itself.
By the way, I ended up refactoring easy_install to be a single distutils
command, and moving all the download-related parts into the PackageIndex
class, which is now in the 'setuptools.package_index' module. Archive
extraction support went to 'setuptools.archive_util', and sandboxed running
of setup files went to 'setuptools.sandbox.run_setup'. So all these bits
are now reusable outside EasyInstall.
I still need to get logging hooked up, although one concern I have is that
the distutils uses a single global log object, so run_setup is going to
need to save and restore its state, but I'm going to have to figure out how
to do that in a "forward compatible" way with Anthony's planned upgrade to
distutils.log. (Because there is no public API to *get* the log level from
distutils.log, so saving it isn't possible without depending on an
implementation detail.)
I haven't finalized the name for the bootstrap module yet, but I think it's
going to be 'ez_setup'. I also need to finalize a policy for where it will
download setuptools from, unless of course it works something like:
from ez_setup import use_setuptools
use_setuptools("0.4a3", "http://peak.telecommunity.com/dist/")
Where you give it a specific version and a base URL, in case you want to
ensure accessibility for your users. But even there, it'll probably be
nice to have defaults. Anyway, that would probably be implemented with
something like:
def use_setuptools(version="latest", download_base="someplace on pypi")
try:
from pkg_resources import require
except ImportError:
# download, add to sys.path, etc.
else:
require("setuptools>="+version")
More information about the Distutils-SIG
mailing list