Issue42

If you're reporting an issue for setuptools 0.7 or higher, please use BitBucket

Title Add VCS support
Priority feature Status chatting
Superseder Nosy List En-Cu-Kou, hongqn, pje, sdouche
Assigned To Keywords

Created on 2008-09-09.13:09:46 by sdouche, last changed 2009-10-21.04:54:36 by pje.

Files
File name Uploaded Type Edit Remove
revision_taggers-563.patch En-Cu-Kou, 2009-02-20.11:14:12 text/plain
revision_taggers.patch En-Cu-Kou, 2009-02-19.19:58:37 text/plain
setuptools-sd-20080908.patch sdouche, 2008-09-09.13:09:46 text/x-diff
Messages
msg433 (view) Author: pje Date: 2009-10-21.04:54:35
I'm thinking about making a slight change to this for the actual implementation
in 0.7a1.  Instead of specifying the VCS via the command line, I'm thinking
about specifying a VCS plugin via a setup() keyword, e.g.
"vcs_plugin='setuptools_hg'" to request the use of a specific plugin, with the
default being equivalent to 'setuptools'.  This would control both revision
tagging and file finders, and be equivalent to a conditional 'setup_requires'
when building an sdist.  Heck, it might even help with making sure that
SOURCES.txt is correct/clean.

One additional advantage to this is that --tag-svn-revision can become an alias
for a --tag-revision command that just asks the specified VCS plugin for a
revision.  But the flip side is that you can't override *which* plugin is used
without editing setup.py.  Seems reasonable enough to me, but maybe somebody has
another use case?
msg241 (view) Author: En-Cu-Kou Date: 2009-02-20.11:14:12
All right, here's the update.

I reverted to --revision-tagger, but put the SVN code in egg_info.py

Also, I added support for tagger options: the code only looks at the part of
revision_tagger before the first colon, then passes the whole thing to the
tagger function. This should be helpful for some plugins.
msg240 (view) Author: pje Date: 2009-02-19.23:10:16
Hm.  I hadn't thought of the pathological case.  I suppose it would 
be helpful to have the option to force it in that situation.  I guess 
that makes sense.

Ok, you talked me into it!  Keep the options the way you had 
them.  And the module-level function is okay.
msg239 (view) Author: En-Cu-Kou Date: 2009-02-19.21:44:51
Okay, I'll change that.
There are times when I have a tree managed by both Bazaar and SVN, because
Bazaar lets me save local commits but the upstream uses SVN, but I guess that's
a pathological case.

Hmm. I'm not sure how to do option aliases (for instance if I see both
--tag-revision and --no-tag-svn-revision, how do I know which came from the
command line and should override the other?). It seems fancy_getopt supports
positive aliases, but there's no way to specify them from a Command.
Am I missing something? (If not, the generic options should probably just
override the -svn- variants.)

(Keeping the SVN tagging inside egg_info.py, but making it a module-level
function is OK?)

I'll post another patch when this is sorted out, there's a Bazaar branch at
https://code.launchpad.net/~encukou/setuptools/revision-tagger for the time being.
msg238 (view) Author: pje Date: 2009-02-19.20:09:50
Definitely getting closer.  Specifying a plugin is unnecessary, 
however.  It should just loop over installed plugins and ask if they 
know the revision, termininating on the first one returning a 
non-None value.  And I'd prefer to see '--tag-revision' and 
'--no-tag-revision' options that are essentially aliases to the 
existing SVN-specific options.  (There's also no need to move the SVN 
tagging to a different module.)
msg237 (view) Author: En-Cu-Kou Date: 2009-02-19.19:58:37
Included is a patch that creates a "setuptools.revision_taggers" entrypoint,
which allows plugins to provide revision tags, and a "revision_tagger" option to
egg_info, which allows users to choose such a tagger.

I made the tagger function return the whole tag, including -r, because
distributed VCSs will probably need more than just a number to keep revisions at
least close to monotonic.

Criticism welcome.
msg163 (view) Author: pje Date: 2008-09-11.15:25:04
1. Please make this backward-compatible; it can't simply throw out
--tag-svn-revision or drop the core support for SVN and CVS.  Even if it's
0.7-only, it will still have to be able to handle the setup.cfg of existing
projects.

2. get_filters() should return a list of callables, not strings, and it
shouldn't be called from the inner function: it should be called once from the
outer function and the result saved.  As written, this is a horrible
inefficiency, as it will be searching for entry points for every single file in
the egg-info.  (Also, a straight-string filter with no programmability won't
work for every revision control system.)

3. The error trapping around the file finder loop is bogus.  The entry point
itself must handle any errors.

4. The patch shouldn't be changing setuptools' version number, or adding entry
points referencing modules that aren't even included in the patch.

5. The exclude_pattern() stuff is treating arbitrary filter strings as regexes
but isn't escaping them.  Of course, it should be using filter functions anyway,
but I thought I should mention that what's there is broken irrespective of this.
msg160 (view) Author: sdouche Date: 2008-09-09.13:09:46
This is a basic try (4h) to extract specific SVN code out of the core
and add entry points for:
- filters (.svn, .hg, ...)
- find files in repos
- get revision's number

Thoughts:
- if repos have 2 VCS entries (.svn and .hg for example), the first
valid entry point is used.
- walk_revctrl function needs more love. I keep the philosophy of
iterator but is it the good way ?

Notes:
- vcs_svn.py & vcs_hg.py are only for demo. The natural place are into
Setuptools plugins.
- filters must return a list.
- revisions must return a int or None (not 0).

Critics welcome.
History
Date User Action Args
2009-10-21 04:54:36pjesetmessages: + msg433
2009-07-18 15:20:53hongqnsetnosy: + hongqn
2009-02-20 11:14:13En-Cu-Kousetfiles: + revision_taggers-563.patch
messages: + msg241
2009-02-19 23:10:17pjesetmessages: + msg240
2009-02-19 21:45:49En-Cu-Kousetfiles: - revision_taggers.patch
2009-02-19 21:44:52En-Cu-Kousetfiles: + revision_taggers.patch
messages: + msg239
2009-02-19 20:09:50pjesetmessages: + msg238
2009-02-19 19:58:38En-Cu-Kousetfiles: + revision_taggers.patch
nosy: + En-Cu-Kou
messages: + msg237
2008-09-11 15:25:04pjesetstatus: unread -> chatting
nosy: + pje
messages: + msg163
2008-09-09 13:09:46sdouchecreate