From ea2c3b7be1536a981f63d8f23b8af238283dbe82 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 6 Dec 2016 23:02:14 +0200 Subject: [PATCH] Put some more stuff in the config file - makes referencing it later easier --- builders/windows-builder.py | 30 +++++++++++++++--------------- windows/config-appveyor.ini | 4 +++- windows/config.ini.default | 4 +++- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index e94fda3..8a563f2 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -167,10 +167,10 @@ class WindowsBuilder(Builder): missing subdirs """ self._print(' Checking PortableApps directory structure...') - launcher_path = os.path.join(self.portable_path, 'App', 'Appinfo', 'Launcher') + launcher_path = os.path.join(self.portable_dest_path, 'App', 'Appinfo', 'Launcher') if not os.path.exists(launcher_path): os.makedirs(launcher_path) - settings_path = os.path.join(self.portable_path, 'Data', 'Settings') + settings_path = os.path.join(self.portable_dest_path, 'Data', 'Settings') if not os.path.exists(settings_path): os.makedirs(settings_path) @@ -182,7 +182,7 @@ class WindowsBuilder(Builder): config_dir = os.path.dirname(self.config_path) portable_version = self.version.replace('-', '.') + '.0' * (3 - self.version.count('.')) 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: + open(os.path.join(self.portable_dest_path, 'App', 'Appinfo', 'appinfo.ini'), 'w') as output_file: content = input_file.read() content = content.replace('%(display_version)s', self.version) content = content.replace('%(package_version)s', portable_version) @@ -198,17 +198,17 @@ class WindowsBuilder(Builder): self._print('Running PortableApps Builder...') self._print(' Clearing old files') # Remove previous contents of portableapp build directory. - if os.path.exists(self.portable_path): - rmtree(self.portable_path) + if os.path.exists(self.portable_dest_path): + rmtree(self.portable_dest_path) self._print(' Creating PortableApps build directory') # Copy the contents of the OpenLPPortable directory to the portable # build directory. self._create_portableapp_directory() self._create_portableapps_appinfo_file() - dir_util.copy_tree(os.path.join(os.path.dirname(self.config_path), 'OpenLPPortable'), self.portable_path) + dir_util.copy_tree(self.portable_source_path, self.portable_dest_path) # Copy distribution files to portableapp build directory. self._print(' Copying distribution files') - portable_app_path = os.path.join(self.portable_path, 'App', 'OpenLP') + portable_app_path = os.path.join(self.portable_dest_path, 'App', 'OpenLP') dir_util.copy_tree(self.dist_path, portable_app_path) # Copy help files to portableapp build directory. if os.path.isfile(os.path.join(self.helpfile_path, 'OpenLP.chm')): @@ -218,11 +218,13 @@ class WindowsBuilder(Builder): self._print('... WARNING: Windows help file not found') # Build the launcher. self._print(' Building PortableApps Launcher') - self_run_command([self.portablelauncher_exe, self.portable_path], 'Error creating PortableAppa Launcher') + self_run_command([self.portablelauncher_exe, self.portable_dest_path], + 'Error creating PortableAppa Launcher') # Build the portable installer. self._print(' Building PortableApps Installer') - self._run_command([self.portableinstaller_exe, self.portable_path], 'Error running PortableApps Installer') - portable_app = os.path.abspath(os.path.join(self.portable_path, '..', + self._run_command([self.portableinstaller_exe, self.portable_dest_path], + 'Error running PortableApps Installer') + portable_app = os.path.abspath(os.path.join(self.portable_dest_path, '..', 'OpenLPPortable_%s.paf.exe' % self.version.replace('-', '.'))) if os.path.exists(portable_app): move(portable_app, os.path.abspath(os.path.join(self.dist_path, '..'))) @@ -281,14 +283,13 @@ class WindowsBuilder(Builder): """ Set up a variety of paths that we use throughout the build process. """ - self.portable_path = None super().setup_paths() self.dist_path = os.path.join(self.work_path, 'dist', 'OpenLP') self.helpfile_path = os.path.join(self.manual_build_path, 'htmlhelp') self.winres_path = os.path.join(self.branch_path, 'resources', 'windows') self.pptviewlib_path = os.path.join(self.source_path, 'plugins', 'presentations', 'lib', 'pptviewlib') if self.args.portable: - self.portable_path = os.path.abspath(self.args.portable) + self.portable_dest_path = os.path.abspath(self.args.portable) def copy_extra_files(self): """ @@ -298,8 +299,7 @@ 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(os.path.dirname(self.config_path), 'LICENSE.txt'), - os.path.join(self.dist_path, 'LICENSE.txt')) + copy(self.license_path, 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')): @@ -333,7 +333,7 @@ class WindowsBuilder(Builder): self._build_pptviewlib() self._create_innosetup_file() self._run_innosetup() - if self.portable_path and os.path.exists(self.portable_path): + if self.portable_dest_path and os.path.exists(self.portable_dest_path): self._run_portableapp_builder() diff --git a/windows/config-appveyor.ini b/windows/config-appveyor.ini index a6f4baa..e98aba7 100644 --- a/windows/config-appveyor.ini +++ b/windows/config-appveyor.ini @@ -16,7 +16,9 @@ branch = %(projects)s\trunk documentation = %(projects)s\documentation icon = %(here)s\OpenLP.ico hooks = %(here)s\..\pyinstaller-hooks -portable = %(projects)s\OpenLPPortable +license = %(here)s\LICENSE.txt +portable_source = %(here)s\OpenLPPortable +portable_dest = %(projects)s\OpenLPPortable [transifex] username = diff --git a/windows/config.ini.default b/windows/config.ini.default index 925baf9..d335ff4 100644 --- a/windows/config.ini.default +++ b/windows/config.ini.default @@ -16,7 +16,9 @@ branch = %(projects)s\trunk documentation = %(projects)s\documentation icon = %(here)s\OpenLP.ico hooks = %(here)s\..\pyinstaller-hooks -portable = %(projects)s\OpenLPPortable +license = %(here)s\LICENSE.txt +portable_source = %(here)s\OpenLPPortable +portable_dest = %(projects)s\OpenLPPortable [transifex] username =