2
# -*- coding: utf-8 -*-
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 gstreamer-webcam you need https://launchpad.net/python-distutils-extra'
17
assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18'
19
def update_data_path(prefix, oldvalue=None):
22
fin = file('gstreamer_webcam/gstreamer_webcamconfig.py', 'r')
23
fout = file(fin.name + '.new', 'w')
26
fields = line.split(' = ') # Separate variable from value
27
if fields[0] == '__gstreamer_webcam_data_directory__':
28
# update to prefix, store oldvalue
31
line = "%s = '%s'\n" % (fields[0], prefix)
32
else: # restore oldvalue
33
line = "%s = %s" % (fields[0], oldvalue)
39
os.rename(fout.name, fin.name)
40
except (OSError, IOError), e:
41
print ("ERROR: Can't find gstreamer_webcam/gstreamer_webcamconfig.py")
46
def update_desktop_file(datadir):
49
fin = file('gstreamer-webcam.desktop.in', 'r')
50
fout = file(fin.name + '.new', 'w')
54
line = "Icon=%s\n" % (datadir + 'media/icon.png')
59
os.rename(fout.name, fin.name)
60
except (OSError, IOError), e:
61
print ("ERROR: Can't find gstreamer-webcam.desktop.in")
65
class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
67
previous_value = update_data_path(self.prefix + '/share/gstreamer-webcam/')
68
update_desktop_file(self.prefix + '/share/gstreamer-webcam/')
69
DistUtilsExtra.auto.install_auto.run(self)
70
update_data_path(self.prefix, previous_value)
74
##################################################################################
75
###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################
76
##################################################################################
78
DistUtilsExtra.auto.setup(
79
name='gstreamer-webcam',
83
#author_email='email@ubuntu.com',
84
#description='UI for managing …',
85
#long_description='Here a longer description',
86
#url='https://launchpad.net/gstreamer-webcam',
87
cmdclass={'install': InstallAndUpdateDataDirectory}