diff --git a/osx/Info.plist b/osx/Info.plist deleted file mode 100644 index 5d16c4a..0000000 --- a/osx/Info.plist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - CFBundleIconFile - YoutubeDlGui.icns - CFBundlePackageType - APPL - CFBundleGetInfoString - Download your youtube videos via GUI - CFBundleSignature - ???? - CFBundleIdentifier - com.github.youtube-dl-gui - CFBundleExecutable - YoutubeDlGui - - diff --git a/osx/PkgInfo b/osx/PkgInfo deleted file mode 100644 index 6f749b0..0000000 --- a/osx/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPL???? diff --git a/osx/empty.lproj b/osx/empty.lproj deleted file mode 100644 index e69de29..0000000 diff --git a/setup.py b/setup.py index a75d112..673e267 100644 --- a/setup.py +++ b/setup.py @@ -24,6 +24,15 @@ if PY2EXE: print error sys.exit(1) +PY2APP = len(sys.argv) >= 2 and sys.argv[1] == 'py2app' + +if PY2APP: + try: + import py2app + except ImportError as error: + print error + sys.exit(1) + from distutils.core import setup from distutils.sysconfig import get_python_lib @@ -59,7 +68,9 @@ LOCALE_PATH = os.path.join('youtube_dl_gui', 'locale') PY2EXE_LOCALE_DIR = 'locale' WIN_LOCALE_DIR = os.path.join(get_python_lib(), 'youtube_dl_gui', 'locale') LINUX_LOCALE_DIR = '/usr/share/{app_name}/locale/'.format(app_name=__appname__.lower()) -OSX_LOCALE_DIR = '/usr/local/Cellar/youtube-dl-gui/{version}/share/locale'.format(version=__version__) +OSX_PREFIX = '/usr/local/Cellar/youtube-dl-gui/{version}'.format(version=__version__) +OSX_LOCALE_DIR = '{prefix}/share/locale'.format(prefix=OSX_PREFIX) +OSX_APP = '{prefix}/YoutubeDlGui.app'.format(prefix=OSX_PREFIX) def create_scripts(): @@ -127,6 +138,18 @@ def py2exe_setup(): return params +def py2app_setup(): + data_files = [] + create_scripts() + set_locale_files(data_files) + params = { + 'data_files': data_files, + 'app': ['build/_scripts/youtube-dl-gui'], + 'setup_requires': ['py2app'], + 'options': {'py2app': {'argv_emulation': True, 'iconfile': 'youtube_dl_gui/icons/osx/YoutubeDlGui.icns'}}, + } + + return params def normal_setup(): data_files = list() @@ -138,10 +161,6 @@ def normal_setup(): set_locale_files(data_files) params = {'data_files': data_files} - elif sys.platform == 'darwin': - create_scripts() - set_locale_files(data_files) - params = {'data_files': data_files, 'scripts': ['build/_scripts/youtube-dl-gui']} else: # Create all the hicolor icons for index, size in enumerate(ICONS_SIZES): @@ -165,7 +184,10 @@ def normal_setup(): if PY2EXE: params = py2exe_setup() else: - params = normal_setup() + if PY2APP: + params = py2app_setup() + else: + params = normal_setup() setup( diff --git a/osx/YoutubeDlGui.icns b/youtube_dl_gui/icons/osx/YoutubeDlGui.icns similarity index 100% rename from osx/YoutubeDlGui.icns rename to youtube_dl_gui/icons/osx/YoutubeDlGui.icns