]> granicus.if.org Git - python/commitdiff
The MacPython introductory help is now called MacPython Help, and the
authorJack Jansen <jack.jansen@cwi.nl>
Sun, 16 Mar 2003 22:09:22 +0000 (22:09 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sun, 16 Mar 2003 22:09:22 +0000 (22:09 +0000)
optional full documentation Python Documentation.

Mac/OSX/Doc/setup.py
Mac/OSXResources/app/Info.plist
Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html
Mac/Tools/IDE/PythonIDEMain.py

index 8e1265e12b69cf0df6d21c41b226ac8e3f9ab36a..7ab0ea970742362452b96ab14c3a56cde056edac 100644 (file)
@@ -32,7 +32,7 @@ class DocBuild(build):
                self.build_html = None
                self.build_dest = None
                self.download = 1
-               self.doc_version = '2.2.1'
+               self.doc_version = '2.2.2'
                
        def finalize_options(self):
                build.finalize_options(self)
@@ -46,13 +46,20 @@ class DocBuild(build):
        
        def downloadDocs(self):
                workdir = os.getcwd()
-               self.mkpath(self.build_html)
+               url = 'http://www.python.org/ftp/python/doc/%s/html-%s.tgz' % \
+                       (self.doc_version,self.doc_version)
                os.chdir(self.build_base)
-               self.spawn('curl','-O', 'http://www.python.org/ftp/python/doc/%s/html-%s.tgz' % (self.doc_version,self.doc_version))
-               os.chdir(workdir)
-               os.chdir(self.build_html)
-               self.spawn('tar', '-xzf', '../html-%s.tgz' % self.doc_version)
+               self.spawn('curl','-O', url)
                os.chdir(workdir)
+               tarfile = 'html-%s.tgz' % self.doc_version
+## This no longer works due to name changes
+##             self.mkpath(self.build_html)
+##             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):
                srcdir = '../../..'
@@ -75,7 +82,7 @@ class DocBuild(build):
                hackedIndex = file(os.path.join(self.build_dest, ind_html),'w')
                origIndex = file(os.path.join(self.build_html,ind_html))
                r = re.compile('<style type="text/css">.*</style>', re.DOTALL)
-               hackedIndex.write(r.sub('<META NAME="AppleTitle" CONTENT="Python Help">',origIndex.read()))
+               hackedIndex.write(r.sub('<META NAME="AppleTitle" CONTENT="Python Documentation">',origIndex.read()))
        
        def hackFile(self,d,f):
                origPath = os.path.join(d,f)
@@ -107,6 +114,7 @@ class DocBuild(build):
                
        def run(self):
                self.ensure_finalized()
+               self.mkpath(self.build_base)
                self.ensureHtml()
                if not os.path.isdir(self.build_html):
                        raise RuntimeError, \
@@ -142,7 +150,7 @@ class AHVDocInstall(Command):
                        build_cmd = self.get_finalized_command('build')
                        self.build_dest = build_cmd.build_dest
                if self.install_doc == None:
-                       self.install_doc = os.path.join(self.prefix, 'Resources/English.lproj/Documentation')
+                       self.install_doc = os.path.join(self.prefix, 'Resources/Python.app/Contents/Resources/English.lproj/PythonDocumentation')
                print 'INSTALL', self.build_dest, '->', self.install_doc
                
        def run(self):
index d1b5eb9184ee56809cc13ee65a774a7f736e2270..c8fb6ee9d947b8d5b950d2c4586074e8e66fe1bd 100644 (file)
        <key>CFBundleHelpBookFolder</key>
        <array>
                <string>Documentation</string>
+               <string>PythonDocumentation</string>
        </array>
        <key>CFBundleHelpBookName</key>
-       <string>Python Help</string>
+       <string>MacPython Help</string>
        <key>CFBundleHelpTOCFile</key>
        <string>index.html</string>
 
index dc6d5f32b57ea091cf49a0c2f63e3e84e3015a3f..b020d2f79a45f58325421ce26945b29bdc8b937b 100644 (file)
@@ -7,7 +7,7 @@
        <meta name="generator" content="BBEdit 6.5.3">
        <link rel="SHORTCUT ICON" href="pythonsmall.gif">
        <META NAME="AppleIcon" CONTENT="pythonsmall.gif">
-       <META NAME="AppleTitle" CONTENT="Python Help">
+       <META NAME="AppleTitle" CONTENT="MacPython Help">
 </head>
 <body>
 
index 01969e95bdae090b38c3b6bc051d1f6bec1b4f12..fec8620c8d0752fe2d94256765c2e53606fa90a2 100644 (file)
@@ -353,12 +353,14 @@ class PythonIDE(Wapplication.Application):
                PackageManager.PackageBrowser()
                
        def makehelpmenu(self):
-               docs = self.installdocumentation()
+               hashelp, hasdocs = self.installdocumentation()
                self.helpmenu = m = self.gethelpmenu()
+               helpitem = FrameWork.MenuItem(m, "MacPython Help", None, self.domenu_localhelp)
+               helpitem.enable(hashelp)
                docitem = FrameWork.MenuItem(m, "Python Documentation", None, self.domenu_localdocs)
-               docitem.enable(docs)
+               docitem.enable(hasdocs)
                finditem = FrameWork.MenuItem(m, "Lookup in Python Documentation", None, 'lookuppython')
-               finditem.enable(docs)
+               finditem.enable(hasdocs)
                if runningOnOSX():
                        FrameWork.Separator(m)
                        doc2item = FrameWork.MenuItem(m, "Apple Developer Documentation", None, self.domenu_appledocs)
@@ -370,7 +372,11 @@ class PythonIDE(Wapplication.Application):
                
        def domenu_localdocs(self, *args):
                from Carbon import AH
-               AH.AHGotoPage("Python Help", None, None)
+               AH.AHGotoPage("Python Documentation", None, None)
+               
+       def domenu_localhelp(self, *args):
+               from Carbon import AH
+               AH.AHGotoPage("MacPython Help", None, None)
                
        def domenu_appledocs(self, *args):
                from Carbon import AH, AppleHelp
@@ -388,7 +394,7 @@ class PythonIDE(Wapplication.Application):
                if not searchstring:
                        return
                try:
-                       AH.AHSearch("Python Help", searchstring)
+                       AH.AHSearch("Python Documentation", searchstring)
                except AH.Error, arg:
                        W.Message("AppleHelp Error: %s" % `arg`)
                        
@@ -441,16 +447,17 @@ class PythonIDE(Wapplication.Application):
                # And as AHRegisterHelpBook wants a bundle (with the right bits in
                # the plist file) we refer it to Python.app
                python_app = os.path.join(sys.prefix, 'Resources/Python.app')
-               doc_source = os.path.join(python_app, 'Contents/Resources/English.lproj/Documentation')
-               if not os.path.isdir(doc_source):
-                       return 0
-               try:
-                       from Carbon import AH
-                       AH.AHRegisterHelpBook(python_app)
-               except (ImportError, MacOS.Error), arg:
-                       W.Message("Cannot register Python documentation: %s" % `arg`)
-                       return 0
-               return 1
+               help_source = os.path.join(python_app, 'Contents/Resources/English.lproj/Documentation')
+               doc_source = os.path.join(python_app, 'Contents/Resources/English.lproj/PythonDocumentation')
+               has_help = os.path.isdir(help_source)
+               has_doc = os.path.isdir(doc_source)
+               if has_help or has_doc:
+                       try:
+                               from Carbon import AH
+                               AH.AHRegisterHelpBook(python_app)
+                       except (ImportError, MacOS.Error), arg:
+                               pass # W.Message("Cannot register Python Documentation: %s" % str(arg))
+               return has_help, has_doc
        
 
 PythonIDE()