mirror of
https://github.com/python/cpython.git
synced 2025-09-30 20:31:52 +00:00
Relocating file to Doc/tools.
This commit is contained in:
parent
0b0e7b5686
commit
2023d38a58
13 changed files with 0 additions and 2005 deletions
|
@ -1,73 +0,0 @@
|
||||||
# Generate custlib.tex, which is a site-specific library document.
|
|
||||||
|
|
||||||
# Phase I: list all the things that can be imported
|
|
||||||
|
|
||||||
import glob, os, sys, string
|
|
||||||
modules={}
|
|
||||||
|
|
||||||
for modname in sys.builtin_module_names:
|
|
||||||
modules[modname]=modname
|
|
||||||
|
|
||||||
for dir in sys.path:
|
|
||||||
# Look for *.py files
|
|
||||||
filelist=glob.glob(os.path.join(dir, '*.py'))
|
|
||||||
for file in filelist:
|
|
||||||
path, file = os.path.split(file)
|
|
||||||
base, ext=os.path.splitext(file)
|
|
||||||
modules[string.lower(base)]=base
|
|
||||||
|
|
||||||
# Look for shared library files
|
|
||||||
filelist=(glob.glob(os.path.join(dir, '*.so')) +
|
|
||||||
glob.glob(os.path.join(dir, '*.sl')) +
|
|
||||||
glob.glob(os.path.join(dir, '*.o')) )
|
|
||||||
for file in filelist:
|
|
||||||
path, file = os.path.split(file)
|
|
||||||
base, ext=os.path.splitext(file)
|
|
||||||
if base[-6:]=='module': base=base[:-6]
|
|
||||||
modules[string.lower(base)]=base
|
|
||||||
|
|
||||||
# Minor oddity: the types module is documented in libtypes2.tex
|
|
||||||
if modules.has_key('types'):
|
|
||||||
del modules['types'] ; modules['types2']=None
|
|
||||||
|
|
||||||
# Phase II: find all documentation files (lib*.tex)
|
|
||||||
# and eliminate modules that don't have one.
|
|
||||||
|
|
||||||
docs={}
|
|
||||||
filelist=glob.glob('lib*.tex')
|
|
||||||
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.sort()
|
|
||||||
mlist=map(lambda x, docs=docs: docs[x], mlist)
|
|
||||||
|
|
||||||
modules=mlist
|
|
||||||
|
|
||||||
# Phase III: write custlib.tex
|
|
||||||
|
|
||||||
# Write the boilerplate
|
|
||||||
# XXX should be fancied up.
|
|
||||||
print """\documentstyle[twoside,11pt,myformat]{report}
|
|
||||||
\\title{Python Library Reference}
|
|
||||||
\\input{boilerplate}
|
|
||||||
\\makeindex % tell \\index to actually write the .idx file
|
|
||||||
\\begin{document}
|
|
||||||
\\pagenumbering{roman}
|
|
||||||
\\maketitle
|
|
||||||
\\input{copyright}
|
|
||||||
\\begin{abstract}
|
|
||||||
\\noindent This is a customized version of the Python Library Reference.
|
|
||||||
\\end{abstract}
|
|
||||||
\\pagebreak
|
|
||||||
{\\parskip = 0mm \\tableofcontents}
|
|
||||||
\\pagebreak\\pagenumbering{arabic}"""
|
|
||||||
|
|
||||||
for modname in mlist:
|
|
||||||
print "\\input{lib%s}" % (modname,)
|
|
||||||
|
|
||||||
# Write the end
|
|
||||||
print """\\input{custlib.ind} % Index
|
|
||||||
\\end{document}"""
|
|
|
@ -1,5 +0,0 @@
|
||||||
; load the new texinfo package (2.xx) if not installed by default
|
|
||||||
; (setq load-path (cons "/ufs/guido/lib/emacs/texinfo-2.14" load-path))
|
|
||||||
(find-file "temp.texi")
|
|
||||||
(texinfo-all-menus-update t)
|
|
||||||
(texinfo-all-menus-update t)
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
sed -e 's/{\\ptt[ ]*\\char[ ]*'"'"'137}/_/g' <"$1" > "@$1" && mv "@$1" $1
|
|
|
@ -1,3 +0,0 @@
|
||||||
#! /usr/bin/sed -f
|
|
||||||
s/{\\tt \\hackscore {}\\hackscore {}/\\sectcode{__/
|
|
||||||
s/\\hackscore {}\\hackscore {}/__/
|
|
|
@ -1,92 +0,0 @@
|
||||||
#! /usr/bin/env python
|
|
||||||
|
|
||||||
"""Combine similar index entries into an entry and subentries.
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
\item {foobar} (in module flotz), 23
|
|
||||||
\item {foobar} (in module whackit), 4323
|
|
||||||
|
|
||||||
becomes
|
|
||||||
|
|
||||||
\item {foobar}
|
|
||||||
\subitem in module flotz, 23
|
|
||||||
\subitem in module whackit, 4323
|
|
||||||
|
|
||||||
Note that an item which matches the format of a collapsable item but which
|
|
||||||
isn't part of a group of similar items is not modified.
|
|
||||||
"""
|
|
||||||
__version__ = '$Revision$'
|
|
||||||
|
|
||||||
import re
|
|
||||||
import string
|
|
||||||
import StringIO
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def cmp_entries(e1, e2, lower=string.lower):
|
|
||||||
return cmp(lower(e1[1]), lower(e2[1])) or cmp(e1, e2)
|
|
||||||
|
|
||||||
|
|
||||||
def dump_entries(write, entries):
|
|
||||||
if len(entries) == 1:
|
|
||||||
write(" \\item %s (%s)%s\n" % entries[0])
|
|
||||||
return
|
|
||||||
write(" \item %s\n" % entries[0][0])
|
|
||||||
# now sort these in a case insensitive manner:
|
|
||||||
if len(entries) > 0:
|
|
||||||
entries.sort(cmp_entries)
|
|
||||||
for xxx, subitem, pages in entries:
|
|
||||||
write(" \subitem %s%s\n" % (subitem, pages))
|
|
||||||
|
|
||||||
|
|
||||||
breakable_re = re.compile(
|
|
||||||
r" \\item (.*) [(](.*)[)]((?:(?:, \d+)|(?:, \\[a-z]*\{\d+\}))+)")
|
|
||||||
|
|
||||||
def main():
|
|
||||||
import getopt
|
|
||||||
outfile = None
|
|
||||||
opts, args = getopt.getopt(sys.argv[1:], "o:")
|
|
||||||
for opt, val in opts:
|
|
||||||
if opt in ("-o", "--output"):
|
|
||||||
outfile = val
|
|
||||||
filename = args[0]
|
|
||||||
outfile = outfile or filename
|
|
||||||
if filename == "-":
|
|
||||||
fp = sys.stdin
|
|
||||||
else:
|
|
||||||
fp = open(filename)
|
|
||||||
ofp = StringIO.StringIO()
|
|
||||||
entries = []
|
|
||||||
match = breakable_re.match
|
|
||||||
write = ofp.write
|
|
||||||
while 1:
|
|
||||||
line = fp.readline()
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
m = match(line)
|
|
||||||
if m:
|
|
||||||
entry = m.group(1, 2, 3)
|
|
||||||
if entries and entries[-1][0] != entry[0]:
|
|
||||||
dump_entries(write, entries)
|
|
||||||
entries = []
|
|
||||||
entries.append(entry)
|
|
||||||
elif entries:
|
|
||||||
dump_entries(write, entries)
|
|
||||||
entries = []
|
|
||||||
write(line)
|
|
||||||
else:
|
|
||||||
write(line)
|
|
||||||
del write
|
|
||||||
del match
|
|
||||||
fp.close()
|
|
||||||
if outfile == "-":
|
|
||||||
fp = sys.stdout
|
|
||||||
else:
|
|
||||||
fp = open(outfile, "w")
|
|
||||||
fp.write(ofp.getvalue())
|
|
||||||
fp.close()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
|
@ -1,20 +0,0 @@
|
||||||
#! /usr/local/bin/python
|
|
||||||
|
|
||||||
# This Python program sorts and reformats the table of keywords in ref2.tex
|
|
||||||
|
|
||||||
import string
|
|
||||||
l = []
|
|
||||||
try:
|
|
||||||
while 1:
|
|
||||||
l = l + string.split(raw_input())
|
|
||||||
except EOFError:
|
|
||||||
pass
|
|
||||||
l.sort()
|
|
||||||
for x in l[:]:
|
|
||||||
while l.count(x) > 1: l.remove(x)
|
|
||||||
ncols = 5
|
|
||||||
nrows = (len(l)+ncols-1)/ncols
|
|
||||||
for i in range(nrows):
|
|
||||||
for j in range(i, len(l), nrows):
|
|
||||||
print string.ljust(l[j], 10),
|
|
||||||
print
|
|
|
@ -1,37 +0,0 @@
|
||||||
#! /bin/sh
|
|
||||||
#
|
|
||||||
# script to create the latex source distribution
|
|
||||||
# * should be modified to get the Python version number automatically
|
|
||||||
# from the Makefile or someplace.
|
|
||||||
#
|
|
||||||
# usage:
|
|
||||||
# ./mktarball.sh [tag]
|
|
||||||
#
|
|
||||||
# without [tag]: generate from the current version that's checked in
|
|
||||||
# (*NOT* what's in the current directory!)
|
|
||||||
#
|
|
||||||
# with [tag]: generate from the named tag
|
|
||||||
|
|
||||||
VERSION=1.5
|
|
||||||
|
|
||||||
TEMPDIR=tmp.$$
|
|
||||||
MYDIR=`pwd`
|
|
||||||
|
|
||||||
TAG="$1"
|
|
||||||
|
|
||||||
mkdirhier $TEMPDIR/Python-$VERSION/Doc || exit $?
|
|
||||||
if [ "$TAG" ] ; then
|
|
||||||
cvs export -r $TAG -d $TEMPDIR/Python-$VERSION/Doc python/dist/src/Doc \
|
|
||||||
|| exit $?
|
|
||||||
else
|
|
||||||
cvs checkout -d $TEMPDIR/Python-$VERSION/Doc python/dist/src/Doc || exit $?
|
|
||||||
rm -r `find $TEMPDIR -name CVS -print` || exit $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $TEMPDIR
|
|
||||||
|
|
||||||
(tar cf - Python-$VERSION | gzip -9 >$MYDIR/latex-$VERSION.tar.gz) || exit $?
|
|
||||||
cd $MYDIR
|
|
||||||
rm -r $TEMPDIR || exit $?
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -1,62 +0,0 @@
|
||||||
#! /usr/bin/env python
|
|
||||||
|
|
||||||
"""Script to convert raw module index data to module index."""
|
|
||||||
|
|
||||||
import os
|
|
||||||
import string
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def parse_line(input):
|
|
||||||
lineno = string.split(input)[-1]
|
|
||||||
module = string.strip(input[:len(input)-(len(lineno)+1)])
|
|
||||||
return module, lineno
|
|
||||||
|
|
||||||
|
|
||||||
def cmp_items((s1, line1), (s2, line2)):
|
|
||||||
rc = cmp(string.lower(s1), string.lower(s2))
|
|
||||||
if rc == 0:
|
|
||||||
# Make the lower-case version come first since the upper-case
|
|
||||||
# version is usually a helper module for constants and such.
|
|
||||||
rc = cmp(s2, s1)
|
|
||||||
return rc
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
if sys.argv[1:]:
|
|
||||||
infile = sys.argv[1]
|
|
||||||
else:
|
|
||||||
infile = "-"
|
|
||||||
if infile == "-":
|
|
||||||
ifp = sys.stdin
|
|
||||||
ofp = sys.stdout
|
|
||||||
sys.stdout = sys.stderr
|
|
||||||
else:
|
|
||||||
ifp = open(infile)
|
|
||||||
base, ext = os.path.splitext(infile)
|
|
||||||
outfile = base + ".ind"
|
|
||||||
ofp = open(outfile, "w")
|
|
||||||
ofp.write("\\begin{theindex}\n\label{modindex}\n\n")
|
|
||||||
lines = ifp.readlines()
|
|
||||||
for i in range(len(lines)):
|
|
||||||
if lines[i][0] == '\\':
|
|
||||||
lines[i] = '\1' + lines[i]
|
|
||||||
lines = map(parse_line, lines)
|
|
||||||
lines.sort(cmp_items)
|
|
||||||
prev_letter = lines[0][0][0]
|
|
||||||
if prev_letter == '\1':
|
|
||||||
prev_letter = lines[0][0][1]
|
|
||||||
prev_letter = string.lower(prev_letter)
|
|
||||||
for module, lineno in lines:
|
|
||||||
if module[0] == '\1':
|
|
||||||
module = module[1:]
|
|
||||||
if string.lower(module[0]) != prev_letter:
|
|
||||||
ofp.write("\n \\indexspace\n\n")
|
|
||||||
prev_letter = string.lower(module[0])
|
|
||||||
ofp.write(" \\item {\\tt %s}, %s\n" % (module, lineno))
|
|
||||||
ofp.write("\n\\end{theindex}\n")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
|
@ -1,22 +0,0 @@
|
||||||
#! /usr/bin/env python
|
|
||||||
|
|
||||||
"""Really nasty little script to create an empty, labeled index on stdout.
|
|
||||||
|
|
||||||
Do it this way since some shells seem to work badly (and differently) with
|
|
||||||
the leading '\b' for the first output line. Specifically, /bin/sh on
|
|
||||||
Solaris doesn't seem to get it right. Once the quoting works there, it
|
|
||||||
doesn't work on Linux any more. ;-(
|
|
||||||
"""
|
|
||||||
__version__ = '$Revision$'
|
|
||||||
# $Source$
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
if sys.argv[1:]:
|
|
||||||
label = sys.argv[1]
|
|
||||||
else:
|
|
||||||
label = "genindex"
|
|
||||||
|
|
||||||
print "\\begin{theindex}"
|
|
||||||
print "\\label{%s}" % label
|
|
||||||
print "\\end{theindex}"
|
|
|
@ -1,42 +0,0 @@
|
||||||
#!/depot/gnu/plat/bin/perl -i
|
|
||||||
|
|
||||||
# read the labels, then reverse the mappings
|
|
||||||
require "labels.pl";
|
|
||||||
|
|
||||||
%nodes = ();
|
|
||||||
my $key;
|
|
||||||
# sort so that we get a consistent assignment for nodes with multiple labels
|
|
||||||
foreach $label (sort keys %external_labels) {
|
|
||||||
$key = $external_labels{$label};
|
|
||||||
$key =~ s|^/||;
|
|
||||||
$nodes{$key} = $label;
|
|
||||||
}
|
|
||||||
|
|
||||||
# collect labels that have been used
|
|
||||||
%newnames = ();
|
|
||||||
|
|
||||||
while (<>) {
|
|
||||||
# don't want to do one s/// per line per node
|
|
||||||
# so look for lines with hrefs, then do s/// on nodes present
|
|
||||||
if (/HREF=\"([^\#\"]*)html[\#\"]/) {
|
|
||||||
@parts = split(/HREF\=\"/);
|
|
||||||
shift @parts;
|
|
||||||
for $node (@parts) {
|
|
||||||
$node =~ s/[\#\"].*$//g;
|
|
||||||
chop($node);
|
|
||||||
if (defined($nodes{$node})) {
|
|
||||||
$label = $nodes{$node};
|
|
||||||
if (s/HREF=\"$node([\#\"])/HREF=\"$label.html$1/g) {
|
|
||||||
s/HREF=\"$label.html#SECTION\d+/HREF=\"$label.html/g;
|
|
||||||
$newnames{$node} = "$label.html";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach $oldname (keys %newnames) {
|
|
||||||
# or ln -s
|
|
||||||
system("mv $oldname $newnames{$oldname}");
|
|
||||||
}
|
|
1590
Doc/texi2html.py
1590
Doc/texi2html.py
File diff suppressed because it is too large
Load diff
|
@ -1,55 +0,0 @@
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import regex
|
|
||||||
import regsub
|
|
||||||
import string
|
|
||||||
import getopt
|
|
||||||
|
|
||||||
def main():
|
|
||||||
process(sys.stdin, sys.stdout)
|
|
||||||
|
|
||||||
dashes = regex.compile('^-+[ \t]*$')
|
|
||||||
equals = regex.compile('^=+[ \t]*$')
|
|
||||||
stars = regex.compile('^\*+[ \t]*$')
|
|
||||||
blank = regex.compile('^[ \t]*$')
|
|
||||||
indented = regex.compile('^\( *\t\| \)[ \t]*[^ \t]')
|
|
||||||
|
|
||||||
def process(fi, fo):
|
|
||||||
inverbatim = 0
|
|
||||||
line = '\n'
|
|
||||||
nextline = fi.readline()
|
|
||||||
while nextline:
|
|
||||||
prevline = line
|
|
||||||
line = nextline
|
|
||||||
nextline = fi.readline()
|
|
||||||
fmt = None
|
|
||||||
if dashes.match(nextline) >= 0:
|
|
||||||
fmt = '\\subsection{%s}\n'
|
|
||||||
elif equals.match(nextline) >= 0:
|
|
||||||
fmt = '\\section{%s}\n'
|
|
||||||
elif stars.match(nextline) >= 0:
|
|
||||||
fmt = '\\chapter{%s}\n'
|
|
||||||
if fmt:
|
|
||||||
nextline = '\n'
|
|
||||||
line = fmt % string.strip(line)
|
|
||||||
if '(' in line:
|
|
||||||
line = regsub.gsub('[a-zA-Z0-9_]+()',
|
|
||||||
'{\\\\tt \\0}', line)
|
|
||||||
elif inverbatim:
|
|
||||||
if blank.match(line) >= 0 and \
|
|
||||||
indented.match(nextline) < 0:
|
|
||||||
inverbatim = 0
|
|
||||||
fo.write('\\end{verbatim}\n')
|
|
||||||
else:
|
|
||||||
if indented.match(line) >= 0 and \
|
|
||||||
blank.match(prevline) >= 0:
|
|
||||||
inverbatim = 1
|
|
||||||
fo.write('\\begin{verbatim}\n')
|
|
||||||
if inverbatim:
|
|
||||||
line = string.expandtabs(line, 4)
|
|
||||||
elif not fmt and '(' in line:
|
|
||||||
line = regsub.gsub('[a-zA-Z0-9_]+()',
|
|
||||||
'\\\\code{\\0}', line)
|
|
||||||
fo.write(line)
|
|
||||||
|
|
||||||
main()
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
sed -n 's/^\\input{\(lib[a-zA-Z0-9_]*\)}.*/\1.tex/p' lib.tex
|
|
Loading…
Add table
Add a link
Reference in a new issue