I tried to implement a --develop option for EasyInstall, but ran into a few 
snags that forced me to rethink the option a bit.

Here's what I've settled on, that can actually be made to work.  I'm adding 
an --editable/-e option, which checks out or extracts a package to a 
project-named subdirectory of the --build-directory.

Unlike the original concept of a "--develop" option, this does *not* run 
the "develop" command on the checked out or extracted package.  It simply 
fetches and extracts it for you.  The problem I had was that it's very 
difficult to integrate the target package's setup script with the parent 
easy_install command in order to maintain state properly between the 
two.  In particular, there's no way to tell if a setup script uses 
setuptools or not, and no way to ensure that the setup script isn't going 
to just modify stuff on its own, as some packages' setup scripts do.  Using 
the sandbox facility doesn't really help, since the "develop" command 
*needs* to be able to write to the install directory.  So, in the end, the 
simplest thing was just to make it "--editable" and then you can go to the 
directory and run "setup.py develop" yourself, which will also take care of 
that package's dependencies.  (Or of course you can run "easy_install ." to 
install it normally, again with its dependencies.)

In order to use --editable, you must also specify a 
--build-directory.  Checked-out or extracted packages are copied into that 
directory.  If you specify --build-directory but not --editable, then if 
there is already a package with the desired name in the build directory, 
you'll just get a warning.  But if you specify --editable and a package of 
that name exists, you'll get an error message and an abort.

To use --editable, you must also specify only project names and versions on 
the command line.  If you want to download from a URL or filename, you must 
specify it as a --find-links/-f value instead.  (Note that this means you 
need to tag checkout URLs with a "#egg=" suffix.)

Finally, if you want to force EasyInstall to check out a subversion URL 
instead of a binary distribution, you'll need to ensure that you specify a 
version that matches the checkout link.  I recommend using 
#egg=projectname-dev to tag links to development checkouts, so that people 
can do::

     easy_install -eb ~/projects projectname==dev

to specifically check out the development version in editable form to their 
~/projects/projectname directory.  The --editable flag causes easy_install 
to only look for source distributions or checkouts, but a source 
distribution will take precedence over a checkout if both match the 
specified version.

All in all, there some caveats to using --editable, but that's mainly 
because there aren't many #egg links out there yet, nor are conventions for 
using them established as yet.

Anyway, this is all now in the CVS HEAD of setuptools; see EasyInstall.txt 
for more docs and examples.

_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to