1
0
mirror of https://gitlab.com/openlp/packaging.git synced 2024-12-22 13:02:50 +00:00

Add cli options to specify transifex login on command line.

This commit is contained in:
Martin Zibricky 2012-06-26 00:39:49 +02:00
parent d4d0559a7c
commit caa0e5e90c

View File

@ -225,6 +225,10 @@ class MacosxBuilder(object):
parser.add_argument('--transifex', parser.add_argument('--transifex',
dest='update_translations', action='store_true', default=False, dest='update_translations', action='store_true', default=False,
help='Update the language translation from Transifex.') help='Update the language translation from Transifex.')
parser.add_argument('--transifex-user',
dest='transifex_user', help='Transifex username.')
parser.add_argument('--transifex-pass',
dest='transifex_pass', help='Transifex password.')
parser.add_argument('-v', '--verbose', dest='verbose', parser.add_argument('-v', '--verbose', dest='verbose',
action='store_true', default=False, action='store_true', default=False,
help='Print out additional information.') help='Print out additional information.')
@ -372,8 +376,7 @@ class MacosxBuilder(object):
raise Exception(u'Error running bzr log') raise Exception(u'Error running bzr log')
output_ascii = unicode(output, errors=u'ignore') output_ascii = unicode(output, errors=u'ignore')
latest = output_ascii.split(u':')[0] latest = output_ascii.split(u':')[0]
version_string = latest == revision and tag or \ version_string = u'%s-bzr%s' % (tag, latest)
u'%s-bzr%s' % (tag, latest)
self.version_string = version_string self.version_string = version_string
self.version_tag = tag self.version_tag = tag
version_file = open(os.path.join(self.dist_path, u'.version'), u'w') version_file = open(os.path.join(self.dist_path, u'.version'), u'w')
@ -452,8 +455,14 @@ class MacosxBuilder(object):
raise Exception(u'No option named "username" found.') raise Exception(u'No option named "username" found.')
if not self.config.has_option('transifex', 'password'): if not self.config.has_option('transifex', 'password'):
raise Exception(u'No option named "password" found.') raise Exception(u'No option named "password" found.')
username = self.config.get(u'transifex', u'username') if self.args.transifex_user:
password = self.config.get(u'transifex', u'password') username = self.args.transifex_user
else:
username = self.config.get(u'transifex', u'username')
if self.args.transifex_pass:
password = self.args.transifex_pass
else:
password = self.config.get(u'transifex', u'password')
os.chdir(os.path.split(self.i18n_utils)[0]) os.chdir(os.path.split(self.i18n_utils)[0])
translation_utils = Popen([self.python, self.i18n_utils, u'-qdpu', translation_utils = Popen([self.python, self.i18n_utils, u'-qdpu',
u'-U', username, u'-P', password]) u'-U', username, u'-P', password])