Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
43b57805
Commit
43b57805
authored
Jan 05, 2006
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop sys.build_number. Add sys.subversion.
parent
2b474452
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
25 deletions
+114
-25
Doc/lib/libsys.tex
Doc/lib/libsys.tex
+13
-4
Include/patchlevel.h
Include/patchlevel.h
+3
-0
Include/pythonrun.h
Include/pythonrun.h
+3
-1
Modules/getbuildinfo.c
Modules/getbuildinfo.c
+11
-18
Python/sysmodule.c
Python/sysmodule.c
+84
-2
No files found.
Doc/lib/libsys.tex
View file @
43b57805
...
@@ -27,10 +27,19 @@ It is always available.
...
@@ -27,10 +27,19 @@ It is always available.
\versionadded
{
2.0
}
\versionadded
{
2.0
}
\end{datadesc}
\end{datadesc}
\begin{datadesc}
{
build
_
number
}
\begin{datadesc}
{
subversion
}
A string representing the Subversion revision that this Python executable
A triple (repo, branch, version) representing the Subversion
was built from. This number is a string because it may contain a trailing
information of the Python interpreter.
'M' if Python was built from a mixed revision source tree.
\var
{
repo
}
is the name of the repository,
\code
{
'CPython'
}
.
\var
{
branch
}
is the a string of one of the forms
\code
{
'trunk'
}
,
\code
{
'branches/name'
}
or
\code
{
'tags/name'
}
.
\var
{
version
}
is the output of
\code
{
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
\code
{
Include/patchlevel.h
}
if the branch is a tag. Otherwise,
it is
\code
{
None
}
.
\versionadded
{
2.5
}
\versionadded
{
2.5
}
\end{datadesc}
\end{datadesc}
...
...
Include/patchlevel.h
View file @
43b57805
...
@@ -28,6 +28,9 @@
...
@@ -28,6 +28,9 @@
/* Version as a string */
/* Version as a string */
#define PY_VERSION "2.5a0"
#define PY_VERSION "2.5a0"
/* Subversion Revision number of this file (not of the repository) */
#define PY_PATCHLEVEL_REVISION "$Revision$"
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \
#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \
...
...
Include/pythonrun.h
View file @
43b57805
...
@@ -108,7 +108,9 @@ PyAPI_FUNC(const char *) Py_GetPlatform(void);
...
@@ -108,7 +108,9 @@ PyAPI_FUNC(const char *) Py_GetPlatform(void);
PyAPI_FUNC
(
const
char
*
)
Py_GetCopyright
(
void
);
PyAPI_FUNC
(
const
char
*
)
Py_GetCopyright
(
void
);
PyAPI_FUNC
(
const
char
*
)
Py_GetCompiler
(
void
);
PyAPI_FUNC
(
const
char
*
)
Py_GetCompiler
(
void
);
PyAPI_FUNC
(
const
char
*
)
Py_GetBuildInfo
(
void
);
PyAPI_FUNC
(
const
char
*
)
Py_GetBuildInfo
(
void
);
PyAPI_FUNC
(
const
char
*
)
Py_GetBuildNumber
(
void
);
PyAPI_FUNC
(
const
char
*
)
_Py_svnversion
(
void
);
PyAPI_FUNC
(
const
char
*
)
Py_SubversionRevision
(
void
);
PyAPI_FUNC
(
const
char
*
)
Py_SubversionShortBranch
(
void
);
/* Internal -- various one-time initializations */
/* Internal -- various one-time initializations */
PyAPI_FUNC
(
PyObject
*
)
_PyBuiltin_Init
(
void
);
PyAPI_FUNC
(
PyObject
*
)
_PyBuiltin_Init
(
void
);
...
...
Modules/getbuildinfo.c
View file @
43b57805
...
@@ -20,32 +20,25 @@
...
@@ -20,32 +20,25 @@
#endif
#endif
#endif
#endif
static
const
char
revision
[]
=
"$Revision$"
;
static
const
char
headurl
[]
=
"$HeadURL$"
;
const
char
*
const
char
*
Py_GetBuildInfo
(
void
)
Py_GetBuildInfo
(
void
)
{
{
static
char
buildinfo
[
50
];
static
char
buildinfo
[
50
];
#ifdef SVNVERSION
char
*
revision
=
Py_SubversionRevision
();
static
char
svnversion
[
50
]
=
SVNVERSION
;
char
*
sep
=
revision
?
":"
:
""
;
#else
char
*
branch
=
Py_SubversionShortBranch
();
static
char
svnversion
[
50
]
=
"exported"
;
#endif
if
(
strcmp
(
svnversion
,
"exported"
)
==
0
&&
strstr
(
headurl
,
"/tags/"
)
!=
NULL
)
{
int
start
=
11
;
int
stop
=
strlen
(
revision
)
-
2
;
strncpy
(
svnversion
,
revision
+
start
,
stop
-
start
);
svnversion
[
stop
-
start
]
=
'\0'
;
}
PyOS_snprintf
(
buildinfo
,
sizeof
(
buildinfo
),
PyOS_snprintf
(
buildinfo
,
sizeof
(
buildinfo
),
"%s, %.20s, %.9s"
,
svnversion
,
DATE
,
TIME
);
"%s%s%s, %.20s, %.9s"
,
branch
,
sep
,
revision
,
DATE
,
TIME
);
return
buildinfo
;
return
buildinfo
;
}
}
const
char
*
const
char
*
Py_GetBuildNumber
(
void
)
_Py_svnversion
(
void
)
{
{
return
"0"
;
#ifdef SVNVERSION
return
SVNVERSION
;
#else
return
"exported"
;
#endif
}
}
Python/sysmodule.c
View file @
43b57805
...
@@ -934,6 +934,87 @@ _check_and_flush (FILE *stream)
...
@@ -934,6 +934,87 @@ _check_and_flush (FILE *stream)
return
fflush
(
stream
)
||
prev_fail
?
EOF
:
0
;
return
fflush
(
stream
)
||
prev_fail
?
EOF
:
0
;
}
}
/* 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
;
int
len
,
istag
;
if
(
svn_initialized
)
return
;
python
=
strstr
(
headurl
,
"/python/"
);
if
(
!
python
)
Py_FatalError
(
"subversion keywords missing"
);
br_start
=
python
+
8
;
br_end
=
strchr
(
br_start
,
'/'
);
/* 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
,
"exported"
)
!=
0
)
svn_revision
=
svnversion
;
else
if
(
istag
)
{
len
=
strlen
(
_patchlevel_revision
);
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
;
}
PyObject
*
PyObject
*
_PySys_Init
(
void
)
_PySys_Init
(
void
)
{
{
...
@@ -1003,8 +1084,9 @@ _PySys_Init(void)
...
@@ -1003,8 +1084,9 @@ _PySys_Init(void)
PyDict_SetItemString
(
sysdict
,
"hexversion"
,
PyDict_SetItemString
(
sysdict
,
"hexversion"
,
v
=
PyInt_FromLong
(
PY_VERSION_HEX
));
v
=
PyInt_FromLong
(
PY_VERSION_HEX
));
Py_XDECREF
(
v
);
Py_XDECREF
(
v
);
PyDict_SetItemString
(
sysdict
,
"build_number"
,
svnversion_init
();
v
=
PyString_FromString
(
Py_GetBuildNumber
()));
v
=
Py_BuildValue
(
"(ssz)"
,
"CPython"
,
branch
,
svn_revision
);
PyDict_SetItemString
(
sysdict
,
"subversion"
,
v
);
Py_XDECREF
(
v
);
Py_XDECREF
(
v
);
/*
/*
* These release level checks are mutually exclusive and cover
* These release level checks are mutually exclusive and cover
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment