[Distutils] Bazaar support for setuptools

Barry Warsaw barry at python.org
Sat Jul 21 01:31:53 CEST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Phillip, thanks for the quick response.

On Jul 20, 2007, at 5:18 PM, Phillip J. Eby wrote:

> At 04:32 PM 7/20/2007 -0400, Barry Warsaw wrote:
>> Well, I hacked this together pretty quickly but it seems to work for
>> my particular use case.  The Mailman source code is now kept under
>> the Bazaar revision control system, and I'm about to merge a branch
>> that converts the Mailman 3 branch from autoconf-based builds to
>> setuptools.  So I needed Bazaar support in order to build my sdist
>> files and such.
>>
>> Writing the plugin code was pretty easy after Michael Hudson gave me
>> the key bzrlib clues.  Maybe this could be included by default in the
>> next version of setuptools?
>
> No, since it relies on a package (bzrlib) that's not in the stdlib  
> or bundled with setuptools.

Would it help if the plugin could fall back to the command line bzr 
(1) program if bzrlib wasn't installed in your Python?  I've modified  
the code to do this and it seems to work fine either way.  I haven't  
looked, but ISTM that both CVS and Subversion support have to work  
somewhat similarly.  How does setuptools handle things if either cvs 
(1) or svn(1) weren't available?

> You can, however, just add a setup.py to your module that declares  
> the entry point, and upload the whole thing to Cheeseshop.

I could if the Cheeseshop was up right now. ;)

Great idea.  The code lives here:

https://code.launchpad.net/~barry/setuptoolsbzr/trunk

and I'll upload it to the Cheeseshop as soon as that service gets  
repaired.

> You can even declare its dependency on bzrlib and have that  
> automatically installed too, assuming that it's either on the  
> Cheeseshop or you can supply a download link or page with download  
> links in your setup(find_links=[...]).

I don't quite understand this last bit.  Is there documentation on  
the find_links keyword argument?  I couldn't find it.  What I did  
find was dependency_links so I added the following to my setup.py:

     entry_points    = {
         'setuptools.file_finders': [
             'bzr = setuptoolsbzr:find_files_for_bzr',
             ],
         },
     # Optionally grab bzr, which provides bzrlib
     extras_require  = {
         'bzrlib': ['bzr'],
         },
     dependency_links = [
         'http://bazaar-vcs.org',
         ]

I haven't actually tested this part because I can't find  
documentation on instructing 'python setup.py install' to install  
optional packages (is that even possible from the command line?).   
Note further that while bzrlib itself isn't a Cheeseshop package,  
there's a bzr tarball on that site that should -- I think -- install  
bzrlib as part of its setup.py.

>> Side note: I found it interesting and a bit annoying that setuptools
>> doesn't call find_files_for_bzr() recursively.  It would seem like
>> the framework should do the recursion instead of the plugin, as I'd
>> think it would be the most common use case.
>
> Well, the assumption is that only the plugin knows whether a  
> directory is a candidate for recursion.  Also, some revision  
> control systems only keep path information in one place, so trying  
> to call the plugin recursively would be redundant.

Make sense, thanks.

>> In any event, the
>> setuptools documentation should probably be clear that it's up to the
>> plugin to recurse into subdirectories.
>
> Fair enough; patches welcome.  In fact, feel free to just go ahead  
> and check documentation additions right in, just drop me a line and  
> let me know what you did so I can double-check and edit if necessary.

The code's in the sandbox, right?  I may indeed do that.

Cheers,
- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iQCVAwUBRqFF6nEjvBPtnXfVAQJvhwP/T0rXxGARQDrQ2OdVcu3/3IMNY+MCUDj3
B8hYflHST/XgxVBnQGtlhROsKsMxvsqqVePuGlj9F0ykViaTu5dMcZ6XFdHw47QJ
wZ7S++nQ1lN/DsRN1UJsIXpnrNkLkxaAloiTU8omkS7xJ0MVVRSkespt8iyBWaiz
AZ7aCkWWO6M=
=LswG
-----END PGP SIGNATURE-----


More information about the Distutils-SIG mailing list