You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.2 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. #!/usr/bin/env python2
  2. import os
  3. import sys
  4. PY2EXE = len(sys.argv) >= 2 and sys.argv[1] == 'py2exe'
  5. try:
  6. import py2exe
  7. except ImportError as e:
  8. if PY2EXE:
  9. print e
  10. sys.exit(1)
  11. from distutils.core import setup
  12. from youtube_dl_gui import (
  13. __author__,
  14. __appname__,
  15. __contact__,
  16. __version__,
  17. __license__,
  18. __projecturl__,
  19. __description__,
  20. __descriptionfull__
  21. )
  22. ICONS_SIZE = ('16x16', '32x32', '64x64', '128x128', '256x256')
  23. ICONS_NAME = 'youtube_dl_gui/icons/youtube-dl-gui_%s.png'
  24. ICONS_LIST = [ICONS_NAME % size for size in ICONS_SIZE]
  25. py2exe_includes = [
  26. 'wx.lib.pubsub.*',
  27. 'wx.lib.pubsub.core.*',
  28. 'wx.lib.pubsub.core.arg1.*'
  29. ]
  30. py2exe_options = {
  31. 'includes': py2exe_includes
  32. }
  33. py2exe_windows = {
  34. 'script': 'youtube_dl_gui\\__main__.py',
  35. 'icon_resources': [(0, 'youtube_dl_gui\\icons\\youtube-dl-gui.ico')]
  36. }
  37. py2exe_dependencies = [
  38. 'C:\\Windows\\System32\\ffmpeg.exe',
  39. 'C:\\Windows\\System32\\ffprobe.exe',
  40. 'C:\\python27\\DLLs\MSVCP90.dll'
  41. ]
  42. # Set icons path
  43. if PY2EXE:
  44. icons_path = 'icons'
  45. else:
  46. # On windows you have to copy the icons manually if you dont use py2exe
  47. xdg_data_dirs = os.getenv('XDG_DATA_DIRS')
  48. if xdg_data_dirs is None:
  49. icons_path = '/usr/share/pixmaps/'
  50. else:
  51. icons_path = '/usr/local/share/icons/hicolor/'
  52. # Set params
  53. if PY2EXE:
  54. data_files = [
  55. ('', py2exe_dependencies),
  56. (icons_path, ICONS_LIST)
  57. ]
  58. params = {
  59. 'data_files': data_files,
  60. 'windows': [py2exe_windows],
  61. 'options': {'py2exe': py2exe_options}
  62. }
  63. else:
  64. data_files = []
  65. if os.name != 'nt':
  66. if xdg_data_dirs is not None:
  67. for index, size in enumerate(ICONS_SIZE):
  68. data_file = (icons_path + size + '/apps', [ICONS_LIST[index]])
  69. data_files.append(data_file)
  70. else:
  71. data_files = [(icons_path, ICONS_LIST)]
  72. params = {
  73. 'data_files': data_files
  74. }
  75. setup(
  76. name=__appname__,
  77. author=__author__,
  78. url=__projecturl__,
  79. version=__version__,
  80. license=__license__,
  81. author_email=__contact__,
  82. description=__description__,
  83. long_description=__descriptionfull__,
  84. packages=['youtube_dl_gui'],
  85. **params
  86. )