Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
43b57805
Kaydet (Commit)
43b57805
authored
Ock 05, 2006
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Drop sys.build_number. Add sys.subversion.
üst
2b474452
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
25 deletions
+114
-25
libsys.tex
Doc/lib/libsys.tex
+13
-4
patchlevel.h
Include/patchlevel.h
+3
-0
pythonrun.h
Include/pythonrun.h
+3
-1
getbuildinfo.c
Modules/getbuildinfo.c
+11
-18
sysmodule.c
Python/sysmodule.c
+84
-2
No files found.
Doc/lib/libsys.tex
Dosyayı görüntüle @
43b57805
...
...
@@ -27,10 +27,19 @@ It is always available.
\versionadded
{
2.0
}
\end{datadesc}
\begin{datadesc}
{
build
_
number
}
A string representing the Subversion revision that this Python executable
was built from. This number is a string because it may contain a trailing
'M' if Python was built from a mixed revision source tree.
\begin{datadesc}
{
subversion
}
A triple (repo, branch, version) representing the Subversion
information of the Python interpreter.
\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
}
\end{datadesc}
...
...
Include/patchlevel.h
Dosyayı görüntüle @
43b57805
...
...
@@ -28,6 +28,9 @@
/* Version as a string */
#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.
Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \
...
...
Include/pythonrun.h
Dosyayı görüntüle @
43b57805
...
...
@@ -108,7 +108,9 @@ PyAPI_FUNC(const char *) Py_GetPlatform(void);
PyAPI_FUNC
(
const
char
*
)
Py_GetCopyright
(
void
);
PyAPI_FUNC
(
const
char
*
)
Py_GetCompiler
(
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 */
PyAPI_FUNC
(
PyObject
*
)
_PyBuiltin_Init
(
void
);
...
...
Modules/getbuildinfo.c
Dosyayı görüntüle @
43b57805
...
...
@@ -20,32 +20,25 @@
#endif
#endif
static
const
char
revision
[]
=
"$Revision$"
;
static
const
char
headurl
[]
=
"$HeadURL$"
;
const
char
*
Py_GetBuildInfo
(
void
)
{
static
char
buildinfo
[
50
];
#ifdef SVNVERSION
static
char
svnversion
[
50
]
=
SVNVERSION
;
#else
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'
;
}
char
*
revision
=
Py_SubversionRevision
();
char
*
sep
=
revision
?
":"
:
""
;
char
*
branch
=
Py_SubversionShortBranch
();
PyOS_snprintf
(
buildinfo
,
sizeof
(
buildinfo
),
"%s, %.20s, %.9s"
,
svnversion
,
DATE
,
TIME
);
"%s%s%s, %.20s, %.9s"
,
branch
,
sep
,
revision
,
DATE
,
TIME
);
return
buildinfo
;
}
const
char
*
Py_GetBuildNumber
(
void
)
_Py_svnversion
(
void
)
{
return
"0"
;
#ifdef SVNVERSION
return
SVNVERSION
;
#else
return
"exported"
;
#endif
}
Python/sysmodule.c
Dosyayı görüntüle @
43b57805
...
...
@@ -934,6 +934,87 @@ _check_and_flush (FILE *stream)
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
*
_PySys_Init
(
void
)
{
...
...
@@ -1003,8 +1084,9 @@ _PySys_Init(void)
PyDict_SetItemString
(
sysdict
,
"hexversion"
,
v
=
PyInt_FromLong
(
PY_VERSION_HEX
));
Py_XDECREF
(
v
);
PyDict_SetItemString
(
sysdict
,
"build_number"
,
v
=
PyString_FromString
(
Py_GetBuildNumber
()));
svnversion_init
();
v
=
Py_BuildValue
(
"(ssz)"
,
"CPython"
,
branch
,
svn_revision
);
PyDict_SetItemString
(
sysdict
,
"subversion"
,
v
);
Py_XDECREF
(
v
);
/*
* 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