2
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
4
# Copyright (C) 2011 David Planella <david.planella@ubuntu.com>
5
# This program is free software: you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 3, as published
7
# by the Free Software Foundation.
9
# This program is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY; without even the implied warranties of
11
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12
# PURPOSE. See the GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License along
15
# with this program. If not, see <http://www.gnu.org/licenses/>.
18
###################### DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ######################
24
import DistUtilsExtra.auto
26
print >> sys.stderr, 'To build translate-html you need https://launchpad.net/python-distutils-extra'
28
assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18'
30
def update_config(values = {}):
34
fin = file('translate_html/translate_htmlconfig.py', 'r')
35
fout = file(fin.name + '.new', 'w')
38
fields = line.split(' = ') # Separate variable from value
39
if fields[0] in values:
40
oldvalues[fields[0]] = fields[1].strip()
41
line = "%s = %s\n" % (fields[0], values[fields[0]])
47
os.rename(fout.name, fin.name)
48
except (OSError, IOError), e:
49
print ("ERROR: Can't find translate_html/translate_htmlconfig.py")
54
class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
56
values = {'__translate_html_data_directory__': "'%s'" % (self.prefix + '/share/translate-html/'),
57
'__version__': "'%s'" % (self.distribution.get_version())}
58
previous_values = update_config(values)
59
DistUtilsExtra.auto.install_auto.run(self)
60
update_config(previous_values)
64
##################################################################################
65
###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################
66
##################################################################################
68
DistUtilsExtra.auto.setup(
69
name='translate-html',
73
#author_email='email@ubuntu.com',
74
#description='UI for managing …',
75
#long_description='Here a longer description',
76
#url='https://launchpad.net/translate-html',
77
cmdclass={'install': InstallAndUpdateDataDirectory}