setup.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. """ Setup """
  2. import os
  3. import sys
  4. try:
  5. from setuptools import setup, Command
  6. setuptools_available = True
  7. except ImportError:
  8. from distutils.core import setup, Command
  9. setuptools_available = False
  10. from hypervideo_gui.main_ui import (
  11. __version__,
  12. __license__,
  13. )
  14. script_exec = os.path.join('bin', 'hypervideo-gui')
  15. # Begin - Desktop file and Icon
  16. if sys.platform.startswith("linux"):
  17. platform = 'gnu'
  18. else:
  19. sys.stderr.write("Unknown platform: %s" % sys.platform)
  20. ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
  21. SETUP_DIR = os.path.join(ROOT_DIR, 'setup-files', platform)
  22. def icon_data_files():
  23. ''' Loop icon files '''
  24. sizes = [16, 22, 32, 48, 64, 96, 128, 192, 384]
  25. data_icons_files = []
  26. for size in sizes:
  27. icon_dir = os.path.join("icons", "hicolor", "%sx%s" % (size, size), "apps")
  28. source = os.path.join(SETUP_DIR, icon_dir, "hypervideo-gui.png")
  29. dest = os.path.join("/usr/share/", icon_dir)
  30. data_icons_files.append((dest, [source]))
  31. return data_icons_files
  32. def application_data_files():
  33. ''' Desktop file '''
  34. return [
  35. ('/usr/share/applications',
  36. [os.path.join(SETUP_DIR, 'hypervideo-gui.desktop')]),
  37. ]
  38. def data_files():
  39. ''' Return desktop file and icons '''
  40. return application_data_files() + icon_data_files()
  41. setup(
  42. author="Jesús E.",
  43. author_email="heckyel@hyperbola.info",
  44. name="hypervideo_gui",
  45. description="Simple Hypervideo Downloader GUI",
  46. version=__version__,
  47. license=__license__,
  48. url="https://notabug.org/heckyel/hypervideo-gui",
  49. packages=[
  50. 'hypervideo_gui',
  51. ],
  52. scripts=[script_exec],
  53. data_files=data_files(),
  54. )