1
# ----------------------------------------------------------------------
2
# Copyright (c) 2012 Canonical Ltd.
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of version 2 of the GNU General Public
6
# License published by the Free Software Foundation.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, contact Canonical, Ltd.
15
# ----------------------------------------------------------------------
18
# $ python ./python-tools-setup.py install --root=... --version=...
20
# Note: --version=... must be the last argument to this script
23
from distutils.command.install import install as _install
24
from distutils.core import setup
29
class Install(_install, object):
30
'''Override distutils to install the files where we want them.'''
32
# Now byte-compile everything
33
super(Install, self).run()
39
# Install scripts, configuration files and data
40
scripts = ['/usr/bin/aa-easyprof']
41
self.mkpath(prefix + os.path.dirname(scripts[0]))
44
self.copy_file(os.path.basename(s), f)
46
configs = ['easyprof/easyprof.conf']
47
self.mkpath(prefix + "/etc/apparmor")
49
self.copy_file(c, os.path.join(prefix + "/etc/apparmor", os.path.basename(c)))
51
data = ['easyprof/templates', 'easyprof/policygroups']
52
self.mkpath(prefix + "/usr/share/apparmor/easyprof")
54
self.copy_tree(d, os.path.join(prefix + "/usr/share/apparmor/easyprof", os.path.basename(d)))
57
if os.path.exists('staging'):
58
shutil.rmtree('staging')
59
shutil.copytree('apparmor', 'staging')
61
# Support the --version=... since this will be part of a Makefile
62
version = "unknown-version"
63
if "--version=" in sys.argv[-1]:
64
version=sys.argv[-1].split('=')[1]
65
sys.argv = sys.argv[0:-1]
67
setup (name='apparmor',
69
description='Python libraries for AppArmor utilities',
70
long_description='Python libraries for AppArmor utilities',
71
author='AppArmor Developers',
72
author_email='apparmor@lists.ubuntu.com',
73
url='https://launchpad.net/apparmor',
75
cmdclass={'install': Install},
76
package_dir={'apparmor': 'staging'},
77
packages=['apparmor', 'apparmor.rule'],
78
py_modules=['apparmor.easyprof']
81
shutil.rmtree('staging')