~epoptes/epoptes/trunk

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
#!/usr/bin/env python
# -*- coding: utf-8 -*-

###########################################################################
# This script needs python-distutils-extra, an extension to the standard
# distutils which provides i18n, icon support, etc.
# https://launchpad.net/python-distutils-extra
#
# Copyright (C) 2011 Alkis Georgopoulos <alkisg@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FINESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# On Debian GNU/Linux systems, the complete text of the GNU General
# Public License can be found in `/usr/share/common-licenses/GPL".
###########################################################################

from glob import glob
from distutils.version import StrictVersion

try:
    import DistUtilsExtra.auto
except ImportError:
    import sys
    print >> sys.stderr, 'To build epoptes you need https://launchpad.net/python-distutils-extra'
    sys.exit(1)

assert StrictVersion(DistUtilsExtra.auto.__version__) >= '2.4', 'needs DistUtilsExtra.auto >= 2.4'

import posixpath, re

def changelog_version(changelog="debian/changelog"):
    version = "dev"
    if posixpath.exists(changelog):
        head=open(changelog).readline()
        match = re.compile(".*\((.*)\).*").match(head)
        if match:
            version = match.group(1)

    return version

def subtract_files(a, b):
    res = set(a)
    for dir, files in b:
        res -= set(files)
    return list(res)

client_special_files=[
    ('/etc/xdg/autostart/',
        ['epoptes-client/epoptes-client.desktop']),
    ('/usr/sbin/',
        ['epoptes-client/epoptes-client']),
    ('/usr/share/ldm/rc.d/',
        ['epoptes-client/X50-client-env']),
    ]
client_usr_share_files=[
    ('/usr/share/epoptes-client/',
        subtract_files(glob('epoptes-client/*'), client_special_files))
    ]
server_special_files=[
    ('/usr/share/ltsp/plugins/ltsp-build-client/common/',
        ['data/040-epoptes-certificate'])];

DistUtilsExtra.auto.setup(
    name='epoptes',
    version = changelog_version(),
    description = 'Computer lab administration and monitoring tool',
    url = 'http://www.epoptes.org',
    license = 'GNU GPL v3',
    author = 'Fotis Tsamis',
    author_email = 'ftsamis@gmail.com',
    py_modules = ['twisted.plugins.epoptesd'],
    data_files = client_special_files + client_usr_share_files +
        server_special_files
)