|
|
@ -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( |
|
|
|