Mercurial > cpython-lru_cache-weakref
comparison Python/sysmodule.c @ 42703:8bad8722f0e6
Patch #1774414: make it possible to use SVK to develop Python.
| author | Collin Winter <collinw@gmail.com> |
|---|---|
| date | Wed, 22 Aug 2007 19:45:07 +0000 |
| parents | 4d2aa4bfb2d6 |
| children | a99ec4befda8 |
comparison
equal
deleted
inserted
replaced
| 42702:782370c93575 | 42703:8bad8722f0e6 |
|---|---|
| 932 static void | 932 static void |
| 933 svnversion_init(void) | 933 svnversion_init(void) |
| 934 { | 934 { |
| 935 const char *python, *br_start, *br_end, *br_end2, *svnversion; | 935 const char *python, *br_start, *br_end, *br_end2, *svnversion; |
| 936 Py_ssize_t len; | 936 Py_ssize_t len; |
| 937 int istag; | 937 int istag = 0; |
| 938 | 938 |
| 939 if (svn_initialized) | 939 if (svn_initialized) |
| 940 return; | 940 return; |
| 941 | 941 |
| 942 python = strstr(headurl, "/python/"); | 942 python = strstr(headurl, "/python/"); |
| 943 if (!python) | 943 if (!python) { |
| 944 Py_FatalError("subversion keywords missing"); | 944 strcpy(branch, "unknown branch"); |
| 945 | 945 strcpy(shortbranch, "unknown"); |
| 946 br_start = python + 8; | |
| 947 br_end = strchr(br_start, '/'); | |
| 948 assert(br_end); | |
| 949 | |
| 950 /* Works even for trunk, | |
| 951 as we are in trunk/Python/sysmodule.c */ | |
| 952 br_end2 = strchr(br_end+1, '/'); | |
| 953 | |
| 954 istag = strncmp(br_start, "tags", 4) == 0; | |
| 955 if (strncmp(br_start, "trunk", 5) == 0) { | |
| 956 strcpy(branch, "trunk"); | |
| 957 strcpy(shortbranch, "trunk"); | |
| 958 | |
| 959 } | |
| 960 else if (istag || strncmp(br_start, "branches", 8) == 0) { | |
| 961 len = br_end2 - br_start; | |
| 962 strncpy(branch, br_start, len); | |
| 963 branch[len] = '\0'; | |
| 964 | |
| 965 len = br_end2 - (br_end + 1); | |
| 966 strncpy(shortbranch, br_end + 1, len); | |
| 967 shortbranch[len] = '\0'; | |
| 968 } | 946 } |
| 969 else { | 947 else { |
| 970 Py_FatalError("bad HeadURL"); | 948 br_start = python + 8; |
| 971 return; | 949 br_end = strchr(br_start, '/'); |
| 950 assert(br_end); | |
| 951 | |
| 952 /* Works even for trunk, | |
| 953 as we are in trunk/Python/sysmodule.c */ | |
| 954 br_end2 = strchr(br_end+1, '/'); | |
| 955 | |
| 956 istag = strncmp(br_start, "tags", 4) == 0; | |
| 957 if (strncmp(br_start, "trunk", 5) == 0) { | |
| 958 strcpy(branch, "trunk"); | |
| 959 strcpy(shortbranch, "trunk"); | |
| 960 } | |
| 961 else if (istag || strncmp(br_start, "branches", 8) == 0) { | |
| 962 len = br_end2 - br_start; | |
| 963 strncpy(branch, br_start, len); | |
| 964 branch[len] = '\0'; | |
| 965 | |
| 966 len = br_end2 - (br_end + 1); | |
| 967 strncpy(shortbranch, br_end + 1, len); | |
| 968 shortbranch[len] = '\0'; | |
| 969 } | |
| 970 else { | |
| 971 Py_FatalError("bad HeadURL"); | |
| 972 return; | |
| 973 } | |
| 972 } | 974 } |
| 973 | 975 |
| 974 | 976 |
| 975 svnversion = _Py_svnversion(); | 977 svnversion = _Py_svnversion(); |
| 976 if (strcmp(svnversion, "exported") != 0) | 978 if (strcmp(svnversion, "exported") != 0) |
