From 456e31d55a926cecd86a895c51b5b3b34aea46b0 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 15 Feb 2012 05:57:16 +0200 Subject: [PATCH] Updated the Windows build script to look for an option outside of version control and pull the Transifex username and password from it for the translation_utils.py script. --- scripts/windows-builder.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/scripts/windows-builder.py b/scripts/windows-builder.py index 43beb8988..9210bb8b2 100644 --- a/scripts/windows-builder.py +++ b/scripts/windows-builder.py @@ -107,10 +107,11 @@ Sqlalchemy Migrate import os import sys -from shutil import copy -from shutil import rmtree +from shutil import copy, rmtree from subprocess import Popen, PIPE +from ConfigParser import SafeConfigParser as ConfigParser +# Executable paths python_exe = sys.executable innosetup_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'Inno Setup 5', u'ISCC.exe') @@ -157,6 +158,10 @@ pptviewlib_path = os.path.join(source_path, u'plugins', u'presentations', u'lib', u'pptviewlib') hooks_path = os.path.join(branch_path , u'resources', u'pyinstaller') +# Transifex details -- will be read in from the file. +transifex_filename = os.path.abspath(os.path.join(branch_path, '..', + 'transifex.conf')) + def update_code(): os.chdir(branch_path) print u'Reverting any changes to the code...' @@ -264,8 +269,22 @@ def copy_windows_files(): def update_translations(): print u'Updating translations...' + if not os.path.exists(transifex_filename): + raise Exception(u'Could not find Transifex credentials file: %s' \ + % transifex_filename) + config = ConfigParser() + config.read(transifex_filename) + if not config.has_section('transifex'): + raise Exception(u'No section named "transifex" found.') + if not config.has_option('transifex', 'username'): + raise Exception(u'No option named "username" found.') + if not config.has_option('transifex', 'password'): + raise Exception(u'No option named "password" found.') + username = config.get('transifex', 'username') + password = config.get('transifex', 'password') os.chdir(script_path) - translation_utils = Popen((python_exe, i18n_utils, u'-qdpu')) + translation_utils = Popen([python_exe, i18n_utils, u'-qdpu', '-U', + username, '-P', password]) code = translation_utils.wait() if code != 0: raise Exception(u'Error running translation_utils.py')