Commits

Ronald Oussoren  committed e086b80

Explictly add lib-dynlib to sys.path for semi-standalone builds

Without this patch semi-standalone builds that include extensions
that are not in the stdlib or site-packages won't work properly.

  • Participants
  • Parent commits 155808e
  • Branches branch-0.7

Comments (0)

Files changed (4)

File doc/changelog.rst

 
   Reported by Andrew Barnert.
 
+- For semi-standalone applications the "lib-dynload" directory inside the
+  application was not on "sys.path", which resulted in launch failures
+  when using an extension that is not in the stdlib.
+
 py2app 0.7
 ------------
 

File py2app/bootstrap/semi_standalone_path.py

+def _update_path():
+    import os, sys
+    resources = os.environ['RESOURCEPATH']
+    sys.path.append(os.path.join(
+        resources, 'lib', 'python%d.%d'%(sys.version_info[:2]), 'lib-dynload'))
+
+_update_path()

File py2app/build_app.py

     def initialize_prescripts(self):
         prescripts = []
         prescripts.append('reset_sys_path')
+        if self.semi_standalone:
+            prescripts.append('semi_standalone_path')
+
         if 0 and sys.version_info[:2] >= (3, 2) and not self.alias:
             # Python 3.2 or later requires a more complicated
             # bootstrap

File py2app_tests/app_with_scripts/presetup.py

         return result
 
     def run(self):
-        print "running build_dylib"
+        print("running build_dylib")
         bdir = 'build/libdir'
         if os.path.exists(bdir):
             shutil.rmtree(bdir)