2
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
4
# This file is in the public domain
7
###################### DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ######################
13
import DistUtilsExtra.auto
15
print >> sys.stderr, 'To build jumper you need https://launchpad.net/python-distutils-extra'
17
assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18'
19
def update_config(values = {}):
23
fin = file('jumper_lib/jumperconfig.py', 'r')
24
fout = file(fin.name + '.new', 'w')
27
fields = line.split(' = ') # Separate variable from value
28
if fields[0] in values:
29
oldvalues[fields[0]] = fields[1].strip()
30
line = "%s = %s\n" % (fields[0], values[fields[0]])
36
os.rename(fout.name, fin.name)
37
except (OSError, IOError), e:
38
print ("ERROR: Can't find jumper_lib/jumperconfig.py")
43
def update_desktop_file(datadir):
46
fin = file('jumper.desktop.in', 'r')
47
fout = file(fin.name + '.new', 'w')
51
line = "Icon=%s\n" % (datadir + 'media/jumper.svg')
56
os.rename(fout.name, fin.name)
57
except (OSError, IOError), e:
58
print ("ERROR: Can't find jumper.desktop.in")
62
class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
64
values = {'__jumper_data_directory__': "'%s'" % (self.prefix + '/share/jumper/'),
65
'__version__': "'%s'" % self.distribution.get_version()}
66
previous_values = update_config(values)
67
update_desktop_file(self.prefix + '/share/jumper/')
68
DistUtilsExtra.auto.install_auto.run(self)
69
update_config(previous_values)
73
##################################################################################
74
###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################
75
##################################################################################
77
DistUtilsExtra.auto.setup(
82
#author_email='email@ubuntu.com',
83
#description='UI for managing …',
84
#long_description='Here a longer description',
85
#url='https://launchpad.net/jumper',
86
cmdclass={'install': InstallAndUpdateDataDirectory}