Updated the Windows build script to use a configuration file to supply the username and password options.

bzr-revno: 1882
This commit is contained in:
Raoul Snyman 2012-02-19 22:54:46 +02:00
commit 7f514ca98c
1 changed files with 22 additions and 3 deletions

View File

@ -107,10 +107,11 @@ Sqlalchemy Migrate
import os import os
import sys import sys
from shutil import copy from shutil import copy, rmtree
from shutil import rmtree
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from ConfigParser import SafeConfigParser as ConfigParser
# Executable paths
python_exe = sys.executable python_exe = sys.executable
innosetup_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'Inno Setup 5', innosetup_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'Inno Setup 5',
u'ISCC.exe') u'ISCC.exe')
@ -157,6 +158,10 @@ pptviewlib_path = os.path.join(source_path, u'plugins', u'presentations',
u'lib', u'pptviewlib') u'lib', u'pptviewlib')
hooks_path = os.path.join(branch_path , u'resources', u'pyinstaller') 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(): def update_code():
os.chdir(branch_path) os.chdir(branch_path)
print u'Reverting any changes to the code...' print u'Reverting any changes to the code...'
@ -264,8 +269,22 @@ def copy_windows_files():
def update_translations(): def update_translations():
print u'Updating 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) 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() code = translation_utils.wait()
if code != 0: if code != 0:
raise Exception(u'Error running translation_utils.py') raise Exception(u'Error running translation_utils.py')