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
65d09d4e
Commit
65d09d4e
authored
Mar 21, 2007
by
Collin Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run 2to3 over Doc/tools/.
parent
89df2456
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
66 additions
and
64 deletions
+66
-64
Doc/tools/buildindex.py
Doc/tools/buildindex.py
+11
-2
Doc/tools/custlib.py
Doc/tools/custlib.py
+8
-8
Doc/tools/getversioninfo
Doc/tools/getversioninfo
+1
-1
Doc/tools/keywords.py
Doc/tools/keywords.py
+2
-2
Doc/tools/listmodules.py
Doc/tools/listmodules.py
+2
-3
Doc/tools/mkackshtml
Doc/tools/mkackshtml
+1
-1
Doc/tools/mkhowto
Doc/tools/mkhowto
+6
-6
Doc/tools/mkmodindex
Doc/tools/mkmodindex
+3
-3
Doc/tools/prechm.py
Doc/tools/prechm.py
+10
-10
Doc/tools/refcounts.py
Doc/tools/refcounts.py
+4
-5
Doc/tools/sgmlconv/docfixer.py
Doc/tools/sgmlconv/docfixer.py
+6
-8
Doc/tools/sgmlconv/esis2sgml.py
Doc/tools/sgmlconv/esis2sgml.py
+3
-5
Doc/tools/sgmlconv/esistools.py
Doc/tools/sgmlconv/esistools.py
+4
-4
Doc/tools/sgmlconv/latex2esis.py
Doc/tools/sgmlconv/latex2esis.py
+3
-3
Doc/tools/undoc_symbols.py
Doc/tools/undoc_symbols.py
+2
-3
No files found.
Doc/tools/buildindex.py
View file @
65d09d4e
...
...
@@ -37,6 +37,15 @@ class Node:
# build up the text
self.text = split_entry_text(str)
self.key = split_entry_key(str)
def __eq__(self, other):
return cmp(self, other) == 0
def __lt__(self, other):
return cmp(self, other) == -1
def __gt__(self, other):
return cmp(self, other) == 1
def __cmp__(self, other):
"""Comparison operator includes sequence number, for use with
...
...
@@ -380,8 +389,8 @@ def main():
sys
.
stderr
.
write
(
"
\
n
%s: %d index nodes"
%
(
program
,
num_nodes
))
else
:
open
(
ofn
,
"w"
).
write
(
html
)
print
print
"%s: %d index nodes"
%
(
program
,
num_nodes
)
print
()
print
(
"%s: %d index nodes"
%
(
program
,
num_nodes
)
)
if
__name__
==
"__main__"
:
...
...
Doc/tools/custlib.py
View file @
65d09d4e
...
...
@@ -31,7 +31,7 @@ for dir in sys.path:
modules
[
base
.
lower
()]
=
base
# Minor oddity: the types module is documented in libtypes2.tex
if
modules
.
has_key
(
'types'
)
:
if
'types'
in
modules
:
del
modules
[
'types'
]
modules
[
'types2'
]
=
None
...
...
@@ -44,8 +44,8 @@ for file in filelist:
modname
=
file
[
3
:
-
4
]
docs
[
modname
]
=
modname
mlist
=
modules
.
keys
(
)
mlist
=
filter
(
lambda
x
,
docs
=
docs
:
docs
.
has_key
(
x
)
,
mlist
)
mlist
=
list
(
modules
.
keys
()
)
mlist
=
filter
(
lambda
x
,
docs
=
docs
:
x
in
docs
,
mlist
)
mlist
.
sort
()
mlist
=
map
(
lambda
x
,
docs
=
docs
:
docs
[
x
],
mlist
)
...
...
@@ -55,7 +55,7 @@ modules = mlist
# Write the boilerplate
# XXX should be fancied up.
print
"""
\
docume
n
tstyle[twoside,11pt,myformat]{report}
print
(
"""
\
docume
n
tstyle[twoside,11pt,myformat]{report}
\
\
title{Python Library Reference}
\
\
input{boilerplate}
\
\
makeindex % tell
\
\
index to actually write the .idx file
...
...
@@ -68,11 +68,11 @@ print """\documentstyle[twoside,11pt,myformat]{report}
\
\
end{abstract}
\
\
pagebreak
{
\
\
parskip = 0mm
\
\
tableofcontents}
\
\
pagebreak
\
\
pagenumbering{arabic}"""
\
\
pagebreak
\
\
pagenumbering{arabic}"""
)
for
modname
in
mlist
:
print
"
\
\
input{lib%s}"
%
(
modname
,
)
print
(
"
\
\
input{lib%s}"
%
(
modname
,)
)
# Write the end
print
"""
\
\
input{custlib.ind} % Index
\
\
end{document}"""
print
(
"""
\
\
input{custlib.ind} % Index
\
\
end{document}"""
)
Doc/tools/getversioninfo
View file @
65d09d4e
...
...
@@ -68,4 +68,4 @@ write_file(patchlevel_tex,
"
\
\
setshortversion{%s}
\
n
"
%
(
release
,
releaseinfo
,
shortversion
))
print
release
+
releaseinfo
print
(
release
+
releaseinfo
)
Doc/tools/keywords.py
View file @
65d09d4e
...
...
@@ -21,5 +21,5 @@ ncols = 5
nrows
=
(
len
(
l
)
+
ncols
-
1
)
/
ncols
for
i
in
range
(
nrows
):
for
j
in
range
(
i
,
len
(
l
),
nrows
):
print
l
[
j
].
ljust
(
10
),
print
print
(
l
[
j
].
ljust
(
10
),
end
=
' '
)
print
()
Doc/tools/listmodules.py
View file @
65d09d4e
...
...
@@ -40,8 +40,7 @@ def main():
for
p
in
path
:
modules
.
update
(
getmodules
(
p
))
keys
=
modules
.
keys
()
keys
.
sort
()
keys
=
sorted
(
modules
.
keys
())
# filter out known test packages
def
cb
(
m
):
...
...
@@ -79,7 +78,7 @@ def main():
if
out
is
not
sys
.
stdout
:
out
.
close
()
print
out
.
name
,
"ok (%d modules)"
%
len
(
modules
)
print
(
out
.
name
,
"ok (%d modules)"
%
len
(
modules
)
)
def
getmodules
(
p
):
# get modules in a given directory
...
...
Doc/tools/mkackshtml
View file @
65d09d4e
...
...
@@ -26,7 +26,7 @@ def main():
options
.
variables
[
"title"
]
=
"Acknowledgements"
options
.
parse
(
sys
.
argv
[
1
:])
names
=
collect
(
sys
.
stdin
)
percol
=
(
len
(
names
)
+
options
.
columns
-
1
)
/
options
.
columns
percol
=
(
len
(
names
)
+
options
.
columns
-
1
)
/
/
options
.
columns
colnums
=
[]
for
i
in
range
(
options
.
columns
):
colnums
.
append
(
percol
*
i
)
...
...
Doc/tools/mkhowto
View file @
65d09d4e
...
...
@@ -65,11 +65,11 @@ PYTHON_BINARY = "python"
def
usage
(
options
,
file
):
print
>>
file
,
__doc__
%
options
print
(
__doc__
%
options
,
file
=
file
)
def
error
(
options
,
message
,
err
=
2
):
print
>>
sys
.
stderr
,
message
print
>>
sys
.
stderr
print
(
message
,
file
=
sys
.
stderr
)
print
(
file
=
sys
.
stderr
)
usage
(
options
,
sys
.
stderr
)
sys
.
exit
(
2
)
...
...
@@ -132,7 +132,7 @@ class Options:
try
:
return
getattr
(
self
,
key
)
except
AttributeError
:
raise
KeyError
,
key
raise
KeyError
(
key
)
def
parse
(
self
,
args
):
opts
,
args
=
getopt
.
getopt
(
args
,
"Hi:a:s:lDkqr:"
,
...
...
@@ -289,7 +289,7 @@ class Job:
if
not
imgs
:
self
.
warning
(
"Could not locate support images of type %s."
%
`self.options.image_type`
)
%
repr
(
self
.
options
.
image_type
)
)
for
fn
in
imgs
:
new_fn
=
os
.
path
.
join
(
self
.
builddir
,
os
.
path
.
basename
(
fn
))
shutil
.
copyfile
(
fn
,
new_fn
)
...
...
@@ -534,7 +534,7 @@ class Job:
def
message
(
self
,
msg
):
msg
=
"+++ "
+
msg
if
not
self
.
options
.
quiet
:
print
msg
print
(
msg
)
self
.
log
(
msg
+
"
\
n
"
)
def
warning
(
self
,
msg
):
...
...
Doc/tools/mkmodindex
View file @
65d09d4e
...
...
@@ -49,7 +49,7 @@ class IndexOptions(support.Options):
def
usage
(
self
):
program
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
print
__doc__
%
{
"program"
:
program
}
print
(
__doc__
%
{
"program"
:
program
})
links
=
[
(
'author'
,
'acks.html'
,
'Acknowledgements'
),
...
...
@@ -143,8 +143,8 @@ def main():
if
options
.
outputfile
==
"-"
:
sys
.
stderr
.
write
(
"%s: %d index nodes
\
n
"
%
(
program
,
num_nodes
))
else
:
print
print
"%s: %d index nodes"
%
(
program
,
num_nodes
)
print
()
print
(
"%s: %d index nodes"
%
(
program
,
num_nodes
)
)
PLAT_DISCUSS
=
"""
...
...
Doc/tools/prechm.py
View file @
65d09d4e
...
...
@@ -413,7 +413,7 @@ def content(path, contentpage, output):
def
do_index
(
library
,
output
):
output
.
write
(
'<UL>
\
n
'
)
for
book
in
library
:
print
'
\
t
'
,
book
.
title
,
'-'
,
book
.
indexpage
print
(
'
\
t
'
,
book
.
title
,
'-'
,
book
.
indexpage
)
if
book
.
indexpage
:
index
(
book
.
directory
,
book
.
indexpage
,
output
)
output
.
write
(
'</UL>
\
n
'
)
...
...
@@ -421,7 +421,7 @@ def do_index(library, output):
def
do_content
(
library
,
version
,
output
):
output
.
write
(
contents_header
)
for
book
in
library
:
print
'
\
t
'
,
book
.
title
,
'-'
,
book
.
firstpage
print
(
'
\
t
'
,
book
.
title
,
'-'
,
book
.
firstpage
)
path
=
book
.
directory
+
"/"
+
book
.
firstpage
output
.
write
(
'<LI>'
)
output
.
write
(
object_sitemap
%
(
book
.
title
,
path
))
...
...
@@ -449,12 +449,12 @@ def openfile(file):
try
:
p
=
open
(
file
,
"w"
)
except
IOError
as
msg
:
print
file
,
":"
,
msg
print
(
file
,
":"
,
msg
)
sys
.
exit
(
1
)
return
p
def
usage
():
print
usage_mode
print
(
usage_mode
)
sys
.
exit
(
0
)
def
do_it
(
args
=
None
):
...
...
@@ -467,7 +467,7 @@ def do_it(args = None):
try
:
optlist
,
args
=
getopt
.
getopt
(
args
,
'ckpv:'
)
except
getopt
.
error
as
msg
:
print
msg
print
(
msg
)
usage
()
if
not
args
or
len
(
args
)
>
1
:
...
...
@@ -487,15 +487,15 @@ def do_it(args = None):
if
not
((
'-p'
,
''
)
in
optlist
):
fname
=
arch
+
'.stp'
f
=
openfile
(
fname
)
print
"Building stoplist"
,
fname
,
"..."
print
(
"Building stoplist"
,
fname
,
"..."
)
words
=
stop_list
.
split
()
words
.
sort
()
for
word
in
words
:
print
>>
f
,
word
print
(
word
,
file
=
f
)
f
.
close
()
f
=
openfile
(
arch
+
'.hhp'
)
print
"Building Project..."
print
(
"Building Project..."
)
do_project
(
library
,
f
,
arch
,
version
)
if
version
==
'2.0.0'
:
for
image
in
os
.
listdir
(
'icons'
):
...
...
@@ -505,13 +505,13 @@ def do_it(args = None):
if
not
((
'-c'
,
''
)
in
optlist
):
f
=
openfile
(
arch
+
'.hhc'
)
print
"Building Table of Content..."
print
(
"Building Table of Content..."
)
do_content
(
library
,
version
,
f
)
f
.
close
()
if
not
((
'-k'
,
''
)
in
optlist
):
f
=
openfile
(
arch
+
'.hhk'
)
print
"Building Index..."
print
(
"Building Index..."
)
do_index
(
library
,
f
)
f
.
close
()
...
...
Doc/tools/refcounts.py
View file @
65d09d4e
...
...
@@ -69,24 +69,23 @@ class Entry:
def
dump
(
d
):
"""Dump the data in the 'canonical' format, with functions in
sorted order."""
items
=
d
.
items
()
items
.
sort
()
items
=
sorted
(
d
.
items
())
first
=
1
for
k
,
entry
in
items
:
if
first
:
first
=
0
else
:
print
print
()
s
=
entry
.
name
+
":%s:%s:%s:"
if
entry
.
result_refs
is
None
:
r
=
""
else
:
r
=
entry
.
result_refs
print
s
%
(
entry
.
result_type
,
""
,
r
)
print
(
s
%
(
entry
.
result_type
,
""
,
r
)
)
for
t
,
n
,
r
in
entry
.
args
:
if
r
is
None
:
r
=
""
print
s
%
(
t
,
n
,
r
)
print
(
s
%
(
t
,
n
,
r
)
)
def
main
():
...
...
Doc/tools/sgmlconv/docfixer.py
View file @
65d09d4e
...
...
@@ -210,8 +210,7 @@ def rewrite_descriptor(doc, descriptor):
# 2a.
if
descriptor
.
hasAttribute
(
"var"
):
if
descname
!=
"opcodedesc"
:
raise
RuntimeError
,
\
"got 'var' attribute on descriptor other than opcodedesc"
raise
RuntimeError
(
"got 'var' attribute on descriptor other than opcodedesc"
)
variable
=
descriptor
.
getAttribute
(
"var"
)
if
variable
:
args
=
doc
.
createElement
(
"args"
)
...
...
@@ -241,7 +240,7 @@ def rewrite_descriptor(doc, descriptor):
try
:
sig
=
methodline_to_signature
(
doc
,
children
[
pos
])
except
KeyError
:
print
oldchild
.
toxml
(
)
print
(
oldchild
.
toxml
()
)
raise
newchildren
.
append
(
sig
)
else
:
...
...
@@ -347,7 +346,7 @@ def fixup_trailing_whitespace(doc, fragment, wsmap):
while
queue
:
node
=
queue
[
0
]
del
queue
[
0
]
if
wsmap
.
has_key
(
node
.
nodeName
)
:
if
node
.
nodeName
in
wsmap
:
fixups
.
append
(
node
)
for
child
in
node
.
childNodes
:
if
child
.
nodeType
==
ELEMENT
:
...
...
@@ -962,8 +961,7 @@ def write_esis(doc, ofp, knownempty):
gi
=
node
.
tagName
if
knownempty
(
gi
):
if
node
.
hasChildNodes
():
raise
ValueError
,
\
"declared-empty node <%s> has children"
%
gi
raise
ValueError
(
"declared-empty node <%s> has children"
%
gi
)
ofp
.
write
(
"e
\
n
"
)
for
k
,
value
in
node
.
attributes
.
items
():
if
_token_rx
.
match
(
value
):
...
...
@@ -979,7 +977,7 @@ def write_esis(doc, ofp, knownempty):
elif
nodeType
==
ENTITY_REFERENCE
:
ofp
.
write
(
"&%s
\
n
"
%
node
.
nodeName
)
else
:
raise
RuntimeError
,
"unsupported node type: %s"
%
nodeType
raise
RuntimeError
(
"unsupported node type: %s"
%
nodeType
)
def
convert
(
ifp
,
ofp
):
...
...
@@ -1033,7 +1031,7 @@ def convert(ifp, ofp):
for
gi
in
events
.
parser
.
get_empties
():
d
[
gi
]
=
gi
for
key
in
(
"author"
,
"pep"
,
"rfc"
):
if
d
.
has_key
(
key
)
:
if
key
in
d
:
del
d
[
key
]
knownempty
=
d
.
has_key
#
...
...
Doc/tools/sgmlconv/esis2sgml.py
View file @
65d09d4e
...
...
@@ -44,8 +44,7 @@ def null_map_gi(sgmlgi, map):
def
format_attrs
(
attrs
,
xml
=
0
):
attrs
=
attrs
.
items
()
attrs
.
sort
()
attrs
=
sorted
(
attrs
.
items
())
parts
=
[]
append
=
parts
.
append
for
name
,
value
in
attrs
:
...
...
@@ -149,7 +148,7 @@ def convert(ifp, ofp, xml=0, autoclose=(), verbatims=()):
ofp
.
write
(
"&%s;"
%
data
)
knownempty
=
0
else
:
raise
RuntimeError
,
"unrecognized ESIS event type: '%s'"
%
type
raise
RuntimeError
(
"unrecognized ESIS event type: '%s'"
%
type
)
if
LIST_EMPTIES
:
dump_empty_element_names
(
knownempties
)
...
...
@@ -170,8 +169,7 @@ def dump_empty_element_names(knownempties):
if
gi
:
d
[
gi
]
=
gi
fp
=
open
(
EMPTIES_FILENAME
,
"w"
)
gilist
=
d
.
keys
()
gilist
.
sort
()
gilist
=
sorted
(
d
.
keys
())
fp
.
write
(
"
\
n
"
.
join
(
gilist
))
fp
.
write
(
"
\
n
"
)
fp
.
close
()
...
...
Doc/tools/sgmlconv/esistools.py
View file @
65d09d4e
...
...
@@ -29,7 +29,7 @@ def decode(s):
n
,
s
=
s
.
split
(
";"
,
1
)
r
=
r
+
unichr
(
int
(
n
))
else
:
raise
ValueError
,
"can't handle %r"
%
s
raise
ValueError
(
"can't handle %r"
%
s
)
return
r
...
...
@@ -80,7 +80,7 @@ class ESISReader(xml.sax.xmlreader.XMLReader):
self
.
setErrorHandler
(
errorHandler
)
def
get_empties
(
self
):
return
self
.
_empties
.
keys
(
)
return
list
(
self
.
_empties
.
keys
()
)
#
# XMLReader interface
...
...
@@ -270,7 +270,7 @@ class Attributes(xml.sax.xmlreader.AttributesImpl):
return
self
.
_attrs
[
name
][
0
]
def
get
(
self
,
name
,
default
=
None
):
if
self
.
_attrs
.
has_key
(
name
)
:
if
name
in
self
.
_attrs
:
return
self
.
_attrs
[
name
][
0
]
return
default
...
...
@@ -282,7 +282,7 @@ class Attributes(xml.sax.xmlreader.AttributesImpl):
def
values
(
self
):
L
=
[]
for
value
,
type
in
self
.
_attrs
.
values
(
):
for
value
,
type
in
list
(
self
.
_attrs
.
values
()
):
L
.
append
(
value
)
return
L
...
...
Doc/tools/sgmlconv/latex2esis.py
View file @
65d09d4e
...
...
@@ -472,7 +472,7 @@ class TableHandler(xml.sax.handler.ContentHandler):
name = attrs["
name
"]
self.__current = TableEntry(name, environment=1)
self.__current.verbatim = attrs.get("
verbatim
") == "
yes
"
if
attrs.has_key("
outputname
")
:
if
"
outputname
" in attrs
:
self.__current.outputname = attrs.get("
outputname
")
self.__current.endcloses = attrs.get("
endcloses
", "").split()
def end_environment(self):
...
...
@@ -482,11 +482,11 @@ class TableHandler(xml.sax.handler.ContentHandler):
name = attrs["
name
"]
self.__current = TableEntry(name)
self.__current.closes = attrs.get("
closes
", "").split()
if
attrs.has_key("
outputname
")
:
if
"
outputname
" in attrs
:
self.__current.outputname = attrs.get("
outputname
")
def end_macro(self):
name = self.__current.name
if
self.__table.has_key(name)
:
if
name in self.__table
:
raise ValueError("
name
%
r
already
in
use
" % (name,))
self.__table[name] = self.__current
self.__current = None
...
...
Doc/tools/undoc_symbols.py
View file @
65d09d4e
...
...
@@ -80,11 +80,10 @@ def print_undoc_symbols(prefix, docdir, incdir):
fp
=
os
.
popen
(
"ctags -IPyAPI_FUNC -IPy_GCC_ATTRIBUTE --c-types=%s -f - %s"
%
(
TAG_KINDS
,
incfiles
))
dict
=
findnames
(
fp
,
prefix
)
names
=
dict
.
keys
()
names
.
sort
()
names
=
sorted
(
dict
.
keys
())
for
name
in
names
:
if
not
re
.
search
(
"%s
\
\
W"
%
name
,
docs
):
print
dict
[
name
],
name
print
(
dict
[
name
],
name
)
if
__name__
==
'__main__'
:
srcdir
=
os
.
path
.
dirname
(
sys
.
argv
[
0
])
...
...
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