2
# -*- coding: utf-8 -*-
4
# This file is in the public domain
7
###################### DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ######################
10
import DistUtilsExtra.auto
13
print >> sys.stderr, 'To build acire you need https://launchpad.net/python-distutils-extra'
16
assert DistUtilsExtra.auto.__version__ >= '2.10', 'needs DistUtilsExtra.auto >= 2.10'
20
def update_data_path(prefix, oldvalue=None):
23
fin = file('acire/acireconfig.py', 'r')
24
fout = file(fin.name + '.new', 'w')
27
fields = line.split(' = ') # Separate variable from value
28
if fields[0] == '__acire_data_directory__':
29
# update to prefix, store oldvalue
32
line = "%s = '%s'\n" % (fields[0], prefix)
33
else: # restore oldvalue
34
line = "%s = %s" % (fields[0], oldvalue)
40
os.rename(fout.name, fin.name)
41
except (OSError, IOError), e:
42
print ("ERROR: Can't find acire/acireconfig.py")
47
def update_desktop_file(datadir):
50
fin = file('acire.desktop.in', 'r')
51
fout = file(fin.name + '.new', 'w')
55
line = "Icon=%s\n" % (datadir + 'media/icon.png')
60
os.rename(fout.name, fin.name)
61
except (OSError, IOError), e:
62
print ("ERROR: Can't find acire.desktop.in")
66
class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
68
if self.root or self.home:
69
print "WARNING: You don't use a standard --prefix installation, take care that you eventually " \
70
"need to update quickly/quicklyconfig.py file to adjust __quickly_data_directory__. You can " \
71
"ignore this warning if you are packaging and uses --prefix."
72
previous_value = update_data_path(self.prefix + '/share/acire/')
73
update_desktop_file(self.prefix + '/share/acire/')
74
DistUtilsExtra.auto.install_auto.run(self)
75
update_data_path(self.prefix, previous_value)
79
##################################################################################
80
###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################
81
##################################################################################
83
DistUtilsExtra.auto.setup(
88
#author_email='email@ubuntu.com',
89
#description='UI for managing …',
90
#long_description='Here a longer description',
91
#url='https://launchpad.net/acire',
92
cmdclass={'install': InstallAndUpdateDataDirectory}