| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7b50c2c commit 1ca2e79
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -120,6 +120,8 @@ PyAPI_FUNC(const char *) Py_GetBuildInfo(void); | |||
| 120 | 120 | PyAPI_FUNC(const char *) _Py_svnversion(void); | |
| 121 | 121 | PyAPI_FUNC(const char *) Py_SubversionRevision(void); | |
| 122 | 122 | PyAPI_FUNC(const char *) Py_SubversionShortBranch(void); | |
| 123 | + PyAPI_FUNC(const char *) _Py_hgidentifier(void); | ||
| 124 | + PyAPI_FUNC(const char *) _Py_hgversion(void); | ||
| 123 | 125 | ||
| 124 | 126 | /* Internal -- various one-time initializations */ | |
| 125 | 127 | PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,6 +35,9 @@ LINKCC= @LINKCC@ | |||
| 35 | 35 | AR= @AR@ | |
| 36 | 36 | RANLIB= @RANLIB@ | |
| 37 | 37 | SVNVERSION= @SVNVERSION@ | |
| 38 | + HGVERSION= @HGVERSION@ | ||
| 39 | + HGTAG= @HGTAG@ | ||
| 40 | + HGBRANCH= @HGBRANCH@ | ||
| 38 | 41 | ||
| 39 | 42 | GNULD= @GNULD@ | |
| 40 | 43 | ||
@@ -525,7 +528,12 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \ | |||
| 525 | 528 | $(SIGNAL_OBJS) \ | |
| 526 | 529 | $(MODOBJS) \ | |
| 527 | 530 | $(srcdir)/Modules/getbuildinfo.c | |
| 528 | - $(CC) -c $(PY_CFLAGS) -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" -o $@ $(srcdir)/Modules/getbuildinfo.c | ||
| 531 | + $(CC) -c $(PY_CFLAGS) \ | ||
| 532 | + -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" \ | ||
| 533 | + -DHGVERSION="\"`LC_ALL=C $(HGVERSION)`\"" \ | ||
| 534 | + -DHGTAG="\"`LC_ALL=C $(HGTAG)`\"" \ | ||
| 535 | + -DHGBRANCH="\"`LC_ALL=C $(HGBRANCH)`\"" \ | ||
| 536 | + -o $@ $(srcdir)/Modules/getbuildinfo.c | ||
| 529 | 537 | ||
| 530 | 538 | Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile | |
| 531 | 539 | $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,15 +28,28 @@ | |||
| 28 | 28 | #define SVNVERSION "$WCRANGE$$WCMODS?M:$" | |
| 29 | 29 | #endif | |
| 30 | 30 | ||
| 31 | + /* XXX Only unix build process has been tested */ | ||
| 32 | + #ifndef HGVERSION | ||
| 33 | + #define HGVERSION "" | ||
| 34 | + #endif | ||
| 35 | + #ifndef HGTAG | ||
| 36 | + #define HGTAG "" | ||
| 37 | + #endif | ||
| 38 | + #ifndef HGBRANCH | ||
| 39 | + #define HGBRANCH "" | ||
| 40 | + #endif | ||
| 41 | + | ||
| 31 | 42 | const char * | |
| 32 | 43 | Py_GetBuildInfo(void) | |
| 33 | 44 | { | |
| 34 | 45 | static char buildinfo[50]; | |
| 35 | - const char *revision = Py_SubversionRevision(); | ||
| 46 | + const char *revision = _Py_hgversion(); | ||
| 36 | 47 | const char *sep = *revision ? ":" : ""; | |
| 37 | - const char *branch = Py_SubversionShortBranch(); | ||
| 48 | + const char *hgid = _Py_hgidentifier(); | ||
| 49 | + if (!(*hgid)) | ||
| 50 | + hgid = "default"; | ||
| 38 | 51 | PyOS_snprintf(buildinfo, sizeof(buildinfo), | |
| 39 | - "%s%s%s, %.20s, %.9s", branch, sep, revision, | ||
| 52 | + "%s%s%s, %.20s, %.9s", hgid, sep, revision, | ||
| 40 | 53 | DATE, TIME); | |
| 41 | 54 | return buildinfo; | |
| 42 | 55 | } | |
@@ -50,3 +63,21 @@ _Py_svnversion(void) | |||
| 50 | 63 | return svnversion; /* it was interpolated, or passed on command line */ | |
| 51 | 64 | return "Unversioned directory"; | |
| 52 | 65 | } | |
| 66 | + | ||
| 67 | + const char * | ||
| 68 | + _Py_hgversion(void) | ||
| 69 | + { | ||
| 70 | + return HGVERSION; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + const char * | ||
| 74 | + _Py_hgidentifier(void) | ||
| 75 | + { | ||
| 76 | + const char *hgtag, *hgid; | ||
| 77 | + hgtag = HGTAG; | ||
| 78 | + if ((*hgtag) && strcmp(hgtag, "tip") != 0) | ||
| 79 | + hgid = hgtag; | ||
| 80 | + else | ||
| 81 | + hgid = HGBRANCH; | ||
| 82 | + return hgid; | ||
| 83 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1358,6 +1358,9 @@ _PySys_Init(void) | |||
| 1358 | 1358 | SET_SYS_FROM_STRING("subversion", | |
| 1359 | 1359 | Py_BuildValue("(UUU)", "CPython", branch, | |
| 1360 | 1360 | svn_revision)); | |
| 1361 | + SET_SYS_FROM_STRING("_mercurial", | ||
| 1362 | + Py_BuildValue("(szz)", "CPython", _Py_hgidentifier(), | ||
| 1363 | + _Py_hgversion())); | ||
| 1361 | 1364 | SET_SYS_FROM_STRING("dont_write_bytecode", | |
| 1362 | 1365 | PyBool_FromLong(Py_DontWriteBytecodeFlag)); | |
| 1363 | 1366 | SET_SYS_FROM_STRING("api_version", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | #! /bin/sh | |
| 2 | - # From configure.in Revision: 88561 . | ||
| 2 | + # From configure.in Revision. | ||
| 3 | 3 | # Guess values for system-dependent variables and create Makefiles. | |
| 4 | 4 | # Generated by GNU Autoconf 2.68 for python 3.1. | |
| 5 | 5 | # | |
@@ -639,6 +639,10 @@ LN | |||
| 639 | 639 | INSTALL_DATA | |
| 640 | 640 | INSTALL_SCRIPT | |
| 641 | 641 | INSTALL_PROGRAM | |
| 642 | + HAS_HG | ||
| 643 | + HGBRANCH | ||
| 644 | + HGTAG | ||
| 645 | + HGVERSION | ||
| 642 | 646 | SVNVERSION | |
| 643 | 647 | ARFLAGS | |
| 644 | 648 | AR | |
@@ -5089,6 +5093,58 @@ else | |||
| 5089 | 5093 | SVNVERSION="echo Unversioned directory" | |
| 5090 | 5094 | fi | |
| 5091 | 5095 | ||
| 5096 | + | ||
| 5097 | + | ||
| 5098 | + | ||
| 5099 | + # Extract the first word of "hg", so it can be a program name with args. | ||
| 5100 | + set dummy hg; ac_word=$2 | ||
| 5101 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | ||
| 5102 | + $as_echo_n "checking for $ac_word... " >&6; } | ||
| 5103 | + if ${ac_cv_prog_HAS_HG+:} false; then : | ||
| 5104 | + $as_echo_n "(cached) " >&6 | ||
| 5105 | + else | ||
| 5106 | + if test -n "$HAS_HG"; then | ||
| 5107 | + ac_cv_prog_HAS_HG="$HAS_HG" # Let the user override the test. | ||
| 5108 | + else | ||
| 5109 | + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | ||
| 5110 | + for as_dir in $PATH | ||
| 5111 | + do | ||
| 5112 | + IFS=$as_save_IFS | ||
| 5113 | + test -z "$as_dir" && as_dir=. | ||
| 5114 | + for ac_exec_ext in '' $ac_executable_extensions; do | ||
| 5115 | + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | ||
| 5116 | + ac_cv_prog_HAS_HG="found" | ||
| 5117 | + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | ||
| 5118 | + break 2 | ||
| 5119 | + fi | ||
| 5120 | + done | ||
| 5121 | + done | ||
| 5122 | + IFS=$as_save_IFS | ||
| 5123 | + | ||
| 5124 | + test -z "$ac_cv_prog_HAS_HG" && ac_cv_prog_HAS_HG="not-found" | ||
| 5125 | + fi | ||
| 5126 | + fi | ||
| 5127 | + HAS_HG=$ac_cv_prog_HAS_HG | ||
| 5128 | + if test -n "$HAS_HG"; then | ||
| 5129 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAS_HG" >&5 | ||
| 5130 | + $as_echo "$HAS_HG" >&6; } | ||
| 5131 | + else | ||
| 5132 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | ||
| 5133 | + $as_echo "no" >&6; } | ||
| 5134 | + fi | ||
| 5135 | + | ||
| 5136 | + | ||
| 5137 | + if test $HAS_HG = found | ||
| 5138 | + then | ||
| 5139 | + HGVERSION="hg id -i \$(srcdir)" | ||
| 5140 | + HGTAG="hg id -t \$(srcdir)" | ||
| 5141 | + HGBRANCH="hg id -b \$(srcdir)" | ||
| 5142 | + else | ||
| 5143 | + HGVERSION="" | ||
| 5144 | + HGTAG="" | ||
| 5145 | + HGBRANCH="" | ||
| 5146 | + fi | ||
| 5147 | + | ||
| 5092 | 5148 | case $MACHDEP in | |
| 5093 | 5149 | bsdos*|hp*|HP*) | |
| 5094 | 5150 | # install -d does not work on BSDI or HP-UX | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -785,6 +785,21 @@ else | |||
| 785 | 785 | SVNVERSION="echo Unversioned directory" | |
| 786 | 786 | fi | |
| 787 | 787 | ||
| 788 | + AC_SUBST(HGVERSION) | ||
| 789 | + AC_SUBST(HGTAG) | ||
| 790 | + AC_SUBST(HGBRANCH) | ||
| 791 | + AC_CHECK_PROG(HAS_HG, hg, found, not-found) | ||
| 792 | + if test $HAS_HG = found | ||
| 793 | + then | ||
| 794 | + HGVERSION="hg id -i \$(srcdir)" | ||
| 795 | + HGTAG="hg id -t \$(srcdir)" | ||
| 796 | + HGBRANCH="hg id -b \$(srcdir)" | ||
| 797 | + else | ||
| 798 | + HGVERSION="" | ||
| 799 | + HGTAG="" | ||
| 800 | + HGBRANCH="" | ||
| 801 | + fi | ||
| 802 | + | ||
| 788 | 803 | case $MACHDEP in | |
| 789 | 804 | bsdos*|hp*|HP*) | |
| 790 | 805 | # install -d does not work on BSDI or HP-UX | |
| Back | FazBrowse Home | New Git URL |
0 commit comments