diff options
Diffstat (limited to 'setup.py')
| -rwxr-xr-x | setup.py | 73 |
1 files changed, 71 insertions, 2 deletions
@@ -1,6 +1,11 @@ #!/usr/bin/env python -# import sys + +from glob import glob +import os from setuptools import setup +import shutil +from subprocess import call +import sys try: import fontTools # noqa @@ -21,8 +26,48 @@ except: "see:") print(" https://github.com/trufont/defcon") + +name = 'TruFont' +app = [] +options = {} +data_files = [] +setup_requires = [] +build_for_mac = sys.platform == 'darwin' and sys.argv[1] == 'py2app' + +if build_for_mac: + options['py2app'] = { + 'argv_emulation': True, + 'iconfile': 'Lib/defconQt/resources/app.icns', + 'includes': ['sip', 'PyQt5', 'defconQt'], + 'frameworks': [ + glob('/usr/local/Cellar/qt5*/5.*/plugins/platforms/libqcocoa.dylib')[0], + glob('/usr/local/Cellar/qt5*/5.*/plugins/iconengines/libqsvgicon.dylib')[0], + ], + 'qt_plugins': ['*'], + 'plist': { + 'CFBundleIdentifier': 'io.github.trufont', + 'CFBundleDocumentTypes': [ + { + 'CFBundleTypeExtensions': [ + 'ufo', + ], + 'CFBundleTypeName': 'Unified Font Object', + 'CFBundleTypeRole': 'Editor', + 'LSTypeIsPackage': True, + } + ], + 'NSHighResolutionCapable': 'True', + 'NSHumanReadableCopyright': '', + } + } + + app.append('Lib/defconQt/__main__.py') + data_files.append('qt.conf') + setup_requires.append('py2app') + + setup( - name="defconQt", + name=name, version="0.3.0", description="TruFont, a cross-platform font editor. Includes a set of Qt " "objects for working with font data.", @@ -43,6 +88,10 @@ setup( ] }, package_dir={"": "Lib"}, + app=app, + data_files=data_files, + options=options, + setup_requires=setup_requires, platforms=["Linux", "Win32", "Mac OS X"], classifiers=[ "Environment :: GUI", @@ -52,3 +101,23 @@ setup( ], test_suite="tests", ) + + +if build_for_mac: + # Copy dylibs to Qt PlugIns directory + os.makedirs( + 'dist/' + name + '.app/Contents/PlugIns/platforms', + exist_ok=True + ) + os.makedirs( + 'dist/' + name + '.app/Contents/PlugIns/iconengines', + exist_ok=True + ) + shutil.copyfile( + 'dist/' + name + '.app/Contents/Frameworks/libqcocoa.dylib', + 'dist/' + name + '.app/Contents/PlugIns/platforms/libqcocoa.dylib' + ) + shutil.copyfile( + 'dist/' + name + '.app/Contents/Frameworks/libqsvgicon.dylib', + 'dist/' + name + '.app/Contents/PlugIns/iconengines/libqsvgicon.dylib' + ) |
