Mercurial > cpython-lru_cache-weakref
annotate Mac/Tools/Doc/setup.py @ 78069:a8aa77458e12 3.2
Add c_size_t and c_ssize_t to the ctypes summary table.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Thu, 12 Jul 2012 20:31:50 +0200 |
| parents | 87d854bc1e45 |
| children |
| rev | line source |
|---|---|
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
1 # Build and install an Apple Help Viewer compatible version of the Python |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
2 # documentation into the framework. |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
3 # Code by Bill Fancher, with some modifications by Jack Jansen. |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
4 # |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
5 # You must run this as a two-step process |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
6 # 1. python setupDocs.py build |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
7 # 2. Wait for Apple Help Indexing Tool to finish |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
8 # 3. python setupDocs.py install |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
9 # |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
10 # To do: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
11 # - test whether the docs are available locally before downloading |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
12 # - fix buildDocsFromSource |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
13 # - Get documentation version from sys.version, fallback to 2.2.1 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
14 # - See if we can somehow detect that Apple Help Indexing Tool is finished |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
15 # - data_files to setup() doesn't seem the right way to pass the arguments |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
16 # |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
17 import sys, os, re |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
18 from distutils.cmd import Command |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
19 from distutils.command.build import build |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
20 from distutils.core import setup |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
21 from distutils.file_util import copy_file |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
22 from distutils.dir_util import copy_tree |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
23 from distutils.log import log |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
24 from distutils.spawn import spawn |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
25 from distutils import sysconfig, dep_util |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
26 from distutils.util import change_root |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
27 import HelpIndexingTool |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
28 import Carbon.File |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
29 import time |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
30 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
31 MAJOR_VERSION='2.4' |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
32 MINOR_VERSION='2.4.1' |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
33 DESTDIR='/Applications/MacPython-%s/PythonIDE.app/Contents/Resources/English.lproj/PythonDocumentation' % MAJOR_VERSION |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
34 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
35 class DocBuild(build): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
36 def initialize_options(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
37 build.initialize_options(self) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
38 self.build_html = None |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
39 self.build_dest = None |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
40 self.download = 1 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
41 self.doc_version = MINOR_VERSION # Only needed if download is true |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
42 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
43 def finalize_options(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
44 build.finalize_options(self) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
45 if self.build_html is None: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
46 self.build_html = os.path.join(self.build_base, 'html') |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
47 if self.build_dest is None: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
48 self.build_dest = os.path.join(self.build_base, 'PythonDocumentation') |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
49 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
50 def spawn(self, *args): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
51 spawn(args, 1, self.verbose, self.dry_run) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
52 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
53 def downloadDocs(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
54 workdir = os.getcwd() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
55 # XXX Note: the next strings may change from version to version |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
56 url = 'http://www.python.org/ftp/python/doc/%s/html-%s.tar.bz2' % \ |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
57 (self.doc_version,self.doc_version) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
58 tarfile = 'html-%s.tar.bz2' % self.doc_version |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
59 dirname = 'Python-Docs-%s' % self.doc_version |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
60 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
61 if os.path.exists(self.build_html): |
|
43102
981ecc526703
Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents:
43077
diff
changeset
|
62 raise RuntimeError('%s: already exists, please remove and try again' % self.build_html) |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
63 os.chdir(self.build_base) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
64 self.spawn('curl','-O', url) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
65 self.spawn('tar', '-xjf', tarfile) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
66 os.rename(dirname, 'html') |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
67 os.chdir(workdir) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
68 ## print "** Please unpack %s" % os.path.join(self.build_base, tarfile) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
69 ## print "** Unpack the files into %s" % self.build_html |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
70 ## raise RuntimeError, "You need to unpack the docs manually" |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
71 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
72 def buildDocsFromSource(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
73 srcdir = '../../..' |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
74 docdir = os.path.join(srcdir, 'Doc') |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
75 htmldir = os.path.join(docdir, 'html') |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
76 spawn(('make','--directory', docdir, 'html'), 1, self.verbose, self.dry_run) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
77 self.mkpath(self.build_html) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
78 copy_tree(htmldir, self.build_html) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
79 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
80 def ensureHtml(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
81 if not os.path.exists(self.build_html): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
82 if self.download: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
83 self.downloadDocs() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
84 else: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
85 self.buildDocsFromSource() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
86 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
87 def hackIndex(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
88 ind_html = 'index.html' |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
89 #print 'self.build_dest =', self.build_dest |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
90 hackedIndex = file(os.path.join(self.build_dest, ind_html),'w') |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
91 origIndex = file(os.path.join(self.build_html,ind_html)) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
92 r = re.compile('<style type="text/css">.*</style>', re.DOTALL) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
93 hackedIndex.write(r.sub('<META NAME="AppleTitle" CONTENT="Python Documentation">',origIndex.read())) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
94 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
95 def hackFile(self,d,f): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
96 origPath = os.path.join(d,f) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
97 assert(origPath[:len(self.build_html)] == self.build_html) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
98 outPath = os.path.join(self.build_dest, d[len(self.build_html)+1:], f) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
99 (name, ext) = os.path.splitext(f) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
100 if os.path.isdir(origPath): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
101 self.mkpath(outPath) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
102 elif ext == '.html': |
|
43077
dcedd32f06de
Run 2to3's print fixer over some places that had been missed.
Collin Winter <collinw@gmail.com>
parents:
38673
diff
changeset
|
103 if self.verbose: print('hacking %s to %s' % (origPath,outPath)) |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
104 hackedFile = file(outPath, 'w') |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
105 origFile = file(origPath,'r') |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
106 hackedFile.write(self.r.sub('<dl><dt><dd>', origFile.read())) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
107 else: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
108 copy_file(origPath, outPath) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
109 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
110 def hackHtml(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
111 self.r = re.compile('<dl><dd>') |
|
46800
87d854bc1e45
Removed remnants of os.path.walk().
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
46222
diff
changeset
|
112 os.walk(self.build_html, self.visit, None) |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
113 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
114 def visit(self, dummy, dirname, filenames): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
115 for f in filenames: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
116 self.hackFile(dirname, f) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
117 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
118 def makeHelpIndex(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
119 app = '/Developer/Applications/Apple Help Indexing Tool.app' |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
120 self.spawn('open', '-a', app , self.build_dest) |
|
43077
dcedd32f06de
Run 2to3's print fixer over some places that had been missed.
Collin Winter <collinw@gmail.com>
parents:
38673
diff
changeset
|
121 print("Please wait until Apple Help Indexing Tool finishes before installing") |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
122 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
123 def makeHelpIndex(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
124 app = HelpIndexingTool.HelpIndexingTool(start=1) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
125 app.open(Carbon.File.FSSpec(self.build_dest)) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
126 sys.stderr.write("Waiting for Help Indexing Tool to start...") |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
127 while 1: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
128 # This is bad design in the suite generation code! |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
129 idle = app._get(HelpIndexingTool.Help_Indexing_Tool_Suite._Prop_idleStatus()) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
130 time.sleep(10) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
131 if not idle: break |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
132 sys.stderr.write(".") |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
133 sys.stderr.write("\n") |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
134 sys.stderr.write("Waiting for Help Indexing Tool to finish...") |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
135 while 1: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
136 # This is bad design in the suite generation code! |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
137 idle = app._get(HelpIndexingTool.Help_Indexing_Tool_Suite._Prop_idleStatus()) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
138 time.sleep(10) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
139 if idle: break |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
140 sys.stderr.write(".") |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
141 sys.stderr.write("\n") |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
142 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
143 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
144 def run(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
145 self.ensure_finalized() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
146 self.mkpath(self.build_base) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
147 self.ensureHtml() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
148 if not os.path.isdir(self.build_html): |
|
43102
981ecc526703
Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents:
43077
diff
changeset
|
149 raise RuntimeError("Can't find source folder for documentation.") |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
150 self.mkpath(self.build_dest) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
151 if dep_util.newer(os.path.join(self.build_html,'index.html'), os.path.join(self.build_dest,'index.html')): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
152 self.mkpath(self.build_dest) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
153 self.hackHtml() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
154 self.hackIndex() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
155 self.makeHelpIndex() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
156 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
157 class AHVDocInstall(Command): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
158 description = "install Apple Help Viewer html files" |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
159 user_options = [('install-doc=', 'd', |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
160 'directory to install HTML tree'), |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
161 ('root=', None, |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
162 "install everything relative to this alternate root directory"), |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
163 ] |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
164 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
165 def initialize_options(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
166 self.build_dest = None |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
167 self.install_doc = None |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
168 self.prefix = None |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
169 self.root = None |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
170 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
171 def finalize_options(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
172 self.set_undefined_options('install', |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
173 ('prefix', 'prefix'), |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
174 ('root', 'root')) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
175 # import pdb ; pdb.set_trace() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
176 build_cmd = self.get_finalized_command('build') |
|
46222
aed698c8647b
Merged revisions 62021,62029,62035-62038,62043-62044,62052-62053 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
43102
diff
changeset
|
177 if self.build_dest is None: |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
178 build_cmd = self.get_finalized_command('build') |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
179 self.build_dest = build_cmd.build_dest |
|
46222
aed698c8647b
Merged revisions 62021,62029,62035-62038,62043-62044,62052-62053 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
43102
diff
changeset
|
180 if self.install_doc is None: |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
181 self.install_doc = os.path.join(self.prefix, DESTDIR) |
|
43077
dcedd32f06de
Run 2to3's print fixer over some places that had been missed.
Collin Winter <collinw@gmail.com>
parents:
38673
diff
changeset
|
182 print('INSTALL', self.build_dest, '->', self.install_doc) |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
183 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
184 def run(self): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
185 self.finalize_options() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
186 self.ensure_finalized() |
|
43077
dcedd32f06de
Run 2to3's print fixer over some places that had been missed.
Collin Winter <collinw@gmail.com>
parents:
38673
diff
changeset
|
187 print("Running Installer") |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
188 instloc = self.install_doc |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
189 if self.root: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
190 instloc = change_root(self.root, instloc) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
191 self.mkpath(instloc) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
192 copy_tree(self.build_dest, instloc) |
|
43077
dcedd32f06de
Run 2to3's print fixer over some places that had been missed.
Collin Winter <collinw@gmail.com>
parents:
38673
diff
changeset
|
193 print("Installation complete") |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
194 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
195 def mungeVersion(infile, outfile): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
196 i = file(infile,'r') |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
197 o = file(outfile,'w') |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
198 o.write(re.sub('\$\(VERSION\)',sysconfig.get_config_var('VERSION'),i.read())) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
199 i.close() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
200 o.close() |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
201 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
202 def main(): |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
203 # turn off warnings when deprecated modules are imported |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
204 ## import warnings |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
205 ## warnings.filterwarnings("ignore",category=DeprecationWarning) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
206 setup(name = 'Documentation', |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
207 version = '%d.%d' % sys.version_info[:2], |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
208 cmdclass = {'install_data':AHVDocInstall, 'build':DocBuild}, |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
209 data_files = ['dummy'], |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
210 ) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
211 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
212 if __name__ == '__main__': |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
213 main() |
