summaryrefslogtreecommitdiffstats
path: root/setup.py
blob: 096d2e4e0acb81a48273217ddfd0656abcb4b21f (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

# setup.py file for desktop-effects-kde
# by the Kubuntu Team, inspired by the Restricted Manager setup file
# -*- coding: utf-8 -*-
from distutils.core import setup, Extension
from distutils.command.clean import clean
from distutils.dir_util import remove_tree
import subprocess, glob, os.path, shutil

# for kcm modules building
import kdedistutils

mo_files = []
# HACK: make sure that the mo files are generated and up-to-date
#subprocess.call(["make", "-C", "po", "build-mo"])
for filepath in glob.glob("po/mo/*/LC_MESSAGES/*.mo"):
    lang = filepath[len("po/mo/"):]
    targetpath = os.path.dirname(os.path.join("share/locale",lang))
    mo_files.append((targetpath, [filepath]))

# build .py files from the .ui files.
for file in glob.glob("data/*.ui"):
    subprocess.call(["kdepyuic", file])
    shutil.move(file[5:-3]+".py","./")
# patch desktopeffectsdialog.py for kcm-specific fixes
subprocess.call(["patch", "-p1", "-i" "data/kcm-fix.patch"])

class RMClean(clean):
    ''' cleans up the hacks above, mostly '''
    def run(self):
        clean.run(self)
        if os.path.exists('build/'):
            remove_tree('build/')
        generated_files = ['applications/kde/kcm_restricted-manager.cpp' , 'RestrictedManager/ManagerWindowKDE.py',
                        'RestrictedManager/FwHandlerBcm.py', 'RestrictedManager/FwHandlerProgress.py']
        for file in generated_files:
            if os.path.exists(file):
                os.remove(file)

kdedistutils.setup(
    name="desktop-effects-kde",
    author="Martin Böhm",
    author_email="martin.bohm@kubuntu.org",
    maintainer="Kubuntu Team",
    maintainer_email="kubuntu-devel@lists.ubuntu.com",
    url="http://www.kubuntu.org",
    license="gpl",
    description="enable and configure Compiz effects in KDE",
    packages=["DesktopEffects/"],
    data_files=[("share/desktop-effects", glob.glob("data/*.png")),
                ("share/applications/kde", glob.glob("applications/kde/*.desktop"))
               ],
    scripts=["desktop-effects-kde"],
    kcontrol_modules = [ ('applications/kde/desktop-effects-kde.desktop.in', 'DesktopEffectsKDE')],
    cmdclass = { 'clean' : RMClean }
)