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.

This commit is contained in:
Raoul Snyman 2012-02-15 05:57:16 +02:00
parent fd5a04cc84
commit 456e31d55a

View File

@ -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')