summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2011-04-20 18:32:52 (GMT)
committerJesus Cea <jcea@jcea.es>2011-04-20 18:32:52 (GMT)
commit7124f5f7e898eea5ff533ca2d501dfb1e8a31e69 (patch)
tree81d93f298cc9b44b4b1c2d2de820c94a9fa180c9 /Python/sysmodule.c
parent6159ee3cf59b3fd8fcf9818c0a8071362d1ad7c2 (diff)
parent1d4ae84e5332fd9e099a5840a8dc19c3deefe29e (diff)
downloadcpython-7124f5f7e898eea5ff533ca2d501dfb1e8a31e69.zip
cpython-7124f5f7e898eea5ff533ca2d501dfb1e8a31e69.tar.gz
cpython-7124f5f7e898eea5ff533ca2d501dfb1e8a31e69.tar.bz2
MERGE: Up-port changeset 5cf8f6da8743 (closes #11890)
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c60
1 files changed, 4 insertions, 56 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 5664646..73dc0dd 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1306,8 +1306,6 @@ settrace() -- set the global debug tracing function\n\
/* end of sys_doc */ ;
/* Subversion branch and revision management */
-static const char _patchlevel_revision[] = PY_PATCHLEVEL_REVISION;
-static const char headurl[] = "$HeadURL$";
static int svn_initialized;
static char patchlevel_revision[50]; /* Just the number */
static char branch[50];
@@ -1317,64 +1315,14 @@ static const char *svn_revision;
static void
svnversion_init(void)
{
- const char *python, *br_start, *br_end, *br_end2, *svnversion;
- Py_ssize_t len;
- int istag = 0;
-
if (svn_initialized)
return;
- python = strstr(headurl, "/python/");
- if (!python) {
- strcpy(branch, "unknown branch");
- strcpy(shortbranch, "unknown");
- }
- else {
- br_start = python + 8;
- br_end = strchr(br_start, '/');
- assert(br_end);
-
- /* Works even for trunk,
- as we are in trunk/Python/sysmodule.c */
- br_end2 = strchr(br_end+1, '/');
-
- istag = strncmp(br_start, "tags", 4) == 0;
- if (strncmp(br_start, "trunk", 5) == 0) {
- strcpy(branch, "trunk");
- strcpy(shortbranch, "trunk");
- }
- else if (istag || strncmp(br_start, "branches", 8) == 0) {
- len = br_end2 - br_start;
- strncpy(branch, br_start, len);
- branch[len] = '\0';
-
- len = br_end2 - (br_end + 1);
- strncpy(shortbranch, br_end + 1, len);
- shortbranch[len] = '\0';
- }
- else {
- Py_FatalError("bad HeadURL");
- return;
- }
- }
-
-
- svnversion = _Py_svnversion();
- if (strcmp(svnversion, "Unversioned directory") != 0 && strcmp(svnversion, "exported") != 0)
- svn_revision = svnversion;
- else if (istag) {
- len = strlen(_patchlevel_revision);
- assert(len >= 13);
- assert(len < (sizeof(patchlevel_revision) + 13));
- strncpy(patchlevel_revision, _patchlevel_revision + 11,
- len - 13);
- patchlevel_revision[len - 13] = '\0';
- svn_revision = patchlevel_revision;
- }
- else
- svn_revision = "";
-
svn_initialized = 1;
+ *patchlevel_revision = '\0';
+ strcpy(branch, "");
+ strcpy(shortbranch, "unknown");
+ svn_revision = "";
}
/* Return svnversion output if available.