Issue
setup.py
APP = ['systray.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'includes': ['djmemori.settings'],
'packages': ['django', 'south'],
'qt_plugins': 'imageformats' # if I comment out this line, python setup.py py2app will success
}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
python setup.py py2app
...
copying file /Users/teamx/workspace/env-memori-pkg/lib/python2.7/site-packages/py2app/recipes/qt.conf -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt.conf
copying file /Developer/Applications/Qt/plugins/imageformats/libqgif.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqgif.dylib
copying file /Developer/Applications/Qt/plugins/imageformats/libqico.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqico.dylib
copying file /Developer/Applications/Qt/plugins/imageformats/libqjpeg.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqjpeg.dylib
copying file /Developer/Applications/Qt/plugins/imageformats/libqmng.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqmng.dylib
copying file /Developer/Applications/Qt/plugins/imageformats/libqsvg.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqsvg.dylib
copying file /Developer/Applications/Qt/plugins/imageformats/libqtiff.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqtiff.dylib
copying file /.dbfseventsd -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/.dbfseventsd
error: /.dbfseventsd: Operation not supported on socket
Solution
Change code py2app/recipes/pyside.py:21
if '*' in item:
for path in glob.glob(os.path.join(plugin_dir, item)):
resources.append((os.path.dirname('qt_plugins' + path[len(plugin_dir):]), [path]))
else:
resources.append((os.path.dirname(os.path.join('qt_plugins', item)), os.path.join(plugin_dir, item)))
to
if '*' in item:
for path in glob.glob(os.path.join(plugin_dir, item)):
resources.append((os.path.dirname('qt_plugins' + path[len(plugin_dir):]), [path]))
else:
resources.append((os.path.dirname(os.path.join('qt_plugins', item)), os.path.join(plugin_dir, item)))
can resolve this problem.
The code indent problem will cause py2app add a resource:
('qt_plugins/imageformats', u'/Developer/Applications/Qt/plugins/imageformats/*') # note that the second item of the tuple should be a list, but it's a string here
And then in py2app/build_app.py:598
def iter_data_files(self):
dist = self.distribution
allres = chain(getattr(dist, 'data_files', ()) or (), self.resources)
for (path, files) in (normalize_data_file(fn) for fn in allres):
path = fsencoding(path)
for fn in files: # <-- this line
fn = fsencoding(fn)
yield fn, os.path.join(path, os.path.basename(fn))
files should be a list, but now, it's a string: u'/Developer/Applications/Qt/plugins/imageformats/*' This will cause py2app to copy files in path: '/', 'D', 'e', 'v', ... So py2app begin to iterate root path '/', when it encouter /.dbfseventsd, it crashed.
Answered By - ax003d
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.