################################################################################
Cnf = None
-required_database_schema = 68
+required_database_schema = 69
################################################################################
self.db = psycopg2.connect(connect_str)
- except Exception, e:
+ except Exception as e:
print "FATAL: Failed connect to database (%s)" % str(e)
sys.exit(1)
message = "updated database schema from %d to %d" % (database_revision, i+1)
print message
logger.log([message])
- except DBUpdateError, e:
+ except DBUpdateError as e:
# Seems the update did not work.
print "Was unable to update database schema from %d to %d." % (database_revision, i+1)
print "The error message received was %s" % (e)
fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
else:
utils.warn("Lock directory doesn't exist yet - not locking")
- except IOError, e:
+ except IOError as e:
if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN':
utils.fubar("Couldn't obtain lock; assuming another 'dak process-unchecked' is already running.")
# internal helper function
def rename(self, filename):
tempfilename = filename + '.new'
- os.chmod(tempfilename, 0664)
+ os.chmod(tempfilename, 0o664)
os.rename(tempfilename, filename)
def close(self):
flags.update(keywords)
template = "dists/%(suite)s/%(component)s/source/Sources"
BaseFileWriter.__init__(self, template, **flags)
+
+class TranslationFileWriter(BaseFileWriter):
+ def __init__(self, **keywords):
+ '''
+ The value of the keywords suite, component and language are strings.
+ Output files are bzip2 compressed only.
+ '''
+ flags = {
+ 'uncompressed': False,
+ 'gzip': False,
+ 'bzip2': True,
+ 'language': 'en',
+ }
+ flags.update(keywords)
+ template = "dists/%(suite)s/%(component)s/i18n/Translation-%(language)s"
+ super(TranslationFileWriter, self).__init__(template, **flags)