From 350611b26e031faf7babbf9c977c7a020324b1f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20De=C3=A1k?= Date: Tue, 21 Jul 2020 18:04:21 +1000 Subject: [PATCH] Work on scripts --- Scripts/Detail/Build.py | 95 ++++++++++++++++++++++------------------ Scripts/Detail/Config.py | 17 ++++++- Scripts/build.py | 10 +++-- 3 files changed, 75 insertions(+), 47 deletions(-) diff --git a/Scripts/Detail/Build.py b/Scripts/Detail/Build.py index cc39844..2d90b45 100644 --- a/Scripts/Detail/Build.py +++ b/Scripts/Detail/Build.py @@ -113,54 +113,65 @@ class BuildSystem: utility.printHeading( "Building standalone ZIP package..." ) - # Copy Synergy binaries - fileList = [ - "libEGL.dll", - "libGLESv2.dll", - "Qt5Core.dll", - "Qt5Gui.dll", - "Qt5Network.dll", - "Qt5Svg.dll", - "Qt5Widgets.dll", - "synergy.exe", - "synergyc.exe", - "synergyd.exe", - "synergys.exe", - "syntool.exe" - ] - - sourceBinPath = utility.joinPath( config.synergyBuildPath(), "bin/Release" ) - targetBinPath = utility.joinPath( config.synergyBuildPath(), "bin", self.productPackageName ) - - if not os.path.exists( targetBinPath ): - os.mkdir( targetBinPath ) - - for fileName in fileList: - filePath = utility.joinPath( sourceBinPath, fileName ) - shutil.copy2( filePath, targetBinPath ) - - shutil.copytree( utility.joinPath( sourceBinPath, "Platforms" ), utility.joinPath( targetBinPath, "Platforms" ), dirs_exist_ok = True ) - shutil.copytree( utility.joinPath( sourceBinPath, "Styles" ), utility.joinPath( targetBinPath, "Styles" ), dirs_exist_ok = True ) - - # Copy OpenSSL binaries - sourceOpenSSLPath = utility.joinPath( config.synergyCorePath(), "ext/openssl/windows/x64/bin" ) - targetOpenSSLPath = utility.joinPath( targetBinPath, "OpenSSL" ) + def copySynergyBinaries( sourcePath, productPath ): + + fileList = [ + "libEGL.dll", + "libGLESv2.dll", + "Qt5Core.dll", + "Qt5Gui.dll", + "Qt5Network.dll", + "Qt5Svg.dll", + "Qt5Widgets.dll", + "synergy.exe", + "synergyc.exe", + "synergyd.exe", + "synergys.exe", + "syntool.exe" + ] + + if not os.path.exists( productPath ): + os.mkdir( productPath ) + + for fileName in fileList: + filePath = utility.joinPath( sourcePath, fileName ) + shutil.copy2( filePath, productPath ) + + shutil.copytree( utility.joinPath( sourcePath, "Platforms" ), utility.joinPath( productPath, "Platforms" ), dirs_exist_ok = True ) + shutil.copytree( utility.joinPath( sourcePath, "Styles" ), utility.joinPath( productPath, "Styles" ), dirs_exist_ok = True ) + + def copyOpenSSLBinaries( sourceOpenSSLPath, productPath ): + + productOpenSSLPath = utility.joinPath( productPath, "OpenSSL" ) + + if not os.path.exists( productOpenSSLPath ): + os.mkdir( productOpenSSLPath ) - if not os.path.exists( targetOpenSSLPath ): - os.mkdir( targetOpenSSLPath ) + for filePath in glob.glob( sourceOpenSSLPath + "/*" ): + shutil.copy2( filePath, productOpenSSLPath ) - for filePath in glob.glob( sourceOpenSSLPath + "/*" ): - shutil.copy2( filePath, targetOpenSSLPath ) + for filePath in glob.glob( sourceOpenSSLPath + "/*.dll" ): + shutil.copy2( filePath, productPath ) + + def makeZipArchive( productPath, zipPath ): + + rootPath = utility.joinPath( productPath, ".." ) + basePath = os.path.relpath( productPath, rootPath ) + + shutil.make_archive( zipPath, 'zip', rootPath, basePath ) + + sourcePath = utility.joinPath( config.synergyBuildPath(), "bin/Release" ) + productPath = utility.joinPath( config.synergyBuildPath(), "bin", self.productPackageName ) + + copySynergyBinaries( sourcePath, productPath ) + + sourceOpenSSLPath = utility.joinPath( config.synergyCorePath(), "ext/openssl/windows/x64/bin" ) - for filePath in glob.glob( sourceOpenSSLPath + "/*.dll" ): - shutil.copy2( filePath, targetBinPath ) + copyOpenSSLBinaries( sourceOpenSSLPath, productPath ) - # Make ZIP package zipPath = utility.joinPath( config.binariesPath(), self.productPackageName ) - rootPath = utility.joinPath( targetBinPath, ".." ) - basePath = os.path.relpath( targetBinPath, rootPath ) - shutil.make_archive( zipPath, 'zip', rootPath, basePath ) + makeZipArchive( productPath, zipPath ) # Darwin builds def __darwinMakeApplication( self ): diff --git a/Scripts/Detail/Config.py b/Scripts/Detail/Config.py index 58bd41d..f17da99 100644 --- a/Scripts/Detail/Config.py +++ b/Scripts/Detail/Config.py @@ -5,11 +5,26 @@ import os, platform, configparser import Detail.Utility as utility -class Configuration( configparser.ConfigParser ): +class Configuration: + + upstreamURL = "" + toplevelPath = "" + + synergyCorePath = "" + synergyBuildPath = "" + synergyVersionPath = "" + binariesPath = "" + toolsPath = "" + + libQtPath = "" + vcvarsallPath = "" + cmakeGenerator = "" # Constructor def __init__( self, configPath ): + # parser = configparser.ConfigParser + super().__init__( dict_type = dict, allow_no_value = True ) self.read( configPath ) diff --git a/Scripts/build.py b/Scripts/build.py index 6ced8d6..fff5473 100644 --- a/Scripts/build.py +++ b/Scripts/build.py @@ -2,9 +2,11 @@ # import clean -import Detail.Build# as build +import Detail.Build -b = Detail.Build.BuildSystem() +# b = Detail.Build.BuildSystem() -b.configure() -b.make() +# b.configure() +# b.make() + +# b.clean()