From 37172578152f6f3d6ef169d79062c1d28ab0e98c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Tue, 8 Jul 2014 15:41:20 -0300 Subject: Add packaging for osx with py2app --- changes/feature_package_osx | 1 + pkg/osx/Info.plist | 34 ++++++++++++++++++---------------- setup.py | 29 ++++++++++++++++++++++++++++- src/leap/bitmask/__init__.py | 6 ++++++ src/leap/bitmask/gui/__init__.py | 6 ++++-- 5 files changed, 57 insertions(+), 19 deletions(-) create mode 100644 changes/feature_package_osx diff --git a/changes/feature_package_osx b/changes/feature_package_osx new file mode 100644 index 00000000..cf5823bd --- /dev/null +++ b/changes/feature_package_osx @@ -0,0 +1 @@ +- Add the ability to create an osx bundle with py2app. Closes #5845. \ No newline at end of file diff --git a/pkg/osx/Info.plist b/pkg/osx/Info.plist index e90d920a..dc427c4a 100644 --- a/pkg/osx/Info.plist +++ b/pkg/osx/Info.plist @@ -2,21 +2,23 @@ - CFBundleDisplayName - leap-client - CFBundleExecutable - MacOS/app - CFBundleIconFile - icon-windowed.icns - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - leap-client - CFBundlePackageType - APPL - CFBundleShortVersionString - 1 - LSBackgroundOnly - + CFBundleDisplayName + Bitmask + CFBundleExecutable + app + CFBundleIconFile + bitmask.icns + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Bitmask + CFBundlePackageType + APPL + CFBundleShortVersionString + 1 + LSBackgroundOnly + + CFBundleIdentifier + se.leap.bitmask diff --git a/setup.py b/setup.py index bb1937cc..7cd48799 100755 --- a/setup.py +++ b/setup.py @@ -253,7 +253,8 @@ cmdclass["sdist"] = cmd_sdist import platform _system = platform.system() -IS_LINUX = True if _system == "Linux" else False +IS_LINUX = _system == "Linux" +IS_MAC = _system == "Darwin" data_files = [] @@ -267,6 +268,31 @@ if IS_LINUX: ["pkg/linux/bitmask-root"]), ] +extra_options = {} + +if IS_MAC: + extra_options["app"] = ['src/leap/bitmask/app.py'] + OPTIONS = { + 'argv_emulation': True, + 'plist': 'pkg/osx/Info.plist', + 'iconfile': 'pkg/osx/bitmask.icns', + } + extra_options["options"] = {'py2app': OPTIONS} + extra_options["setup_requires"] = ['py2app'] + + class jsonschema_recipe(object): + def check(self, dist, mf): + m = mf.findNode('jsonschema') + if m is None: + return None + + # Don't put jsonschema in the site-packages.zip file + return dict( + packages=['jsonschema'] + ) + + import py2app.recipes + py2app.recipes.jsonschema = jsonschema_recipe() setup( name="leap.bitmask", @@ -305,4 +331,5 @@ setup( entry_points={ 'console_scripts': [leap_launcher] }, + **extra_options ) diff --git a/src/leap/bitmask/__init__.py b/src/leap/bitmask/__init__.py index 0f733f26..03da1e2f 100644 --- a/src/leap/bitmask/__init__.py +++ b/src/leap/bitmask/__init__.py @@ -25,6 +25,12 @@ from pkg_resources import parse_version from leap.bitmask.util import first +# HACK: This is a hack so that py2app copies _scrypt.so to the right +# place, it can't be technically imported, but that doesn't matter +# because the import is never executed +if False: + import _scrypt + def _is_release_version(version): """ diff --git a/src/leap/bitmask/gui/__init__.py b/src/leap/bitmask/gui/__init__.py index 4b289442..94bf1fd5 100644 --- a/src/leap/bitmask/gui/__init__.py +++ b/src/leap/bitmask/gui/__init__.py @@ -17,5 +17,7 @@ """ init file for leap.gui """ -app = __import__("app", globals(), locals(), [], 2) -__all__ = [app] +# This was added for coverage and testing, but when doing the osx +# bundle with py2app it fails because of this, so commenting for now +# app = __import__("app", globals(), locals(), [], 2) +# __all__ = [app] -- cgit v1.2.3 From 2d7fcd6cbb65945c64fe9fa949a6d176f5dd0d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Thu, 10 Jul 2014 11:18:52 -0300 Subject: Add bitmask.icns file --- pkg/osx/bitmask.icns | Bin 0 -> 47303 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 pkg/osx/bitmask.icns diff --git a/pkg/osx/bitmask.icns b/pkg/osx/bitmask.icns new file mode 100644 index 00000000..7cc3e752 Binary files /dev/null and b/pkg/osx/bitmask.icns differ -- cgit v1.2.3