This file is indexed.

/usr/lib/python2.7/doc/tools/getpagecounts is in python-old-doctools 2.5.5-2.1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#! /usr/bin/env python

"""Generate a page count report of the PostScript version of the manuals."""

__version__ = '$Revision: 39598 $'

import getopt
import sys


class PageCounter:
    def __init__(self):
        self.doclist = []
        self.total = 0
        self.title_width = 0
        self.version = ""

    def add_document(self, prefix, title):
        count = count_pages(prefix + ".ps")
        self.doclist.append((title, prefix, count))
        self.title_width = max(self.title_width, len(title))
        self.total = self.total + count

    def dump(self):
        fmt = "%%-%ds  (%%s.ps, %%d pages)" % self.title_width
        for item in self.doclist:
            print fmt % item
        print
        print "  Total page count:  %d" % self.total

    def parse_options(self):
        opts, args = getopt.getopt(sys.argv[1:], "r:", ["release="])
        assert not args
        for opt, arg in opts:
            if opt in ("-r", "--release"):
                self.version = arg

    def run(self):
        self.parse_options()
        if self.version:
            version = self.version[:3]
            self.add_document("whatsnew" + version.replace(".", ""),
                              "What's New in Python " + version)
        for prefix, title in [
            ("api", "Python/C API"),
            ("ext", "Extending and Embedding the Python Interpreter"),
            ("lib", "Python Library Reference"),
            ("mac", "Macintosh Module Reference"),
            ("ref", "Python Reference Manual"),
            ("tut", "Python Tutorial"),
            ("doc", "Documenting Python"),
            ("inst", "Installing Python Modules"),
            ("dist", "Distributing Python Modules"),
            ]:
            self.add_document(prefix, title)
        print self.PREFIX
        self.dump()
        print self.SUFFIX

    PREFIX = """\
This is the PostScript version of the standard Python documentation.
If you plan to print this, be aware that some of the documents are
long.  It is formatted for printing on two-sided paper; if you do plan
to print this, *please* print two-sided if you have a printer capable
of it!  To locate published copies of the larger manuals, or other
Python reference material, consult the Python Bookstore at:

    http://wiki.python.org/moin/PythonBooks

The following manuals are included in this package:
"""
    SUFFIX = """\


If you have any questions, comments, or suggestions regarding these
documents, please send them via email to docs@python.org.
"""

def count_pages(filename):
    fp = open(filename)
    count = 0
    while 1:
        lines = fp.readlines(1024*40)
        if not lines:
            break
        for line in lines:
            if line[:7] == "%%Page:":
                count = count + 1
    fp.close()
    return count


def main():
    PageCounter().run()

if __name__ == "__main__":
    main()