From 776e5861140957692db39fa63b6c1171ddb8508b Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 6 Mar 2011 10:35:42 +0100 Subject: [PATCH] Remove sys.subversion and svn build identification leftovers. --- Doc/library/sys.rst | 12 ----- Include/pythonrun.h | 3 -- Lib/test/test_platform.py | 6 +-- Makefile.pre.in | 3 -- Modules/getbuildinfo.c | 18 -------- Python/sysmodule.c | 94 --------------------------------------- configure | 47 -------------------- configure.in | 9 ---- 8 files changed, 1 insertion(+), 191 deletions(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 88655bbd716..b09571f2ad0 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -36,18 +36,6 @@ always available. little-endian (least-significant byte first) platforms. -.. data:: subversion - - A triple (repo, branch, version) representing the Subversion information of the - Python interpreter. *repo* is the name of the repository, ``'CPython'``. - *branch* is a string of one of the forms ``'trunk'``, ``'branches/name'`` or - ``'tags/name'``. *version* is the output of ``svnversion``, if the interpreter - was built from a Subversion checkout; it contains the revision number (range) - and possibly a trailing 'M' if there were local modifications. If the tree was - exported (or svnversion was not available), it is the revision of - ``Include/patchlevel.h`` if the branch is a tag. Otherwise, it is ``None``. - - .. data:: builtin_module_names A tuple of strings giving the names of all modules that are compiled into this diff --git a/Include/pythonrun.h b/Include/pythonrun.h index bbcae73d218..2cf929fb4b0 100644 --- a/Include/pythonrun.h +++ b/Include/pythonrun.h @@ -179,9 +179,6 @@ PyAPI_FUNC(const char *) Py_GetCopyright(void); PyAPI_FUNC(const char *) Py_GetCompiler(void); PyAPI_FUNC(const char *) Py_GetBuildInfo(void); #ifndef Py_LIMITED_API -PyAPI_FUNC(const char *) _Py_svnversion(void); -PyAPI_FUNC(const char *) Py_SubversionRevision(void); -PyAPI_FUNC(const char *) Py_SubversionShortBranch(void); PyAPI_FUNC(const char *) _Py_hgidentifier(void); PyAPI_FUNC(const char *) _Py_hgversion(void); #endif diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 9201154fb6b..b59f6e6e2ec 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -56,13 +56,11 @@ class PlatformTest(unittest.TestCase): def setUp(self): self.save_version = sys.version - self.save_subversion = sys.subversion self.save_mercurial = sys._mercurial self.save_platform = sys.platform def tearDown(self): sys.version = self.save_version - sys.subversion = self.save_subversion sys._mercurial = self.save_mercurial sys.platform = self.save_platform @@ -77,7 +75,7 @@ class PlatformTest(unittest.TestCase): ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')), ): # branch and revision are not "parsed", but fetched - # from sys.subversion. Ignore them + # from sys._mercurial. Ignore them (name, version, branch, revision, buildno, builddate, compiler) \ = platform._sys_version(input) self.assertEqual( @@ -113,8 +111,6 @@ class PlatformTest(unittest.TestCase): if subversion is None: if hasattr(sys, "_mercurial"): del sys._mercurial - if hasattr(sys, "subversion"): - del sys.subversion else: sys._mercurial = subversion if sys_platform is not None: diff --git a/Makefile.pre.in b/Makefile.pre.in index 0a9f8e22f6f..3312c6f36e2 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -34,7 +34,6 @@ MAINCC= @MAINCC@ LINKCC= @LINKCC@ AR= @AR@ RANLIB= @RANLIB@ -SVNVERSION= @SVNVERSION@ SOABI= @SOABI@ LDVERSION= @LDVERSION@ HGVERSION= @HGVERSION@ @@ -556,7 +555,6 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \ $(MODOBJS) \ $(srcdir)/Modules/getbuildinfo.c $(CC) -c $(PY_CORE_CFLAGS) \ - -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" \ -DHGVERSION="\"`LC_ALL=C $(HGVERSION)`\"" \ -DHGTAG="\"`LC_ALL=C $(HGTAG)`\"" \ -DHGBRANCH="\"`LC_ALL=C $(HGBRANCH)`\"" \ @@ -1281,7 +1279,6 @@ smelly: all # Find files with funny names funny: find $(DISTDIRS) \ - -name .svn -prune \ -o -type d \ -o -name '*.[chs]' \ -o -name '*.py' \ diff --git a/Modules/getbuildinfo.c b/Modules/getbuildinfo.c index c70126d5841..a4d839eed9a 100644 --- a/Modules/getbuildinfo.c +++ b/Modules/getbuildinfo.c @@ -20,14 +20,6 @@ #endif #endif -/* on unix, SVNVERSION is passed on the command line. - * on Windows, the string is interpolated using - * subwcrev.exe - */ -#ifndef SVNVERSION -#define SVNVERSION "$WCRANGE$$WCMODS?M:$" -#endif - /* XXX Only unix build process has been tested */ #ifndef HGVERSION #define HGVERSION "" @@ -54,16 +46,6 @@ Py_GetBuildInfo(void) return buildinfo; } -const char * -_Py_svnversion(void) -{ - /* the following string can be modified by subwcrev.exe */ - static const char svnversion[] = SVNVERSION; - if (svnversion[0] != '$') - return svnversion; /* it was interpolated, or passed on command line */ - return "Unversioned directory"; -} - const char * _Py_hgversion(void) { diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 9c94ececd52..d06adc0acac 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1255,7 +1255,6 @@ int_info -- a struct sequence with information about the int implementation.\n\ maxsize -- the largest supported length of containers.\n\ maxunicode -- the largest supported character\n\ builtin_module_names -- tuple of module names built into this interpreter\n\ -subversion -- subversion information of the build as tuple\n\ version -- the version of this interpreter as a string\n\ version_info -- version information as a named tuple\n\ hexversion -- version information encoded as a single integer\n\ @@ -1303,95 +1302,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]; -static char shortbranch[50]; -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; -} - -/* Return svnversion output if available. - Else return Revision of patchlevel.h if on branch. - Else return empty string */ -const char* -Py_SubversionRevision() -{ - svnversion_init(); - return svn_revision; -} - -const char* -Py_SubversionShortBranch() -{ - svnversion_init(); - return shortbranch; -} - PyDoc_STRVAR(flags__doc__, "sys.flags\n\ @@ -1595,10 +1505,6 @@ _PySys_Init(void) PyUnicode_FromString(Py_GetVersion())); SET_SYS_FROM_STRING("hexversion", PyLong_FromLong(PY_VERSION_HEX)); - svnversion_init(); - SET_SYS_FROM_STRING("subversion", - Py_BuildValue("(sss)", "CPython", branch, - svn_revision)); SET_SYS_FROM_STRING("_mercurial", Py_BuildValue("(szz)", "CPython", _Py_hgidentifier(), _Py_hgversion())); diff --git a/configure b/configure index f87f7ef6cb5..5c41087fbf2 100755 --- a/configure +++ b/configure @@ -648,7 +648,6 @@ HAS_HG HGBRANCH HGTAG HGVERSION -SVNVERSION ARFLAGS AR RANLIB @@ -5125,52 +5124,6 @@ then fi -# Extract the first word of "svnversion", so it can be a program name with args. -set dummy svnversion; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_SVNVERSION+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$SVNVERSION"; then - ac_cv_prog_SVNVERSION="$SVNVERSION" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_SVNVERSION="found" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_prog_SVNVERSION" && ac_cv_prog_SVNVERSION="not-found" -fi -fi -SVNVERSION=$ac_cv_prog_SVNVERSION -if test -n "$SVNVERSION"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SVNVERSION" >&5 -$as_echo "$SVNVERSION" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -if test $SVNVERSION = found -then - SVNVERSION="svnversion \$(srcdir)" -else - SVNVERSION="echo Unversioned directory" -fi - - # Extract the first word of "hg", so it can be a program name with args. diff --git a/configure.in b/configure.in index 5eae5e70173..9dc160cd75d 100644 --- a/configure.in +++ b/configure.in @@ -801,15 +801,6 @@ then ARFLAGS="rc" fi -AC_SUBST(SVNVERSION) -AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found) -if test $SVNVERSION = found -then - SVNVERSION="svnversion \$(srcdir)" -else - SVNVERSION="echo Unversioned directory" -fi - AC_SUBST(HGVERSION) AC_SUBST(HGTAG) AC_SUBST(HGBRANCH)