Browse Source

Merge pull request #42 from pr0d1r2/osx-app

Osx app creation
doc-issue-template
MrS0m30n3 9 years ago
parent
commit
95189d3d82
5 changed files with 28 additions and 25 deletions
  1. 18
      osx/Info.plist
  2. 1
      osx/PkgInfo
  3. 0
      osx/empty.lproj
  4. 34
      setup.py
  5. 0
      youtube_dl_gui/icons/osx/YoutubeDlGui.icns

18
osx/Info.plist

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>CFBundleIconFile</key>
<string>YoutubeDlGui.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>Download your youtube videos via GUI</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleIdentifier</key>
<string>com.github.youtube-dl-gui</string>
<key>CFBundleExecutable</key>
<string>YoutubeDlGui</string>
</dict>
</plist>

1
osx/PkgInfo

@ -1 +0,0 @@
APPL????

0
osx/empty.lproj

34
setup.py

@ -24,6 +24,15 @@ if PY2EXE:
print error print error
sys.exit(1) 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.core import setup
from distutils.sysconfig import get_python_lib from distutils.sysconfig import get_python_lib
@ -59,7 +68,9 @@ LOCALE_PATH = os.path.join('youtube_dl_gui', 'locale')
PY2EXE_LOCALE_DIR = 'locale' PY2EXE_LOCALE_DIR = 'locale'
WIN_LOCALE_DIR = os.path.join(get_python_lib(), 'youtube_dl_gui', '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()) 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(): def create_scripts():
@ -127,6 +138,18 @@ def py2exe_setup():
return params 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(): def normal_setup():
data_files = list() data_files = list()
@ -138,10 +161,6 @@ def normal_setup():
set_locale_files(data_files) set_locale_files(data_files)
params = {'data_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: else:
# Create all the hicolor icons # Create all the hicolor icons
for index, size in enumerate(ICONS_SIZES): for index, size in enumerate(ICONS_SIZES):
@ -165,7 +184,10 @@ def normal_setup():
if PY2EXE: if PY2EXE:
params = py2exe_setup() params = py2exe_setup()
else: else:
params = normal_setup()
if PY2APP:
params = py2app_setup()
else:
params = normal_setup()
setup( setup(

osx/YoutubeDlGui.icns → youtube_dl_gui/icons/osx/YoutubeDlGui.icns

Loading…
Cancel
Save