diff --git a/macbuild/Resources/KLayoutDMG-Back.logoist b/macbuild/Resources/KLayoutDMG-Back.logoist index b459680cf..336c51a9e 100644 Binary files a/macbuild/Resources/KLayoutDMG-Back.logoist and b/macbuild/Resources/KLayoutDMG-Back.logoist differ diff --git a/macbuild/Resources/KLayoutDMG-Back.png b/macbuild/Resources/KLayoutDMG-Back.png index 898fc448d..88e0a1108 100644 Binary files a/macbuild/Resources/KLayoutDMG-Back.png and b/macbuild/Resources/KLayoutDMG-Back.png differ diff --git a/macbuild/Resources/icon-resources/klayout-Ports.icns b/macbuild/Resources/icon-resources/klayout-Ports.icns new file mode 100644 index 000000000..0d5463fe7 Binary files /dev/null and b/macbuild/Resources/icon-resources/klayout-Ports.icns differ diff --git a/macbuild/Resources/icon-resources/klayout-Ports.logoist b/macbuild/Resources/icon-resources/klayout-Ports.logoist new file mode 100644 index 000000000..ca4525ab4 Binary files /dev/null and b/macbuild/Resources/icon-resources/klayout-Ports.logoist differ diff --git a/macbuild/Resources/icon-resources/klayout-Ports.png b/macbuild/Resources/icon-resources/klayout-Ports.png new file mode 100644 index 000000000..c8400ee7f Binary files /dev/null and b/macbuild/Resources/icon-resources/klayout-Ports.png differ diff --git a/macbuild/Resources/script-bundle-A.zip b/macbuild/Resources/script-bundle-A.zip index 6bf4a60df..990050af7 100644 Binary files a/macbuild/Resources/script-bundle-A.zip and b/macbuild/Resources/script-bundle-A.zip differ diff --git a/macbuild/Resources/script-bundle-B.zip b/macbuild/Resources/script-bundle-B.zip index c0c78ca14..253e8ae6b 100644 Binary files a/macbuild/Resources/script-bundle-B.zip and b/macbuild/Resources/script-bundle-B.zip differ diff --git a/macbuild/Resources/script-bundle-P.zip b/macbuild/Resources/script-bundle-P.zip new file mode 100644 index 000000000..d8b11fa06 Binary files /dev/null and b/macbuild/Resources/script-bundle-P.zip differ diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py index cd9dafe32..d5bc8732a 100755 --- a/macbuild/build4mac.py +++ b/macbuild/build4mac.py @@ -441,14 +441,16 @@ def RunMainBuildBash(): global DeploymentF global DeploymentP global PackagePrefix - global MacPkgDir # relative path to package directory - global MacBinDir # relative path to binary directory - global MacBuildDir # relative path to build directory - global MacBuildLog # relative path to build log file - global AbsMacPkgDir # absolute path to package directory - global AbsMacBinDir # absolute path to binary directory - global AbsMacBuildDir # absolute path to build directory - global AbsMacBuildLog # absolute path to build log file + global MacPkgDir # relative path to package directory + global MacBinDir # relative path to binary directory + global MacBuildDir # relative path to build directory + global MacBuildDirQAT # relative path to build directory for QATest + global MacBuildLog # relative path to build log file + global AbsMacPkgDir # absolute path to package directory + global AbsMacBinDir # absolute path to binary directory + global AbsMacBuildDir # absolute path to build directory + global AbsMacBuildDirQAT # absolute path to build directory for QATest + global AbsMacBuildLog # absolute path to build log file #----------------------------------------------------- # [1] Set parameters passed to the main Bash script @@ -468,14 +470,16 @@ def RunMainBuildBash(): ruby_python = "R%sP%s" % ( ruby.lower(), python.lower() ) # (C) Target directories and files - MacPkgDir = "./%s%s.pkg.macos-%s-%s-%s" % (PackagePrefix, qt, Platform, mode, ruby_python) - MacBinDir = "./%s.bin.macos-%s-%s-%s" % ( qt, Platform, mode, ruby_python) - MacBuildDir = "./%s.build.macos-%s-%s-%s" % ( qt, Platform, mode, ruby_python) - MacBuildLog = "./%s.build.macos-%s-%s-%s.log" % ( qt, Platform, mode, ruby_python) - AbsMacPkgDir = "%s/%s%s.pkg.macos-%s-%s-%s" % (ProjectDir, PackagePrefix, qt, Platform, mode, ruby_python) - AbsMacBinDir = "%s/%s.bin.macos-%s-%s-%s" % (ProjectDir, qt, Platform, mode, ruby_python) - AbsMacBuildDir = "%s/%s.build.macos-%s-%s-%s" % (ProjectDir, qt, Platform, mode, ruby_python) - AbsMacBuildLog = "%s/%s.build.macos-%s-%s-%s.log" % (ProjectDir, qt, Platform, mode, ruby_python) + MacPkgDir = "./%s%s.pkg.macos-%s-%s-%s" % (PackagePrefix, qt, Platform, mode, ruby_python) + MacBinDir = "./%s.bin.macos-%s-%s-%s" % ( qt, Platform, mode, ruby_python) + MacBuildDir = "./%s.build.macos-%s-%s-%s" % ( qt, Platform, mode, ruby_python) + MacBuildLog = "./%s.build.macos-%s-%s-%s.log" % ( qt, Platform, mode, ruby_python) + AbsMacPkgDir = "%s/%s%s.pkg.macos-%s-%s-%s" % (ProjectDir, PackagePrefix, qt, Platform, mode, ruby_python) + AbsMacBinDir = "%s/%s.bin.macos-%s-%s-%s" % (ProjectDir, qt, Platform, mode, ruby_python) + AbsMacBuildDir = "%s/%s.build.macos-%s-%s-%s" % (ProjectDir, qt, Platform, mode, ruby_python) + AbsMacBuildLog = "%s/%s.build.macos-%s-%s-%s.log" % (ProjectDir, qt, Platform, mode, ruby_python) + MacBuildDirQAT = MacBuildDir + ".macQAT" + AbsMacBuildDirQAT = AbsMacBuildDir + ".macQAT" # (D) Qt5 if ModuleQt == 'Qt5MacPorts': @@ -554,6 +558,45 @@ def RunMainBuildBash(): print( "### <%s>: successfully built KLayout" % myscript, file=sys.stderr ) print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr ) print( "", file=sys.stderr ) + + #------------------------------------------------------------------------ + # [4] Prepare "*.macQAT/" directory for the QATest. + # Binaries under "*.macQAT/" such as *.dylib will be touched later. + #------------------------------------------------------------------------ + print( "### Preparing <%s>" % MacBuildDirQAT ) + if os.path.isdir( MacBuildDirQAT ): + shutil.rmtree( MacBuildDirQAT ) + + os.chdir( MacBuildDir ) + tarFile = "../macQATest.tar" + tarCmdC = "tar cf %s ." % tarFile + if subprocess.call( tarCmdC, shell=True ) != 0: + print( "", file=sys.stderr ) + print( "-------------------------------------------------------------", file=sys.stderr ) + print( "!!! <%s>: failed to create <%s>" % (myscript, tarFile), file=sys.stderr ) + print( "-------------------------------------------------------------", file=sys.stderr ) + print( "", file=sys.stderr ) + return 1 + + os.chdir( "../" ) + os.mkdir( MacBuildDirQAT ) + os.chdir( MacBuildDirQAT ) + tarCmdX = "tar xf %s" % tarFile + if subprocess.call( tarCmdX, shell=True ) != 0: + print( "", file=sys.stderr ) + print( "-------------------------------------------------------------", file=sys.stderr ) + print( "!!! <%s>: failed to unpack <%s>" % (myscript, tarFile), file=sys.stderr ) + print( "-------------------------------------------------------------", file=sys.stderr ) + print( "", file=sys.stderr ) + return 1 + + os.remove( tarFile ) + os.chdir( "../" ) + shutil.copy2( "macbuild/macQAT.sh", MacBuildDirQAT ) + print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr ) + print( "### <%s>: prepared the initial *.macQAT/" % myscript, file=sys.stderr ) + print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr ) + print( "", file=sys.stderr ) return 0 #------------------------------------------------------------------------------ @@ -573,10 +616,12 @@ def DeployBinariesForBundle(): global MacPkgDir global MacBinDir global MacBuildDir + global MacBuildDirQAT global MacBuildLog global AbsMacPkgDir global AbsMacBinDir global AbsMacBuildDir + global AbsMacBuildDirQAT global AbsMacBuildLog global Version global DeployVerbose diff --git a/macbuild/macQAT.sh b/macbuild/macQAT.sh new file mode 100755 index 000000000..36ac52e3e --- /dev/null +++ b/macbuild/macQAT.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +#=============================================================================== +# File: "macbuild/macQAT.sh" +# +# The top Bash script to run "ut_runner" after building KLayout +# (http://www.klayout.de/index.php) version 0.26.1 or later on different Apple +# ßMac OSX platforms. +# +# This script must be copied to a "*.macQAT/" directory to run. +#=============================================================================== + +#---------------------------------------------------------------- +# Functions +#---------------------------------------------------------------- +function GetPresentDir() { + path=$1 + array=( `echo $path | tr -s '/' ' '`) + last_index=`expr ${#array[@]} - 1` + echo ${array[${last_index}]} + return 0 +} + +function HidePrivateDir() { + if [ -d "../private" ]; then + ret=$(/bin/mv ../private ../private.stash) + fi +} + +function ShowPrivateDir() { + if [ -d "../private.stash" ]; then + ret=$(/bin/mv ../private.stash ../private) + fi +} + +#---------------------------------------------------------------- +# Variables +#---------------------------------------------------------------- +gitSHA1=$(git rev-parse --short HEAD 2>/dev/null) +timestamp=$(date "+%Y_%m%d_%H%M") +presentDir=$(GetPresentDir `pwd`) +logfile=QATest_${gitSHA1}_${timestamp}__${presentDir}.log + +#---------------------------------------------------------------- +# Environment variables for "ut_runner" +#---------------------------------------------------------------- +export TESTSRC=.. +export TESTTMP=QATest_${gitSHA1}_${timestamp}__${presentDir} +export DYLD_LIBRARY_PATH=$(pwd):$(pwd)/db_plugins + +#---------------------------------------------------------------- +# Environment variables for "ut_runner" +#---------------------------------------------------------------- +if [ $# -eq 1 ]; then + if [ "$1" == "-h" ]; then + ./ut_runner -h + exit 0 + fi + if [ "$1" == "-r" ]; then + echo "### Dumping the log to" $logfile "..." + HidePrivateDir + ./ut_runner -x pymod -c 2>&1 | tee $logfile + ShowPrivateDir + exit 0 + else + echo "" + echo " Git SHA1 = ${gitSHA1}" + echo " Time stamp = ${timestamp}" + echo " Log file = ${logfile}" + echo " Usage:" + echo " ./QATest.sh -h: to get the help of 'ut_runner'" + echo " ./QATest.sh -r: to run the tests with '-c' option: continues after an error" + echo "" + exit 0 + fi +else + echo "" + echo " Git SHA1 = ${gitSHA1}" + echo " Time stamp = ${timestamp}" + echo " Log file = ${logfile}" + echo " Usage:" + echo " ./QATest.sh -h: to get the help of 'ut_runner'" + echo " ./QATest.sh -r: to run the tests with '-c' option: continues after an error" + echo "" + exit 0 +fi + +#-------------- +# End of File +#-------------- diff --git a/macbuild/makeDMG4mac.py b/macbuild/makeDMG4mac.py index 2bb2a22c5..c2429c785 100755 --- a/macbuild/makeDMG4mac.py +++ b/macbuild/makeDMG4mac.py @@ -37,6 +37,7 @@ from build4mac_util import * def SetGlobals(): global ProjectDir # project directory where "build.sh" exists global Usage # string on usage + global LatestOS # the latest generic OS name global GenOSName # generic OS name global Platform # platform global PkgDir # the package directory where "klayout.app" exists @@ -57,8 +58,9 @@ def SetGlobals(): global VolumeDMG # the volume name of DMG global TargetDMG # the name of target DMG file global RootApplications # reserved directory name for applications - global CatalinaAnaconda3 # True if 'Catalina with Anaconda3' - global CatalinaHomebrew # True if 'Catalina with Homebrew' + global LatestOSMacPorts # True if 'LatestOS with MacPorts' + global LatestOSHomebrew # True if 'LatestOS with Homebrew' + global LatestOSAnaconda3 # True if 'LatestOS with Anaconda3' global DicLightWeight # dictionary for LW-* packages global Item3AppleScript # ITEM_3 in the Apple script # auxiliary variables on platform @@ -98,9 +100,11 @@ def SetGlobals(): quit() release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0'] + LatestOS = "" if release == 19: GenOSName = "macOS" Platform = "Catalina" + LatestOS = Platform elif release == 18: GenOSName = "macOS" Platform = "Mojave" @@ -144,21 +148,30 @@ def SetGlobals(): VolumeDMG = "KLayout" TargetDMG = "" RootApplications = "/Applications" - CatalinaAnaconda3 = False - CatalinaHomebrew = False + LatestOSMacPorts = False + LatestOSHomebrew = False + LatestOSAnaconda3 = False DicLightWeight = dict() Item3AppleScript = "" # Populate DicLightWeight - DicLightWeight[ "ana3" ] = dict() - DicLightWeight[ "brew" ] = dict() - DicLightWeight[ "ana3" ]["zip"] = "macbuild/Resources/script-bundle-A.zip" - DicLightWeight[ "ana3" ]["src"] = "script-bundle-A" - DicLightWeight[ "ana3" ]["des"] = "Anaconda3User-ReadMeFirst" - DicLightWeight[ "ana3" ]["item3"] = 'set position of item "Anaconda3User-ReadMeFirst" to {700, 400}' - DicLightWeight[ "brew" ]["zip"] = "macbuild/Resources/script-bundle-B.zip" - DicLightWeight[ "brew" ]["src"] = "script-bundle-B" - DicLightWeight[ "brew" ]["des"] = "HomebrewUser-ReadMeFirst" - DicLightWeight[ "brew" ]["item3"] = 'set position of item "HomebrewUser-ReadMeFirst" to {700, 400}' + DicLightWeight[ "ports" ] = dict() + DicLightWeight[ "brew" ] = dict() + DicLightWeight[ "ana3" ] = dict() + + DicLightWeight[ "ports" ]["zip"] = "macbuild/Resources/script-bundle-P.zip" + DicLightWeight[ "ports" ]["src"] = "script-bundle-P" + DicLightWeight[ "ports" ]["des"] = "MacPortsUser-ReadMeFirst" + DicLightWeight[ "ports" ]["item3"] = 'set position of item "MacPortsUser-ReadMeFirst" to {700, 400}' + + DicLightWeight[ "brew" ]["zip"] = "macbuild/Resources/script-bundle-B.zip" + DicLightWeight[ "brew" ]["src"] = "script-bundle-B" + DicLightWeight[ "brew" ]["des"] = "HomebrewUser-ReadMeFirst" + DicLightWeight[ "brew" ]["item3"] = 'set position of item "HomebrewUser-ReadMeFirst" to {700, 400}' + + DicLightWeight[ "ana3" ]["zip"] = "macbuild/Resources/script-bundle-A.zip" + DicLightWeight[ "ana3" ]["src"] = "script-bundle-A" + DicLightWeight[ "ana3" ]["des"] = "Anaconda3User-ReadMeFirst" + DicLightWeight[ "ana3" ]["item3"] = 'set position of item "Anaconda3User-ReadMeFirst" to {700, 400}' #------------------------------------------------------------------------------ ## To check the contents of the package directory @@ -184,8 +197,9 @@ def CheckPkgDirectory(): global PackagePrefix global QtIdentification global RubyPythonID - global CatalinaAnaconda3 - global CatalinaHomebrew + global LatestOSMacPorts + global LatestOSHomebrew + global LatestOSAnaconda3 global DicLightWeight global Item3AppleScript @@ -224,20 +238,25 @@ def CheckPkgDirectory(): RubyPythonID = pkgdirComponents[5] #----------------------------------------------------------------------------- - # [3] Check if Catalina with Anaconda3 / Homebrew + # [3] Check if the "LatestOS" with MacPorts / Homebrew / Anaconda3 #----------------------------------------------------------------------------- - CatalinaAnaconda3 = Platform == "Catalina" - CatalinaAnaconda3 &= PackagePrefix == "LW" - CatalinaAnaconda3 &= QtIdentification == "qt5Ana3" - CatalinaAnaconda3 &= RubyPythonID == "Rana3Pana3" + LatestOSMacPorts = Platform == LatestOS + LatestOSMacPorts &= PackagePrefix == "LW" + LatestOSMacPorts &= QtIdentification == "qt5MP" + LatestOSMacPorts &= RubyPythonID == "Rmp26Pmp37" - CatalinaHomebrew = Platform == "Catalina" - CatalinaHomebrew &= PackagePrefix == "LW" - CatalinaHomebrew &= QtIdentification == "qt5Brew" - CatalinaHomebrew &= RubyPythonID == "Rhb27Phb37" + LatestOSHomebrew = Platform == LatestOS + LatestOSHomebrew &= PackagePrefix == "LW" + LatestOSHomebrew &= QtIdentification == "qt5Brew" + LatestOSHomebrew &= RubyPythonID == "Rhb27Phb37" - if CatalinaAnaconda3: - mydic = DicLightWeight["ana3"] + LatestOSAnaconda3 = Platform == LatestOS + LatestOSAnaconda3 &= PackagePrefix == "LW" + LatestOSAnaconda3 &= QtIdentification == "qt5Ana3" + LatestOSAnaconda3 &= RubyPythonID == "Rana3Pana3" + + if LatestOSMacPorts: + mydic = DicLightWeight["ports"] srcDir = PkgDir + "/" + mydic["src"] desDir = PkgDir + "/" + mydic["des"] if OpMake: @@ -251,7 +270,7 @@ def CheckPkgDirectory(): shutil.rmtree(desDir) Item3AppleScript = mydic["item3"] - if CatalinaHomebrew: + if LatestOSHomebrew: mydic = DicLightWeight["brew"] srcDir = PkgDir + "/" + mydic["src"] desDir = PkgDir + "/" + mydic["des"] @@ -266,6 +285,21 @@ def CheckPkgDirectory(): shutil.rmtree(desDir) Item3AppleScript = mydic["item3"] + if LatestOSAnaconda3: + mydic = DicLightWeight["ana3"] + srcDir = PkgDir + "/" + mydic["src"] + desDir = PkgDir + "/" + mydic["des"] + if OpMake: + with zipfile.ZipFile( mydic["zip"], 'r' ) as zip_ref: + zip_ref.extractall(PkgDir) + os.rename( srcDir, desDir ) + if OpClean: + if os.path.isdir(srcDir): + shutil.rmtree(srcDir) + if os.path.isdir(desDir): + shutil.rmtree(desDir) + Item3AppleScript = mydic["item3"] + #------------------------------------------------------ # [4] Check the presence of the default bundle #------------------------------------------------------ @@ -437,8 +471,8 @@ def MakeTargetDMGFile(msg=""): WIN_WIDTH='1000', WIN_HEIGHT='500', FULL_PATH_DS_STORE='/Volumes/%s/.DS_Store' % VolumeDMG, BACKGROUND_PNG_FILE=BackgroundPNG, - ITEM_1='%s' % BundleName, X1='860', Y1='165', - ITEM_2='Applications', X2='860', Y2='345', + ITEM_1='%s' % BundleName, X1='900', Y1='165', + ITEM_2='Applications', X2='900', Y2='345', ITEM_3=Item3AppleScript, CHECK_BASH='[ -f " & dotDSStore & " ]; echo $?' ) diff --git a/macbuild/nightyCatalina.py b/macbuild/nightyCatalina.py new file mode 100755 index 000000000..38badd7c3 --- /dev/null +++ b/macbuild/nightyCatalina.py @@ -0,0 +1,251 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +from __future__ import print_function # to use print() of Python 3 in Python >= 2.7 +import sys +import os +import shutil +import glob +import platform +import optparse +import subprocess + +Variation = [ 'std', 'ports', 'brew', 'ana3' ] + +Usage = "\n" +Usage += "------------------------------------------------------------------------------------------\n" +Usage += " nightyCatalina.py [EXPERIMENTAL] \n" +Usage += " << To execute the jobs for making KLatyout's DMGs for macOS Catalina >> \n" +Usage += "\n" +Usage += "$ [python] nightyCatalina.py \n" +Usage += " option & argument : comment on option if any | default value\n" +Usage += " -------------------------------------------------------------------+--------------\n" +Usage += " [--build] : build and deploy | disabled\n" +Usage += " [--makedmg ] : make DMG | disabled\n" +Usage += " [--cleandmg ] : clean DMG | disabled\n" +Usage += " [--upload ] : upload to $HOME/Dropbox/klayout/ | disabled\n" +Usage += " [-?|--?] : print this usage and exit | disabled\n" +Usage += "----------------------------------------------------------------------+-------------------\n" + +def ParseCommandLineArguments(): + global Usage + global Build # operation flag + global MakeDMG # operation flag + global CleanDMG # operation flag + global Upload # operation flag + global SrlDMG # DMG serial number + global Dropbox # Dropbox directory + + p = optparse.OptionParser( usage=Usage ) + p.add_option( '--build', + action='store_true', + dest='build', + default=False, + help='build and deploy' ) + + p.add_option( '--makedmg', + dest='makedmg', + help='make DMG' ) + + p.add_option( '--cleandmg', + dest='cleandmg', + help='clean DMG' ) + + p.add_option( '--upload', + dest='upload', + help='upload to Dropbox' ) + + p.add_option( '-?', '--??', + action='store_true', + dest='checkusage', + default=False, + help='check usage (false)' ) + + p.set_defaults( build = False, + makedmg = "", + cleandmg = "", + upload = "", + checkusage = False ) + + opt, args = p.parse_args() + if opt.checkusage: + print(Usage) + quit() + + Build = False + MakeDMG = False + CleanDMG = False + Upload = False + + Build = opt.build + + if not opt.makedmg == "": + MakeDMG = True + CleanDMG = False + SrlDMG = int(opt.makedmg) + + if not opt.cleandmg == "": + MakeDMG = False + CleanDMG = True + SrlDMG = int(opt.cleandmg) + + if not opt.upload == "": + Upload = True + Dropbox = opt.upload + + if not (Build or MakeDMG or CleanDMG or Upload): + print( "! No option selected" ) + print(Usage) + quit() + + +def BuildDeploy(): + PyBuild = "./build4mac.py" + + Build = dict() + Build["std"] = [ '-q', 'Qt5MacPorts', '-r', 'sys', '-p', 'sys' ] + Build["ports"] = [ '-q', 'Qt5MacPorts', '-r', 'MP26', '-p', 'MP37' ] + Build["brew"] = [ '-q', 'Qt5Brew', '-r', 'HB27', '-p', 'HB37' ] + Build["ana3"] = [ '-q', 'Qt5Ana3', '-r', 'Ana3', '-p', 'Ana3' ] + + for key in Variation: + command1 = [ PyBuild ] + Build[key] + if key == "std": + command2 = [ PyBuild ] + Build[key] + ['-y'] + else: + command2 = [ PyBuild ] + Build[key] + ['-Y'] + print(command1) + print(command2) + #continue + + if subprocess.call( command1, shell=False ) != 0: + print( "", file=sys.stderr ) + print( "-----------------------------------------------------------------", file=sys.stderr ) + print( "!!! <%s>: failed to build KLayout" % PyBuild, file=sys.stderr ) + print( "-----------------------------------------------------------------", file=sys.stderr ) + print( "", file=sys.stderr ) + sys.exit(1) + else: + print( "", file=sys.stderr ) + print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr ) + print( "### <%s>: successfully built KLayout" % PyBuild, file=sys.stderr ) + print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr ) + print( "", file=sys.stderr ) + + if subprocess.call( command2, shell=False ) != 0: + print( "", file=sys.stderr ) + print( "-----------------------------------------------------------------", file=sys.stderr ) + print( "!!! <%s>: failed to deploy KLayout" % PyBuild, file=sys.stderr ) + print( "-----------------------------------------------------------------", file=sys.stderr ) + print( "", file=sys.stderr ) + sys.exit(1) + else: + print( "", file=sys.stderr ) + print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr ) + print( "### <%s>: successfully deployed KLayout" % PyBuild, file=sys.stderr ) + print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr ) + print( "", file=sys.stderr ) + + +def DMG_Make( srlDMG ): + PyDMG = "./makeDMG4mac.py" + Stash = "./DMGStash" + + Pack = dict() + Pack["std"] = [ '-p', 'ST-qt5MP.pkg.macos-Catalina-release-RsysPsys', '-s', '%d' % srlDMG, '-m' ] + Pack["ports"] = [ '-p', 'LW-qt5MP.pkg.macos-Catalina-release-Rmp26Pmp37', '-s', '%d' % srlDMG, '-m' ] + Pack["brew"] = [ '-p', 'LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb37', '-s', '%d' % srlDMG, '-m' ] + Pack["ana3"] = [ '-p', 'LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3', '-s', '%d' % srlDMG, '-m' ] + + if os.path.isdir( Stash ): + shutil.rmtree( Stash ) + os.mkdir( Stash ) + + for key in Variation: + command3 = [ PyDMG ] + Pack[key] + print(command3) + #continue + + if subprocess.call( command3, shell=False ) != 0: + print( "", file=sys.stderr ) + print( "-----------------------------------------------------------------", file=sys.stderr ) + print( "!!! <%s>: failed to make KLayout DMG" % PyDMG, file=sys.stderr ) + print( "-----------------------------------------------------------------", file=sys.stderr ) + print( "", file=sys.stderr ) + sys.exit(1) + else: + print( "", file=sys.stderr ) + print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr ) + print( "### <%s>: successfully made KLayout DMG" % PyDMG, file=sys.stderr ) + print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr ) + print( "", file=sys.stderr ) + + dmgs = glob.glob( "*.dmg*" ) + for item in dmgs: + shutil.move( item, Stash ) + + +def DMG_Clean( srlDMG ): + PyDMG = "./makeDMG4mac.py" + Stash = "./DMGStash" + + Pack = dict() + Pack["std"] = [ '-p', 'ST-qt5MP.pkg.macos-Catalina-release-RsysPsys', '-s', '%d' % srlDMG, '-c' ] + Pack["ports"] = [ '-p', 'LW-qt5MP.pkg.macos-Catalina-release-Rmp26Pmp37', '-s', '%d' % srlDMG, '-c' ] + Pack["brew"] = [ '-p', 'LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb37', '-s', '%d' % srlDMG, '-c' ] + Pack["ana3"] = [ '-p', 'LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3', '-s', '%d' % srlDMG, '-c' ] + + if os.path.isdir( Stash ): + shutil.rmtree( Stash ) + + for key in Variation: + command3 = [ PyDMG ] + Pack[key] + print(command3) + #continue + + if subprocess.call( command3, shell=False ) != 0: + print( "", file=sys.stderr ) + print( "-----------------------------------------------------------------", file=sys.stderr ) + print( "!!! <%s>: failed to clean KLayout DMG" % PyDMG, file=sys.stderr ) + print( "-----------------------------------------------------------------", file=sys.stderr ) + print( "", file=sys.stderr ) + sys.exit(1) + else: + print( "", file=sys.stderr ) + print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr ) + print( "### <%s>: successfully cleaned KLayout DMG" % PyDMG, file=sys.stderr ) + print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr ) + print( "", file=sys.stderr ) + + +def UploadToDropbox( targetdir ): + Stash = "./DMGStash" + + distDir = os.environ["HOME"] + "/Dropbox/klayout/" + targetdir + if not os.path.isdir(distDir): + os.makedirs(distDir) + + dmgs = glob.glob( "%s/*.dmg*" % Stash ) + for item in dmgs: + shutil.copy2( item, distDir ) + + +def Main(): + ParseCommandLineArguments() + + if Build: + BuildDeploy() + elif MakeDMG: + DMG_Make( SrlDMG ) + elif CleanDMG: + DMG_Clean( SrlDMG ) + elif Upload: + UploadToDropbox( Dropbox ) + +#=================================================================================== +if __name__ == "__main__": + Main() + +#--------------- +# End of file +#---------------