Commits

Ronald Oussoren committed fdf3de8

- Merge buildpkg.py from Python 2.3 CVS, needed for working postinstall scripts
- The generated package is named PyObjC.pkg instead of PyObjC-%(version)s.pkg,
hopefully makes future postinstall scripts that move files around unnecessary
- Add post_install and post_upgrade script (with same contents) that remove the
PyObjC related modules/packages from the site-package directory: Needed for
clean upgrades from PyObjC 0.8 installations.

Comments (0)

Files changed (4)

pyobjc/Installer Package/Resources/post_install

+#!/bin/sh
+
+# Version of PyObjC before 0.9 installed python files in the site-packages
+# directory, from 0.9 onwards we install in site-packages/PyObjC.
+
+for dn in AddressBook AppKit Foundation autoGil.so objc
+do
+	rm -rf "/usr/lib/python2.2/site-packages/${dn}"
+done
+
+exit 0

pyobjc/Installer Package/Resources/post_upgrade

+#!/bin/sh
+
+# Version of PyObjC before 0.9 installed python files in the site-packages
+# directory, from 0.9 onwards we install in site-packages/PyObjC.
+
+for dn in AddressBook AppKit Foundation autoGil.so objc
+do
+	rm -rf "/usr/lib/python2.2/site-packages/${dn}"
+done
+
+exit 0

pyobjc/Scripts/buildpkg.py

 Required
 InstallOnly
 RequiresReboot
+RootVolumeOnly
 InstallFat\
 """
 
         'Required': 'NO',
         'InstallOnly': 'NO',
         'RequiresReboot': 'NO',
-        'InstallFat': 'NO',
-        'RootVolumeOnly' : 'NO'}
+        'RootVolumeOnly' : 'NO',
+        'InstallFat': 'NO'}
 
 
     def __init__(self, title, version, desc):
             allFiles = allFiles + glob.glob(pattern)
 
         # find pre-process and post-process scripts
-        # naming convention: packageName.{pre,post}-{upgrade,install}
-        # Alternatively the filenames can be {pre,post}-{upgrade,install}
+        # naming convention: packageName.{pre,post}_{upgrade,install}
+        # Alternatively the filenames can be {pre,post}_{upgrade,install}
         # in which case we prepend the package name
         packageName = self.packageInfo["Title"]
-        for pat in ("*upgrade", "*install"):
+        for pat in ("*upgrade", "*install", "*flight"):
             pattern = join(self.resourceFolder, packageName + pat)
+            pattern2 = join(self.resourceFolder, pat)
             allFiles = allFiles + glob.glob(pattern)
+            allFiles = allFiles + glob.glob(pattern2)
 
         # check name patterns
         files = []
         for f in allFiles:
             for s in ("Welcome", "License", "ReadMe"):
                 if string.find(basename(f), s) == 0:
-                    files.append((f, basename(f)))
+                    files.append((f, f))
             if f[-6:] == ".lproj":
-                files.append((f, basename(f)))
-            elif f in ["pre-upgrade", "pre-install", "post-upgrade", "post-install"]:
-                files.append((f, self.packageInfo["Title"]+"."+basename(f)))
-            elif f[-8:] == "-upgrade":
-                files.append((f,basename(f)))
-            elif f[-8:] == "-install":
-                files.append((f,basename(f)))
+                files.append((f, f))
+            elif basename(f) in ["pre_upgrade", "pre_install", "post_upgrade", "post_install"]:
+                files.append((f, packageName+"."+basename(f)))
+            elif basename(f) in ["preflight", "postflight"]:
+                files.append((f, f))
+            elif f[-8:] == "_upgrade":
+                files.append((f,f))
+            elif f[-8:] == "_install":
+                files.append((f,f))
 
         # copy files
         for src, dst in files:
+            src = basename(src)
+            dst = basename(dst)
             f = join(self.resourceFolder, src)
             if isfile(f):
                 shutil.copy(f, os.path.join(self.packageResourceFolder, dst))

pyobjc/Scripts/make_distrib.py

 os.path.walk(docsDestination, killNasties, None)
 
 print 'Building package'
-pm = buildpkg.PackageMaker('PyObjC-%s' % package_version(), package_version(), 
+pm = buildpkg.PackageMaker('PyObjC', package_version(), 
 """\
 Python <-> Objective-C bridge that supports building full featured Cocoa
 applications.