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
2fba8aac
Commit
2fba8aac
authored
Jan 21, 2008
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt to latest doctools refactoring.
parent
a207a71e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
6 deletions
+77
-6
Doc/conf.py
Doc/conf.py
+9
-6
Doc/tools/sphinxext/patchlevel.py
Doc/tools/sphinxext/patchlevel.py
+68
-0
No files found.
Doc/conf.py
View file @
2fba8aac
...
...
@@ -7,23 +7,27 @@
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
import
sys
,
os
,
time
sys
.
path
.
append
(
'tools/sphinxext'
)
# General configuration
# ---------------------
# General substitutions.
project
=
'Python'
copyright
=
'1990-
2007, Python Software Foundation'
copyright
=
'1990-
%s, Python Software Foundation'
%
time
.
strftime
(
'%Y'
)
# The default replacements for |version| and |release|.
# If '<auto>', Sphinx looks for the Include/patchlevel.h file in the current Python
# source tree and replaces the values accordingly.
#
# The short X.Y version.
# version = '2.6'
version
=
'<auto>'
# The full version, including alpha/beta/rc tags.
# release = '2.6a0'
release
=
'<auto>'
# We look for the Include/patchlevel.h file in the current Python source tree
# and replace the values accordingly.
import
patchlevel
version
,
release
=
patchlevel
.
get_version_info
()
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
...
...
@@ -118,7 +122,6 @@ latex_documents = [
'What
\
'
s New in Python'
,
'A. M. Kuchling'
,
'howto'
),
]
# Collect all HOWTOs individually
import
os
latex_documents
.
extend
((
'howto/'
+
fn
,
'howto-'
+
fn
[:
-
4
]
+
'.tex'
,
'HOWTO'
,
_stdauthor
,
'howto'
)
for
fn
in
os
.
listdir
(
'howto'
)
...
...
Doc/tools/sphinxext/patchlevel.py
0 → 100644
View file @
2fba8aac
# -*- coding: utf-8 -*-
"""
patchlevel.py
~~~~~~~~~~~~~
Extract version info from Include/patchlevel.h.
Adapted from Doc/tools/getversioninfo.
:copyright: 2007-2008 by Georg Brandl.
:license: Python license.
"""
import
os
import
re
import
sys
def
get_header_version_info
(
srcdir
):
patchlevel_h
=
os
.
path
.
join
(
srcdir
,
'..'
,
'Include'
,
'patchlevel.h'
)
# This won't pick out all #defines, but it will pick up the ones we
# care about.
rx
=
re
.
compile
(
r'\
s*#de
fine\
s+([
a-zA-Z][a-zA-Z_0-9]*)\
s+([
a-zA-Z_0-9]+)'
)
d
=
{}
f
=
open
(
patchlevel_h
)
try
:
for
line
in
f
:
m
=
rx
.
match
(
line
)
if
m
is
not
None
:
name
,
value
=
m
.
group
(
1
,
2
)
d
[
name
]
=
value
finally
:
f
.
close
()
release
=
version
=
'%s.%s'
%
(
d
[
'PY_MAJOR_VERSION'
],
d
[
'PY_MINOR_VERSION'
])
micro
=
int
(
d
[
'PY_MICRO_VERSION'
])
if
micro
!=
0
:
release
+=
'.'
+
str
(
micro
)
level
=
d
[
'PY_RELEASE_LEVEL'
]
suffixes
=
{
'PY_RELEASE_LEVEL_ALPHA'
:
'a'
,
'PY_RELEASE_LEVEL_BETA'
:
'b'
,
'PY_RELEASE_LEVEL_GAMMA'
:
'c'
,
}
if
level
!=
'PY_RELEASE_LEVEL_FINAL'
:
release
+=
suffixes
[
level
]
+
str
(
int
(
d
[
'PY_RELEASE_SERIAL'
]))
return
version
,
release
def
get_sys_version_info
():
major
,
minor
,
micro
,
level
,
serial
=
sys
.
version_info
release
=
version
=
'%s.%s'
%
(
major
,
minor
)
if
micro
:
release
+=
'.%s'
%
micro
if
level
!=
'final'
:
release
+=
'%s%s'
%
(
level
[
0
],
serial
)
return
version
,
release
def
get_version_info
():
try
:
return
get_header_version_info
(
'.'
)
except
(
IOError
,
OSError
):
version
,
release
=
get_sys_version_info
()
print
>>
sys
.
stderr
,
'Can
\
'
t get version info from Include/patchlevel.h, '
\
'using version of this interpreter (%s).'
%
release
return
version
,
release
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