Port build identification from default branch.
This commit is contained in:
parent
93512f24f1
commit
3a5508e2c0
|
@ -114,6 +114,8 @@ PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
|
||||||
PyAPI_FUNC(const char *) _Py_svnversion(void);
|
PyAPI_FUNC(const char *) _Py_svnversion(void);
|
||||||
PyAPI_FUNC(const char *) Py_SubversionRevision(void);
|
PyAPI_FUNC(const char *) Py_SubversionRevision(void);
|
||||||
PyAPI_FUNC(const char *) Py_SubversionShortBranch(void);
|
PyAPI_FUNC(const char *) Py_SubversionShortBranch(void);
|
||||||
|
PyAPI_FUNC(const char *) _Py_hgidentifier(void);
|
||||||
|
PyAPI_FUNC(const char *) _Py_hgversion(void);
|
||||||
|
|
||||||
/* Internal -- various one-time initializations */
|
/* Internal -- various one-time initializations */
|
||||||
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
|
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
|
||||||
|
|
|
@ -35,6 +35,9 @@ LINKCC= @LINKCC@
|
||||||
AR= @AR@
|
AR= @AR@
|
||||||
RANLIB= @RANLIB@
|
RANLIB= @RANLIB@
|
||||||
SVNVERSION= @SVNVERSION@
|
SVNVERSION= @SVNVERSION@
|
||||||
|
HGVERSION= @HGVERSION@
|
||||||
|
HGTAG= @HGTAG@
|
||||||
|
HGBRANCH= @HGBRANCH@
|
||||||
|
|
||||||
GNULD= @GNULD@
|
GNULD= @GNULD@
|
||||||
|
|
||||||
|
@ -522,7 +525,12 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \
|
||||||
$(SIGNAL_OBJS) \
|
$(SIGNAL_OBJS) \
|
||||||
$(MODOBJS) \
|
$(MODOBJS) \
|
||||||
$(srcdir)/Modules/getbuildinfo.c
|
$(srcdir)/Modules/getbuildinfo.c
|
||||||
$(CC) -c $(PY_CFLAGS) -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" -o $@ $(srcdir)/Modules/getbuildinfo.c
|
$(CC) -c $(PY_CFLAGS) \
|
||||||
|
-DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" \
|
||||||
|
-DHGVERSION="\"`LC_ALL=C $(HGVERSION)`\"" \
|
||||||
|
-DHGTAG="\"`LC_ALL=C $(HGTAG)`\"" \
|
||||||
|
-DHGBRANCH="\"`LC_ALL=C $(HGBRANCH)`\"" \
|
||||||
|
-o $@ $(srcdir)/Modules/getbuildinfo.c
|
||||||
|
|
||||||
Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
|
Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
|
||||||
$(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
|
$(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
|
||||||
|
|
|
@ -28,15 +28,28 @@
|
||||||
#define SVNVERSION "$WCRANGE$$WCMODS?M:$"
|
#define SVNVERSION "$WCRANGE$$WCMODS?M:$"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* XXX Only unix build process has been tested */
|
||||||
|
#ifndef HGVERSION
|
||||||
|
#define HGVERSION ""
|
||||||
|
#endif
|
||||||
|
#ifndef HGTAG
|
||||||
|
#define HGTAG ""
|
||||||
|
#endif
|
||||||
|
#ifndef HGBRANCH
|
||||||
|
#define HGBRANCH ""
|
||||||
|
#endif
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
Py_GetBuildInfo(void)
|
Py_GetBuildInfo(void)
|
||||||
{
|
{
|
||||||
static char buildinfo[50];
|
static char buildinfo[50];
|
||||||
const char *revision = Py_SubversionRevision();
|
const char *revision = _Py_hgversion();
|
||||||
const char *sep = *revision ? ":" : "";
|
const char *sep = *revision ? ":" : "";
|
||||||
const char *branch = Py_SubversionShortBranch();
|
const char *hgid = _Py_hgidentifier();
|
||||||
|
if (!(*hgid))
|
||||||
|
hgid = "default";
|
||||||
PyOS_snprintf(buildinfo, sizeof(buildinfo),
|
PyOS_snprintf(buildinfo, sizeof(buildinfo),
|
||||||
"%s%s%s, %.20s, %.9s", branch, sep, revision,
|
"%s%s%s, %.20s, %.9s", hgid, sep, revision,
|
||||||
DATE, TIME);
|
DATE, TIME);
|
||||||
return buildinfo;
|
return buildinfo;
|
||||||
}
|
}
|
||||||
|
@ -50,3 +63,21 @@ _Py_svnversion(void)
|
||||||
return svnversion; /* it was interpolated, or passed on command line */
|
return svnversion; /* it was interpolated, or passed on command line */
|
||||||
return "Unversioned directory";
|
return "Unversioned directory";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
_Py_hgversion(void)
|
||||||
|
{
|
||||||
|
return HGVERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
_Py_hgidentifier(void)
|
||||||
|
{
|
||||||
|
const char *hgtag, *hgid;
|
||||||
|
hgtag = HGTAG;
|
||||||
|
if ((*hgtag) && strcmp(hgtag, "tip") != 0)
|
||||||
|
hgid = hgtag;
|
||||||
|
else
|
||||||
|
hgid = HGBRANCH;
|
||||||
|
return hgid;
|
||||||
|
}
|
||||||
|
|
|
@ -1462,6 +1462,9 @@ _PySys_Init(void)
|
||||||
SET_SYS_FROM_STRING("subversion",
|
SET_SYS_FROM_STRING("subversion",
|
||||||
Py_BuildValue("(ssz)", "CPython", branch,
|
Py_BuildValue("(ssz)", "CPython", branch,
|
||||||
svn_revision));
|
svn_revision));
|
||||||
|
SET_SYS_FROM_STRING("_mercurial",
|
||||||
|
Py_BuildValue("(szz)", "CPython", _Py_hgidentifier(),
|
||||||
|
_Py_hgversion()));
|
||||||
SET_SYS_FROM_STRING("dont_write_bytecode",
|
SET_SYS_FROM_STRING("dont_write_bytecode",
|
||||||
PyBool_FromLong(Py_DontWriteBytecodeFlag));
|
PyBool_FromLong(Py_DontWriteBytecodeFlag));
|
||||||
SET_SYS_FROM_STRING("api_version",
|
SET_SYS_FROM_STRING("api_version",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# From configure.in Revision: 88568 .
|
# From configure.in Revision.
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.68 for python 2.7.
|
# Generated by GNU Autoconf 2.68 for python 2.7.
|
||||||
#
|
#
|
||||||
|
@ -643,6 +643,10 @@ LN
|
||||||
INSTALL_DATA
|
INSTALL_DATA
|
||||||
INSTALL_SCRIPT
|
INSTALL_SCRIPT
|
||||||
INSTALL_PROGRAM
|
INSTALL_PROGRAM
|
||||||
|
HAS_HG
|
||||||
|
HGBRANCH
|
||||||
|
HGTAG
|
||||||
|
HGVERSION
|
||||||
SVNVERSION
|
SVNVERSION
|
||||||
ARFLAGS
|
ARFLAGS
|
||||||
AR
|
AR
|
||||||
|
@ -5169,6 +5173,58 @@ else
|
||||||
SVNVERSION="echo Unversioned directory"
|
SVNVERSION="echo Unversioned directory"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Extract the first word of "hg", so it can be a program name with args.
|
||||||
|
set dummy hg; 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_HAS_HG+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
if test -n "$HAS_HG"; then
|
||||||
|
ac_cv_prog_HAS_HG="$HAS_HG" # 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_HAS_HG="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_HAS_HG" && ac_cv_prog_HAS_HG="not-found"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
HAS_HG=$ac_cv_prog_HAS_HG
|
||||||
|
if test -n "$HAS_HG"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAS_HG" >&5
|
||||||
|
$as_echo "$HAS_HG" >&6; }
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test $HAS_HG = found
|
||||||
|
then
|
||||||
|
HGVERSION="hg id -i \$(srcdir)"
|
||||||
|
HGTAG="hg id -t \$(srcdir)"
|
||||||
|
HGBRANCH="hg id -b \$(srcdir)"
|
||||||
|
else
|
||||||
|
HGVERSION=""
|
||||||
|
HGTAG=""
|
||||||
|
HGBRANCH=""
|
||||||
|
fi
|
||||||
|
|
||||||
case $MACHDEP in
|
case $MACHDEP in
|
||||||
bsdos*|hp*|HP*)
|
bsdos*|hp*|HP*)
|
||||||
# install -d does not work on BSDI or HP-UX
|
# install -d does not work on BSDI or HP-UX
|
||||||
|
|
15
configure.in
15
configure.in
|
@ -853,6 +853,21 @@ else
|
||||||
SVNVERSION="echo Unversioned directory"
|
SVNVERSION="echo Unversioned directory"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(HGVERSION)
|
||||||
|
AC_SUBST(HGTAG)
|
||||||
|
AC_SUBST(HGBRANCH)
|
||||||
|
AC_CHECK_PROG(HAS_HG, hg, found, not-found)
|
||||||
|
if test $HAS_HG = found
|
||||||
|
then
|
||||||
|
HGVERSION="hg id -i \$(srcdir)"
|
||||||
|
HGTAG="hg id -t \$(srcdir)"
|
||||||
|
HGBRANCH="hg id -b \$(srcdir)"
|
||||||
|
else
|
||||||
|
HGVERSION=""
|
||||||
|
HGTAG=""
|
||||||
|
HGBRANCH=""
|
||||||
|
fi
|
||||||
|
|
||||||
case $MACHDEP in
|
case $MACHDEP in
|
||||||
bsdos*|hp*|HP*)
|
bsdos*|hp*|HP*)
|
||||||
# install -d does not work on BSDI or HP-UX
|
# install -d does not work on BSDI or HP-UX
|
||||||
|
|
Loading…
Reference in New Issue