Thursday, March 09, 2006

Quickie setuptools

Here's a one-liner shell script to install PJE's setuptools, for Googling goodness. Nearly everyone, I hope, has wget. (There's also a version that uses only python by importing urllib2. I like this one.)

wget -O - http://peak.telecommunity.com/dist/ez_setup.py | python -

If you're on Windows, you probably then want to do ..

cd c:\python24\scripts
ren easy_install-script.py easy_install.py
exemaker easy_install.py


Edit:
Look for "easy_install.exe" in the C:\python24\scripts directory if you're on Windows. You probably want to copy it to somewhere in your binary PATH.

4 comments:

Anonymous said...

I don't have wget! (only curl)

PJE said...

Don't use exemaker on easy_install.

First, you don't need to, as there's already an .exe created for you.

And second, exemaker doesn't work right for programs that use sys.executable. It will confuse the hell out of easy_install, which will think that the Python interpreter is easy_install.exe, and it will probably do all kinds of crazy things.

That's why setuptools doesn't use exemaker in the first place, but has its own .exe launch wrapper/generator. I tried using exemaker and setuptools went crazy whenever it tried to invoke the Python interpreter to compile things with a different -O setting than the one in use.

PJE said...

If you copy easy_install.exe, you'll also have to copy easy_install-script.py with it.

It'd be better to add the scripts directory to your path, or choose an installation directory on your PATH by using the '-s' option to ez_setup.py to specify the target directory for scripts.

PJE said...

"""If you rely on that, your code is broken."""

It wasn't my code. See the "byte_compile()" function in the distutils.util module.