mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Updated to work with current Python docs setup, and added a minimal README.
This commit is contained in:
parent
4454a1ff84
commit
6d22b56b7e
2 changed files with 54 additions and 13 deletions
35
Mac/OSX/Doc/README
Normal file
35
Mac/OSX/Doc/README
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
In this directory you can build the Python documentation in a form that
|
||||||
|
is suitable for access with Apple Help Viewer. This will enable the
|
||||||
|
"Python Documentation" menu entries in the MacPython IDE Help menu.
|
||||||
|
|
||||||
|
Unfortunately the procedure to build the docs is not very streamlined.
|
||||||
|
|
||||||
|
First, edit setup.py. At the top, edit MAJOR_VERSION and MINOR_VERSION,
|
||||||
|
and check that DESTDIR makes sense. The documentation will be installed
|
||||||
|
inside PythonIDE.app.
|
||||||
|
|
||||||
|
In DocBuild.initialize_options, set self.download to True if you want to
|
||||||
|
download the docs. Set it to False if you want to build the docs from
|
||||||
|
the source tree, but this requires LaTex and lots of other stuff.
|
||||||
|
Doable, but not easy.
|
||||||
|
|
||||||
|
Second, if you want to download the docs you may need to do a couple
|
||||||
|
more edits. The way the docs are packaged will often change between
|
||||||
|
major releases. Fiddle DocBuild.downloadDocs to make it do the right
|
||||||
|
thing (download the docs from python.org, unpack them, rename the
|
||||||
|
directory to "build/html").
|
||||||
|
|
||||||
|
After these edits you should be ready to roll. "pythonw setup.py build"
|
||||||
|
should download and unpack (or build) the docs. Next, it will do some
|
||||||
|
magic to make the docs indexable. Finally, it will run the Apple Help
|
||||||
|
Indexing Tool. (This last step is the reason you must use "pythonw" as
|
||||||
|
opposed to "python"). Usually it will time out while waiting for AHIT to
|
||||||
|
do its work. Wait until AHIT is done.
|
||||||
|
|
||||||
|
Now you're ready to install with "python setup.py install".
|
||||||
|
|
||||||
|
After this is done test your work. Fire up PythonIDE, and check that
|
||||||
|
Help->Python Documentation brings up the documentation in the Help Viewer.
|
||||||
|
Also open an IDE edit window, type something like "import sys", select
|
||||||
|
"import", and use Help->Lookup in Python Documentation to check that the
|
||||||
|
index has been generated correctly.
|
|
@ -28,13 +28,17 @@ import HelpIndexingTool
|
||||||
import Carbon.File
|
import Carbon.File
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
MAJOR_VERSION='2.4'
|
||||||
|
MINOR_VERSION='2.4.1'
|
||||||
|
DESTDIR='/Applications/MacPython-%s/PythonIDE.app/Contents/Resources/English.lproj/PythonDocumentation' % MAJOR_VERSION
|
||||||
|
|
||||||
class DocBuild(build):
|
class DocBuild(build):
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
build.initialize_options(self)
|
build.initialize_options(self)
|
||||||
self.build_html = None
|
self.build_html = None
|
||||||
self.build_dest = None
|
self.build_dest = None
|
||||||
self.download = 0
|
self.download = 1
|
||||||
self.doc_version = '2.3b1' # Only needed if download is true
|
self.doc_version = MINOR_VERSION # Only needed if download is true
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
build.finalize_options(self)
|
build.finalize_options(self)
|
||||||
|
@ -48,20 +52,22 @@ class DocBuild(build):
|
||||||
|
|
||||||
def downloadDocs(self):
|
def downloadDocs(self):
|
||||||
workdir = os.getcwd()
|
workdir = os.getcwd()
|
||||||
url = 'http://www.python.org/ftp/python/doc/%s/html-%s.tgz' % \
|
# XXX Note: the next strings may change from version to version
|
||||||
|
url = 'http://www.python.org/ftp/python/doc/%s/html-%s.tar.bz2' % \
|
||||||
(self.doc_version,self.doc_version)
|
(self.doc_version,self.doc_version)
|
||||||
|
tarfile = 'html-%s.tar.bz2' % self.doc_version
|
||||||
|
dirname = 'Python-Docs-%s' % self.doc_version
|
||||||
|
|
||||||
|
if os.path.exists(self.build_html):
|
||||||
|
raise RuntimeError, '%s: already exists, please remove and try again' % self.build_html
|
||||||
os.chdir(self.build_base)
|
os.chdir(self.build_base)
|
||||||
self.spawn('curl','-O', url)
|
self.spawn('curl','-O', url)
|
||||||
|
self.spawn('tar', '-xjf', tarfile)
|
||||||
|
os.rename(dirname, 'html')
|
||||||
os.chdir(workdir)
|
os.chdir(workdir)
|
||||||
tarfile = 'html-%s.tgz' % self.doc_version
|
## print "** Please unpack %s" % os.path.join(self.build_base, tarfile)
|
||||||
## This no longer works due to name changes
|
## print "** Unpack the files into %s" % self.build_html
|
||||||
## self.mkpath(self.build_html)
|
## raise RuntimeError, "You need to unpack the docs manually"
|
||||||
## os.chdir(self.build_html)
|
|
||||||
## self.spawn('tar', '-xzf', '../' + tarfile)
|
|
||||||
## os.chdir(workdir)
|
|
||||||
print "** Please unpack %s" % os.path.join(self.build_base, tarfile)
|
|
||||||
print "** Unpack the files into %s" % self.build_html
|
|
||||||
raise RuntimeError, "You need to unpack the docs manually"
|
|
||||||
|
|
||||||
def buildDocsFromSource(self):
|
def buildDocsFromSource(self):
|
||||||
srcdir = '../../..'
|
srcdir = '../../..'
|
||||||
|
@ -173,7 +179,7 @@ class AHVDocInstall(Command):
|
||||||
build_cmd = self.get_finalized_command('build')
|
build_cmd = self.get_finalized_command('build')
|
||||||
self.build_dest = build_cmd.build_dest
|
self.build_dest = build_cmd.build_dest
|
||||||
if self.install_doc == None:
|
if self.install_doc == None:
|
||||||
self.install_doc = os.path.join(self.prefix, 'Resources/Python.app/Contents/Resources/English.lproj/PythonDocumentation')
|
self.install_doc = os.path.join(self.prefix, DESTDIR)
|
||||||
print 'INSTALL', self.build_dest, '->', self.install_doc
|
print 'INSTALL', self.build_dest, '->', self.install_doc
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue