[Python-Dev] Expose Subversion revision number to Python
Barry Warsaw
barry at python.org
Sun Dec 18 23:36:51 CET 2005
On Sun, 2005-12-18 at 18:58 +0100, Armin Rigo wrote:
> On Sat, Dec 17, 2005 at 08:28:17PM -0500, Barry Warsaw wrote:
> > Done. r41744.
>
> Doesn't appear to work for me: sys.build_number receives the value from
> the buildno. Looking at the Makefile, the reason is that I'm building
> CPython in a separate directory (running '/some/path/configure; make').
Right. That's easily fixable by prepending $(srcdir) in front of the
test path and for the svnversion command. I'm testing that patch now.
> Do we have any plan to make sys.build_number meaningful in the releases
> as well (generally compiled from an svn export, as Michael pointed out),
> or are we happy with a broken number in this case?
Yes, here's my thought: I have a mod to Makefile.pre.in and
getbuildinfo.c so that when we don't find .svn directory, we don't
define the BUILD macro when we compile getbuildinfo.c. Then, in that
file we have something like:
#ifndef BUILD
#define BUILD "$Revision$"
#endif
Py_GetBuildNumber() grows a bit of logic to yank out the revision number
from that string, but that's all pretty straightforward. I don't think
svn has an equivalent of cvs's -kv switch. I've tested most of this,
but I'll have to commit the new getbuildinfo.c to test the export part.
> Should I propose / check-in a patch to expose sys.build_info instead
> ("CPython", "41761", "trunk"), as this got positive feedback so far?
> It's also less surprizing than the current sys.build_number, which is a
> string despite its name.
I'm still unsure about this, so I won't check this change yet. But I'm
okay with that if people want, though I think the banner should probably
still just contain the revision number.
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20051218/88bf7202/attachment.pgp
More information about the Python-Dev
mailing list