File: setup.py

package info (click to toggle)
devede 4.15.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,864 kB
  • sloc: python: 6,197; makefile: 15
file content (129 lines) | stat: -rwxr-xr-x 4,513 bytes parent folder | download
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/bin/env python3

import os
import sys
from glob import glob
from distutils.core import setup

try:
    from distutils import dep_util
except:
    pass


def get_data_files():
    data_files = [
        (os.path.join('share', 'applications'), ['data/devede_ng.py.desktop']),
        (os.path.join('share', 'pixmaps'), ['data/devedeng.svg']),
        (os.path.join('share', 'icons', 'hicolor',
                      'scalable', 'apps'), ['data/devedeng_icon.svg']),
        (os.path.join('share', 'devedeng'), glob("data/interface/*")),
        (os.path.join('share', 'devedeng'), glob('data/pixmaps/*g')),
        (os.path.join('share', 'devedeng'), ['data/devedeng.svg']),
        (os.path.join('share', 'devedeng'), ['data/devedeng_icon.svg']),
        (os.path.join('share', 'devedeng'), ['data/codepages.lst']),
        (os.path.join('share', 'devedeng'), ['data/languages.lst']),
        (os.path.join('share', 'devedeng', 'backgrounds'),
         glob('data/pixmaps/backgrounds/*')),
        (os.path.join('share', 'doc', 'devedeng', 'html'), glob('doc/*')),
        (os.path.join('share', 'man', 'man1'), ['data/devede.1'])
    ]

    for lang_name in [f for f in os.listdir('locale')]:
        mofile = os.path.join('locale', lang_name,
                              'LC_MESSAGES', 'devedeng.mo')
        # translations must be always in /usr/share because Gtk.builder only
        # search there. If someone knows how to fix this...
        # share/locale/fr/LC_MESSAGES/
        target = os.path.join('/usr', 'share', 'locale',
                              lang_name, 'LC_MESSAGES')
        data_files.append((target, [mofile]))

    return data_files


def compile_translations():

    if (os.system("msgfmt -V > /dev/null") != 0):
        print('You need the binary "msgfmt" (from "gettext") to compile the translations. Aborting')
        sys.exit(-1)

    try:
        for pofile in [f for f in os.listdir('po') if f.endswith('.po')]:
            pofile = os.path.join('po', pofile)

            lang = os.path.basename(pofile)[:-3]  # len('.po') == 3
            # e.g. locale/fr/LC_MESSAGES/
            modir = os.path.join('locale', lang, 'LC_MESSAGES')
            # e.g. locale/fr/LC_MESSAGES/devedeng.mo
            mofile = os.path.join(modir, 'devedeng.mo')

            # create an architecture for these locales
            if not os.path.isdir(modir):
                os.makedirs(modir)

            if not os.path.isfile(mofile) or dep_util.newer(pofile, mofile):
                # msgfmt.make(pofile, mofile)
                os.system("msgfmt \"" + pofile + "\" -o \"" + mofile + "\"")
    except:
        pass

try:
    compile_translations()
except:
    print("Failed to generate the translations")

#here = os.path.abspath(os.path.dirname(__file__))

setup(
    name='devedeng',

    version='4.15.0',

    description='A video DVD creator',
    long_description="A program that allows to create video DVDs",

    url='http://www.rastersoft.com',

    author='Raster Software Vigo (Sergio Costas)',
    author_email='raster@rastersoft.com',

    license='GPLv3',

    # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
    classifiers=[
        # How mature is this project? Common values are
        # 1 - Planning
        # 2 - Pre-Alpha
        # 3 - Alpha
        # 4 - Beta
        # 5 - Production/Stable
        'Development Status :: 5 - Production/Stable',
        'Environment :: X11 Applications :: GTK',
        'Intended Audience :: End Users/Desktop',
        'Topic :: Multimedia :: Video :: Conversion',
        'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
        'Operating System :: POSIX :: Linux',
        'Programming Language :: Python :: 3',
        'Topic :: Multimedia :: Video :: Conversion'
    ],

    keywords='dvd video',

    packages=['devedeng'],

    package_dir={"devedeng": "src/devedeng"},

    #package_data={'devede': ['data/*.ui']},

    # Although 'package_data' is the preferred approach, in some case you may
    # need to place data files outside of your packages.
    # see http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files
    # In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
    #data_files=[('share/devedeng/ui', ['ui/test.ui'])],
    data_files=get_data_files(),
    scripts=['src/devede_ng.py', 'src/copy_files_verbose.py'],
)

if (len(sys.argv) == 2) and (sys.argv[1] == "install"):
    os.system("gtk-update-icon-cache")