Remove refences to script_path and change them to config_dir/config_path

This commit is contained in:
Raoul Snyman 2016-12-06 22:51:27 +02:00
parent 9425cd40f0
commit 6eb26bf183
3 changed files with 15 additions and 11 deletions

View File

@ -97,14 +97,14 @@ class Builder(object):
self._print(output)
self._print(error)
raise Exception(err_msg)
return output
return output, error
def _bzr(self, command, work_path, args=[], err_msg='There was an error running bzr'):
"""
Update the code in the branch.
"""
os.chdir(work_path)
output = self._run_command(['bzr', command] + args, err_msg)
output, _ = self._run_command(['bzr', command] + args, err_msg)
return output
def get_platform(self):
@ -286,8 +286,9 @@ class Builder(object):
if not self.args.release:
cmd.append('-d')
self._print_verbose('... {}'.format(' '.join(cmd)))
output = self._run_command(cmd, 'Error running PyInstaller')
output, error = self._run_command(cmd, 'Error running PyInstaller')
self._print_verbose(output)
self._print_verbose(error)
def write_version_file(self):
"""

View File

@ -235,7 +235,6 @@ class MacOSXBuilder(Builder):
size = size / (1000 * 1000)
size += 10
self._print_verbose('... %s' % self.script_path)
os.chdir(os.path.dirname(self.dmg_settings_path))
self._run_command([self.dmgbuild_exe, '-s', self.dmg_settings_path, '-D', 'size={size}M'.format(size=size),
'-D', 'icon={icon_path}'.format(icon_path=self.icon_path),

View File

@ -143,8 +143,9 @@ class WindowsBuilder(Builder):
Create an InnoSetup file pointing to the branch being built.
"""
self._print('Creating Inno Setup file...')
with open(os.path.join(self.script_path, 'OpenLP.iss.default'), 'r') as input_file, \
open(os.path.join(self.script_path, 'OpenLP.iss'), 'w') as output_file:
config_dir = os.path.dirname(self.config_path)
with open(os.path.join(config_dir, 'OpenLP.iss.default'), 'r') as input_file, \
open(os.path.join(config_dir, 'OpenLP.iss'), 'w') as output_file:
content = input_file.read()
content = content.replace('%(branch)s', self.branch_path)
content = content.replace('%(display_version)s', self.version)
@ -155,8 +156,9 @@ class WindowsBuilder(Builder):
Run InnoSetup to create an installer.
"""
self._print('Running Inno Setup...')
os.chdir(self.script_path)
self._run_command([self.innosetup_exe, os.path.join(self.script_path, 'OpenLP.iss'), '/q'],
config_dir = os.path.dirname(self.config_path)
os.chdir(config_dir)
self._run_command([self.innosetup_exe, os.path.join(config_dir, 'OpenLP.iss'), '/q'],
'Error running InnoSetup')
def _create_portableapp_directory(self):
@ -177,8 +179,9 @@ class WindowsBuilder(Builder):
Create a Portabbleapps appinfo.ini file.
"""
self._print(' Creating PortableApps appinfo file ...')
config_dir = os.path.dirname(self.config_path)
portable_version = self.version.replace('-', '.') + '.0' * (3 - self.version.count('.'))
with open(os.path.join(self.script_path, 'appinfo.ini.default'), 'r') as input_file, \
with open(os.path.join(config_dir, 'appinfo.ini.default'), 'r') as input_file, \
open(os.path.join(self.portable_path, 'App', 'Appinfo', 'appinfo.ini'), 'w') as output_file:
content = input_file.read()
content = content.replace('%(display_version)s', self.version)
@ -202,7 +205,7 @@ class WindowsBuilder(Builder):
# build directory.
self._create_portableapp_directory()
self._create_portableapps_appinfo_file()
dir_util.copy_tree(os.path.join(self.script_path, 'OpenLPPortable'), self.portable_path)
dir_util.copy_tree(os.path.join(os.path.dirname(self.config_path), 'OpenLPPortable'), self.portable_path)
# Copy distribution files to portableapp build directory.
self._print(' Copying distribution files')
portable_app_path = os.path.join(self.portable_path, 'App', 'OpenLP')
@ -295,7 +298,8 @@ class WindowsBuilder(Builder):
self._print_verbose('... OpenLP.ico')
copy(self.icon_path, os.path.join(self.dist_path, 'OpenLP.ico'))
self._print_verbose('... LICENSE.txt')
copy(os.path.join(self.script_path, 'LICENSE.txt'), os.path.join(self.dist_path, 'LICENSE.txt'))
copy(os.path.join(os.path.dirname(self.config_path), 'LICENSE.txt'),
os.path.join(self.dist_path, 'LICENSE.txt'))
self._print_verbose('... psvince.dll')
copy(self.psvince_exe, os.path.join(self.dist_path, 'psvince.dll'))
if os.path.isfile(os.path.join(self.helpfile_path, 'OpenLP.chm')):