aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
blob: 3ede35c6e7bf2d0f9e1310265c5b5b514aa69f1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
""" Setup """
import os
import sys

try:
    from setuptools import setup, Command
    setuptools_available = True
except ImportError:
    from distutils.core import setup, Command
    setuptools_available = False

from hypervideo_gui.main_ui import (
    __version__,
    __license__,
)

script_exec = os.path.join('bin', 'hypervideo-gui')


# Begin - Desktop file and Icon
if sys.platform.startswith("linux"):
    platform = 'gnu'
else:
    sys.stderr.write("Unknown platform: %s" % sys.platform)

ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
SETUP_DIR = os.path.join(ROOT_DIR, 'setup-files', platform)


def icon_data_files():
    ''' Loop icon files '''
    sizes = [16, 22, 32, 48, 64, 96, 128, 192, 384]
    data_icons_files = []
    for size in sizes:
        icon_dir = os.path.join("icons", "hicolor", "%sx%s" % (size, size), "apps")
        source = os.path.join(SETUP_DIR, icon_dir, "hypervideo-gui.png")
        dest = os.path.join("/usr/share/", icon_dir)
        data_icons_files.append((dest, [source]))

    return data_icons_files


def application_data_files():
    ''' Desktop file '''
    return [
        ('/usr/share/applications',
         [os.path.join(SETUP_DIR, 'hypervideo-gui.desktop')]),
    ]


def data_files():
    ''' Return desktop file and icons '''
    return application_data_files() + icon_data_files()


setup(
    author="Jesús E.",
    author_email="heckyel@hyperbola.info",
    name="hypervideo_gui",
    description="Simple Hypervideo Downloader GUI",
    version=__version__,
    license=__license__,
    url="https://libregit.org/heckyel/hypervideo-gui",
    packages=[
        'hypervideo_gui',
    ],
    scripts=[script_exec],
    data_files=data_files(),
)