Commits

Michael McCracken committed a96aed0 Draft

Make SIP recipe work with homebrew-installed PyQt:

1. Change directory to look in for PyQt submodules to be cfg.pyqt_mod_dir - I suspect the fact that default_sip_dir worked with macports means that the macports version of pyqt wasn't installed correctly.

2. since the submodules found in pyqt_mod_dir are not directories but Module.so, strip .so to get the right module name

Comments (0)

Files changed (1)

py2app/recipes/sip.py

             dyld_library_path.insert(0, qtdir)
             os.environ['DYLD_LIBRARY_PATH'] = ':'.join(dyld_library_path)
 
-        sipdir = cfg.default_sip_dir
+        sipdir = os.path.dirname(cfg.pyqt_mod_dir)
         self.packages = set()
 
         for fn in os.listdir(sipdir):
                     # PyQt4 has a nested structure, also import
                     # subpackage to ensure everything get seen.
                     for sub in os.listdir(fullpath):
-                        self.packages.add('%s.%s'%(fn, sub))
-                
+                        if ".py" not in sub:
+                            self.packages.add('%s.%s'%(fn, sub.replace(".so","")))                            
+
+        # Causes a python3-related syntax error (metaclass keyword),
+        # and you probably don't need it:
+        if "PyQt4.uic" in self.packages and sys.version_info.major != 3:
+            print "WARNING: PyQt uic module found."
+            print "avoid python3 metaclass syntax errors by adding 'PyQt4.uic' to your excludes option."
+
         self.warn = cfg.qt_edition == 'free'
         return self.packages