3 """Generate a page count report of the PostScript version of the manuals."""
5 __version__
= '$Revision$'
18 def add_document(self
, prefix
, title
):
19 count
= count_pages(prefix
+ ".ps")
20 self
.doclist
.append((title
, prefix
, count
))
21 self
.title_width
= max(self
.title_width
, len(title
))
22 self
.total
= self
.total
+ count
25 fmt
= "%%-%ds (%%s.ps, %%d pages)" % self
.title_width
26 for item
in self
.doclist
:
29 print " Total page count: %d" % self
.total
31 def parse_options(self
):
32 opts
, args
= getopt
.getopt(sys
.argv
[1:], "r:", ["release="])
35 if opt
in ("-r", "--release"):
41 version
= self
.version
[:3]
42 self
.add_document("whatsnew" + version
.replace(".", ""),
43 "What's New in Python " + version
)
44 for prefix
, title
in [
45 ("api", "Python/C API"),
46 ("ext", "Extending and Embedding the Python Interpreter"),
47 ("lib", "Python Library Reference"),
48 ("mac", "Macintosh Module Reference"),
49 ("ref", "Python Reference Manual"),
50 ("tut", "Python Tutorial"),
51 ("doc", "Documenting Python"),
52 ("inst", "Installing Python Modules"),
53 ("dist", "Distributing Python Modules"),
55 self
.add_document(prefix
, title
)
61 This is the PostScript version of the standard Python documentation.
62 If you plan to print this, be aware that some of the documents are
63 long. It is formatted for printing on two-sided paper; if you do plan
64 to print this, *please* print two-sided if you have a printer capable
65 of it! To locate published copies of the larger manuals, or other
66 Python reference material, consult the Python Bookstore at:
68 http://www.amk.ca/bookstore/
70 The following manuals are included in this package:
75 If you have any questions, comments, or suggestions regarding these
76 documents, please send them via email to python-docs@python.org.
79 def count_pages(filename
):
83 lines
= fp
.readlines(1024*40)
87 if line
[:7] == "%%Page:":
96 if __name__
== "__main__":