]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Allow for the documentation to be inside PythonIDE as well as in
authorJack Jansen <jack.jansen@cwi.nl>
Sat, 1 Nov 2003 23:14:41 +0000 (23:14 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sat, 1 Nov 2003 23:14:41 +0000 (23:14 +0000)
the Python.app inside the framework (the original location for 2.3).

This enables us to install the documentation on Panther too.

Mac/Tools/IDE/PythonIDE.plist
Mac/Tools/IDE/PythonIDEMain.py

index 5c33965d829d8972733fe3b96a8b2ac4e20d53d7..37956d58a5816b04797465af479ecf79100acd2d 100644 (file)
        <key>CFBundleShortVersionString</key>
        <string>2.3.2</string>
 
+       <key>CFBundleHelpBookFolder</key>
+       <array>
+               <string>PythonDocumentation</string>
+       </array>
+       <key>CFBundleHelpBookName</key>
+       <string>Python Help</string>
+       <key>CFBundleHelpTOCFile</key>
+       <string>index.html</string>
+
        <key>CFBundleIconFile</key>
        <string>PythonIDE.icns</string>
        <key>CFBundleIdentifier</key>
index 6641fcdfe4e9ce82c78967f23ab19ef5e88665cc..3ad35b725f1ff6318f793caeb61138276977bd30 100644 (file)
@@ -37,7 +37,6 @@ class PythonIDE(Wapplication.Application):
                                home = os.getenv("HOME")
                                if home:
                                        os.chdir(home)
-               print "We are in", os.getcwd()
                self.preffilepath = os.path.join("Python", "PythonIDE preferences")
                Wapplication.Application.__init__(self, 'Pide')
                from Carbon import AE
@@ -455,11 +454,31 @@ class PythonIDE(Wapplication.Application):
                # is located in the framework, but there's a symlink in Python.app.
                # And as AHRegisterHelpBook wants a bundle (with the right bits in
                # the plist file) we refer it to Python.app
+               #
+               # To make matters worse we have to look in two places: first in the IDE
+               # itself, then in the Python application inside the framework.
+               has_help = False
+               has_doc = False
+               ide_path_components = sys.argv[0].split("/")
+               if ide_path_components[-3:] == ["Contents", "Resources", "PythonIDE.py"]:
+                       ide_app = "/".join(ide_path_components[:-3])
+                       help_source = os.path.join(ide_app, 'Contents/Resources/English.lproj/Documentation')
+                       doc_source = os.path.join(ide_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(ide_app)
+                               except (ImportError, MacOS.Error), arg:
+                                       pass # W.Message("Cannot register Python Documentation: %s" % str(arg))
                python_app = os.path.join(sys.prefix, 'Resources/Python.app')
-               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 not has_help:
+                       help_source = os.path.join(python_app, 'Contents/Resources/English.lproj/Documentation')
+                       has_help = os.path.isdir(help_source)
+               if not has_doc:
+                       doc_source = os.path.join(python_app, 'Contents/Resources/English.lproj/PythonDocumentation')
+                       has_doc = os.path.isdir(doc_source)
                if has_help or has_doc:
                        try:
                                from Carbon import AH