[Python-checkins] cpython: Remove sys.subversion and svn build identification leftovers.

georg.brandl python-checkins at python.org
Sun Mar 6 10:36:14 CET 2011


http://hg.python.org/cpython/rev/0e7e3b1621da
changeset:   68278:0e7e3b1621da
user:        Georg Brandl <georg at python.org>
date:        Sun Mar 06 10:35:42 2011 +0100
summary:
  Remove sys.subversion and svn build identification leftovers.

files:
  Doc/library/sys.rst
  Include/pythonrun.h
  Lib/test/test_platform.py
  Makefile.pre.in
  Modules/getbuildinfo.c
  Python/sysmodule.c
  configure
  configure.in

diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -36,18 +36,6 @@
    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
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -179,9 +179,6 @@
 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
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -56,13 +56,11 @@
 
     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 @@
              ('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 @@
             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
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -34,7 +34,6 @@
 LINKCC=		@LINKCC@
 AR=		@AR@
 RANLIB=		@RANLIB@
-SVNVERSION=	@SVNVERSION@
 SOABI=		@SOABI@
 LDVERSION=	@LDVERSION@
 HGVERSION=	@HGVERSION@
@@ -556,7 +555,6 @@
 		$(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 @@
 # 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
--- 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 ""
@@ -55,16 +47,6 @@
 }
 
 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)
 {
     return HGVERSION;
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1255,7 +1255,6 @@
 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 @@
 )
 /* 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 @@
                          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
--- a/configure
+++ b/configure
@@ -648,7 +648,6 @@
 HGBRANCH
 HGTAG
 HGVERSION
-SVNVERSION
 ARFLAGS
 AR
 RANLIB
@@ -5125,52 +5124,6 @@
 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
--- a/configure.in
+++ b/configure.in
@@ -801,15 +801,6 @@
         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)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list