Commits  committed bc43400

Add preboot script that redirects the pkg_resources
egg cache from the user's home directory to a
per-application directory in ~/Library/Caches.

This is needed for two reasons:
1) The new location is corresponds to were
Apple would like you to cache temporary files

2) A per-application directory ensures that
two applications cannot interfere with
each other.

This is a (small) first step towards adding
proper egg support to py2app.

  • Participants
  • Parent commits 5c7eca1

Comments (0)

Files changed (2)

File py2app/bootstrap/

+def _setup_pkgresources():
+    import pkg_resources
+    import os, plistlib
+    pl = plistlib.readPlist(os.path.join(
+        os.path.dirname(os.getenv('RESOURCEPATH')), "Info.plist"))
+    appname = pl.get('CFBundleIdentifier')
+    if appname is None:
+        appname = pl['CFBundleDisplayName']
+    path = os.path.expanduser('~/Library/Caches/%s/python-eggs'%(appname,))
+    pkg_resources.set_extraction_path(path)

File py2app/

         if self.site_packages or self.alias:
+        if == 'app':
+            prescripts.append('setup_pkgresource')
         if self.argv_emulation and == 'app':
             if u'CFBundleDocumentTypes' not in self.plist: