Commits

Ronald Oussoren committed 7109b98

Two changes

1) Emit an error when py2app is used with an --enable-shared build of python
and that version is too old (every current release).

2) Also ignore .hg and .git when copying package data (.svn and CVS)
were already ignored. Fixes issue #87.

Comments (0)

Files changed (3)

doc/changelog.rst

 - Issue #82: Remove debug print statement from py2app.util.LOADER that
   caused problems with Python 3.
 
+- Issue #..: Py2app now fails with an error when trying to build a bundle
+  for a unix-style shared library build of Python (``--enable-shared``) unless 
+  you are using a recent enough patchlevel of python (2.7.4, 3.2.3, 3.3.1, 3.4.0, 
+  all of them are not released at the point in time).
+
+  The build failure was added to avoid a very confusing error when trying
+  to start the generated application due to a bug in the way python reads 
+  the environment (for shared library builds on Mac OS X).
+
+- Py2app will also give an error message when the python binary does not
+  have a shared library (or framework) at all.
+
+- Issue #87: Ignore '.git' and '.hg' directories while copying package data
+  ('.svn' and 'CVS' were already ignored).
+
 py2app 0.7.2
 ------------
 

py2app/build_app.py

             yield runtime
 
     def run(self):
+        if sysconfig.get_config_var('PYTHONFRAMEWORK') is None:
+            if not sysconfig.get_config_var('Py_ENABLE_SHARED'):
+                raise DistutilsPlatformError("This python does not have a shared library or framework")
+
+            else:
+                # Issue .. in py2app's tracker, and issue .. in python's tracker: a unix-style shared 
+                # library build did not read the application environment correctly. The collection of
+                # if statements below gives a clean error message when py2app is started, instead of
+                # building a bundle that will give a confusing error message when started.
+                msg = "py2app is not supported for a shared library build with this version of python"
+                if sys.version_info[:2] < (2,7):
+                    raise DistutilsPlatformError(msg)
+                elif sys.version_info[:2] == (2,7) and sys.version[3] < 4:
+                    raise DistutilsPlatformError(msg)
+                elif sys.version_info[0] == 3 and sys.version_info[1] < 2:
+                    raise DistutilsPlatformError(msg)
+                elif sys.version_info[0] == 3 and sys.version_info[1] == 2 and sys.version_info[3] < 3:
+                    raise DistutilsPlatformError(msg)
+                elif sys.version_info[0] == 3 and sys.version_info[1] == 3 and sys.version_info[3] < 1:
+                    raise DistutilsPlatformError(msg)
+
         if hasattr(self.distribution, "install_requires") \
                 and self.distribution.install_requires:
 
         for dname in package.packagepath:
             filenames = list(filter(datafilter, zipio.listdir(dname)))
             for fname in filenames:
-                if fname in ('.svn', 'CVS'):
+                if fname in ('.svn', 'CVS', '.hg', '.git'):
                     # Scrub revision manager junk
                     continue
                 if fname in ('__pycache__',):
                     print("skipping byte-compilation of %s to %s" % 
                           (mod.filename, dfile))
 
-SCMDIRS = ['CVS', '.svn']
+SCMDIRS = ['CVS', '.svn', '.hg', '.git']
 def skipscm(ofn):
     ofn = fsencoding(ofn)
     fn = os.path.basename(ofn)