mirror of https://github.com/KLayout/klayout.git
Update the build system for Mac. (#612)
This commit is contained in:
parent
28bf5259d1
commit
61a56d8a8b
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 202 KiB After Width: | Height: | Size: 204 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -444,10 +444,12 @@ def RunMainBuildBash():
|
||||||
global MacPkgDir # relative path to package directory
|
global MacPkgDir # relative path to package directory
|
||||||
global MacBinDir # relative path to binary directory
|
global MacBinDir # relative path to binary directory
|
||||||
global MacBuildDir # relative path to build 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 MacBuildLog # relative path to build log file
|
||||||
global AbsMacPkgDir # absolute path to package directory
|
global AbsMacPkgDir # absolute path to package directory
|
||||||
global AbsMacBinDir # absolute path to binary directory
|
global AbsMacBinDir # absolute path to binary directory
|
||||||
global AbsMacBuildDir # absolute path to build 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
|
global AbsMacBuildLog # absolute path to build log file
|
||||||
|
|
||||||
#-----------------------------------------------------
|
#-----------------------------------------------------
|
||||||
|
|
@ -476,6 +478,8 @@ def RunMainBuildBash():
|
||||||
AbsMacBinDir = "%s/%s.bin.macos-%s-%s-%s" % (ProjectDir, 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)
|
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)
|
AbsMacBuildLog = "%s/%s.build.macos-%s-%s-%s.log" % (ProjectDir, qt, Platform, mode, ruby_python)
|
||||||
|
MacBuildDirQAT = MacBuildDir + ".macQAT"
|
||||||
|
AbsMacBuildDirQAT = AbsMacBuildDir + ".macQAT"
|
||||||
|
|
||||||
# (D) Qt5
|
# (D) Qt5
|
||||||
if ModuleQt == 'Qt5MacPorts':
|
if ModuleQt == 'Qt5MacPorts':
|
||||||
|
|
@ -554,6 +558,45 @@ def RunMainBuildBash():
|
||||||
print( "### <%s>: successfully built KLayout" % myscript, file=sys.stderr )
|
print( "### <%s>: successfully built KLayout" % myscript, file=sys.stderr )
|
||||||
print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr )
|
print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", 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
|
return 0
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
@ -573,10 +616,12 @@ def DeployBinariesForBundle():
|
||||||
global MacPkgDir
|
global MacPkgDir
|
||||||
global MacBinDir
|
global MacBinDir
|
||||||
global MacBuildDir
|
global MacBuildDir
|
||||||
|
global MacBuildDirQAT
|
||||||
global MacBuildLog
|
global MacBuildLog
|
||||||
global AbsMacPkgDir
|
global AbsMacPkgDir
|
||||||
global AbsMacBinDir
|
global AbsMacBinDir
|
||||||
global AbsMacBuildDir
|
global AbsMacBuildDir
|
||||||
|
global AbsMacBuildDirQAT
|
||||||
global AbsMacBuildLog
|
global AbsMacBuildLog
|
||||||
global Version
|
global Version
|
||||||
global DeployVerbose
|
global DeployVerbose
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
#--------------
|
||||||
|
|
@ -37,6 +37,7 @@ from build4mac_util import *
|
||||||
def SetGlobals():
|
def SetGlobals():
|
||||||
global ProjectDir # project directory where "build.sh" exists
|
global ProjectDir # project directory where "build.sh" exists
|
||||||
global Usage # string on usage
|
global Usage # string on usage
|
||||||
|
global LatestOS # the latest generic OS name
|
||||||
global GenOSName # generic OS name
|
global GenOSName # generic OS name
|
||||||
global Platform # platform
|
global Platform # platform
|
||||||
global PkgDir # the package directory where "klayout.app" exists
|
global PkgDir # the package directory where "klayout.app" exists
|
||||||
|
|
@ -57,8 +58,9 @@ def SetGlobals():
|
||||||
global VolumeDMG # the volume name of DMG
|
global VolumeDMG # the volume name of DMG
|
||||||
global TargetDMG # the name of target DMG file
|
global TargetDMG # the name of target DMG file
|
||||||
global RootApplications # reserved directory name for applications
|
global RootApplications # reserved directory name for applications
|
||||||
global CatalinaAnaconda3 # True if 'Catalina with Anaconda3'
|
global LatestOSMacPorts # True if 'LatestOS with MacPorts'
|
||||||
global CatalinaHomebrew # True if 'Catalina with Homebrew'
|
global LatestOSHomebrew # True if 'LatestOS with Homebrew'
|
||||||
|
global LatestOSAnaconda3 # True if 'LatestOS with Anaconda3'
|
||||||
global DicLightWeight # dictionary for LW-* packages
|
global DicLightWeight # dictionary for LW-* packages
|
||||||
global Item3AppleScript # ITEM_3 in the Apple script
|
global Item3AppleScript # ITEM_3 in the Apple script
|
||||||
# auxiliary variables on platform
|
# auxiliary variables on platform
|
||||||
|
|
@ -98,9 +100,11 @@ def SetGlobals():
|
||||||
quit()
|
quit()
|
||||||
|
|
||||||
release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0']
|
release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0']
|
||||||
|
LatestOS = ""
|
||||||
if release == 19:
|
if release == 19:
|
||||||
GenOSName = "macOS"
|
GenOSName = "macOS"
|
||||||
Platform = "Catalina"
|
Platform = "Catalina"
|
||||||
|
LatestOS = Platform
|
||||||
elif release == 18:
|
elif release == 18:
|
||||||
GenOSName = "macOS"
|
GenOSName = "macOS"
|
||||||
Platform = "Mojave"
|
Platform = "Mojave"
|
||||||
|
|
@ -144,22 +148,31 @@ def SetGlobals():
|
||||||
VolumeDMG = "KLayout"
|
VolumeDMG = "KLayout"
|
||||||
TargetDMG = ""
|
TargetDMG = ""
|
||||||
RootApplications = "/Applications"
|
RootApplications = "/Applications"
|
||||||
CatalinaAnaconda3 = False
|
LatestOSMacPorts = False
|
||||||
CatalinaHomebrew = False
|
LatestOSHomebrew = False
|
||||||
|
LatestOSAnaconda3 = False
|
||||||
DicLightWeight = dict()
|
DicLightWeight = dict()
|
||||||
Item3AppleScript = ""
|
Item3AppleScript = ""
|
||||||
# Populate DicLightWeight
|
# Populate DicLightWeight
|
||||||
DicLightWeight[ "ana3" ] = dict()
|
DicLightWeight[ "ports" ] = dict()
|
||||||
DicLightWeight[ "brew" ] = dict()
|
DicLightWeight[ "brew" ] = dict()
|
||||||
DicLightWeight[ "ana3" ]["zip"] = "macbuild/Resources/script-bundle-A.zip"
|
DicLightWeight[ "ana3" ] = dict()
|
||||||
DicLightWeight[ "ana3" ]["src"] = "script-bundle-A"
|
|
||||||
DicLightWeight[ "ana3" ]["des"] = "Anaconda3User-ReadMeFirst"
|
DicLightWeight[ "ports" ]["zip"] = "macbuild/Resources/script-bundle-P.zip"
|
||||||
DicLightWeight[ "ana3" ]["item3"] = 'set position of item "Anaconda3User-ReadMeFirst" to {700, 400}'
|
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" ]["zip"] = "macbuild/Resources/script-bundle-B.zip"
|
||||||
DicLightWeight[ "brew" ]["src"] = "script-bundle-B"
|
DicLightWeight[ "brew" ]["src"] = "script-bundle-B"
|
||||||
DicLightWeight[ "brew" ]["des"] = "HomebrewUser-ReadMeFirst"
|
DicLightWeight[ "brew" ]["des"] = "HomebrewUser-ReadMeFirst"
|
||||||
DicLightWeight[ "brew" ]["item3"] = 'set position of item "HomebrewUser-ReadMeFirst" to {700, 400}'
|
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
|
## To check the contents of the package directory
|
||||||
#
|
#
|
||||||
|
|
@ -184,8 +197,9 @@ def CheckPkgDirectory():
|
||||||
global PackagePrefix
|
global PackagePrefix
|
||||||
global QtIdentification
|
global QtIdentification
|
||||||
global RubyPythonID
|
global RubyPythonID
|
||||||
global CatalinaAnaconda3
|
global LatestOSMacPorts
|
||||||
global CatalinaHomebrew
|
global LatestOSHomebrew
|
||||||
|
global LatestOSAnaconda3
|
||||||
global DicLightWeight
|
global DicLightWeight
|
||||||
global Item3AppleScript
|
global Item3AppleScript
|
||||||
|
|
||||||
|
|
@ -224,20 +238,25 @@ def CheckPkgDirectory():
|
||||||
RubyPythonID = pkgdirComponents[5]
|
RubyPythonID = pkgdirComponents[5]
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# [3] Check if Catalina with Anaconda3 / Homebrew
|
# [3] Check if the "LatestOS" with MacPorts / Homebrew / Anaconda3
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
CatalinaAnaconda3 = Platform == "Catalina"
|
LatestOSMacPorts = Platform == LatestOS
|
||||||
CatalinaAnaconda3 &= PackagePrefix == "LW"
|
LatestOSMacPorts &= PackagePrefix == "LW"
|
||||||
CatalinaAnaconda3 &= QtIdentification == "qt5Ana3"
|
LatestOSMacPorts &= QtIdentification == "qt5MP"
|
||||||
CatalinaAnaconda3 &= RubyPythonID == "Rana3Pana3"
|
LatestOSMacPorts &= RubyPythonID == "Rmp26Pmp37"
|
||||||
|
|
||||||
CatalinaHomebrew = Platform == "Catalina"
|
LatestOSHomebrew = Platform == LatestOS
|
||||||
CatalinaHomebrew &= PackagePrefix == "LW"
|
LatestOSHomebrew &= PackagePrefix == "LW"
|
||||||
CatalinaHomebrew &= QtIdentification == "qt5Brew"
|
LatestOSHomebrew &= QtIdentification == "qt5Brew"
|
||||||
CatalinaHomebrew &= RubyPythonID == "Rhb27Phb37"
|
LatestOSHomebrew &= RubyPythonID == "Rhb27Phb37"
|
||||||
|
|
||||||
if CatalinaAnaconda3:
|
LatestOSAnaconda3 = Platform == LatestOS
|
||||||
mydic = DicLightWeight["ana3"]
|
LatestOSAnaconda3 &= PackagePrefix == "LW"
|
||||||
|
LatestOSAnaconda3 &= QtIdentification == "qt5Ana3"
|
||||||
|
LatestOSAnaconda3 &= RubyPythonID == "Rana3Pana3"
|
||||||
|
|
||||||
|
if LatestOSMacPorts:
|
||||||
|
mydic = DicLightWeight["ports"]
|
||||||
srcDir = PkgDir + "/" + mydic["src"]
|
srcDir = PkgDir + "/" + mydic["src"]
|
||||||
desDir = PkgDir + "/" + mydic["des"]
|
desDir = PkgDir + "/" + mydic["des"]
|
||||||
if OpMake:
|
if OpMake:
|
||||||
|
|
@ -251,7 +270,7 @@ def CheckPkgDirectory():
|
||||||
shutil.rmtree(desDir)
|
shutil.rmtree(desDir)
|
||||||
Item3AppleScript = mydic["item3"]
|
Item3AppleScript = mydic["item3"]
|
||||||
|
|
||||||
if CatalinaHomebrew:
|
if LatestOSHomebrew:
|
||||||
mydic = DicLightWeight["brew"]
|
mydic = DicLightWeight["brew"]
|
||||||
srcDir = PkgDir + "/" + mydic["src"]
|
srcDir = PkgDir + "/" + mydic["src"]
|
||||||
desDir = PkgDir + "/" + mydic["des"]
|
desDir = PkgDir + "/" + mydic["des"]
|
||||||
|
|
@ -266,6 +285,21 @@ def CheckPkgDirectory():
|
||||||
shutil.rmtree(desDir)
|
shutil.rmtree(desDir)
|
||||||
Item3AppleScript = mydic["item3"]
|
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
|
# [4] Check the presence of the default bundle
|
||||||
#------------------------------------------------------
|
#------------------------------------------------------
|
||||||
|
|
@ -437,8 +471,8 @@ def MakeTargetDMGFile(msg=""):
|
||||||
WIN_WIDTH='1000', WIN_HEIGHT='500',
|
WIN_WIDTH='1000', WIN_HEIGHT='500',
|
||||||
FULL_PATH_DS_STORE='/Volumes/%s/.DS_Store' % VolumeDMG,
|
FULL_PATH_DS_STORE='/Volumes/%s/.DS_Store' % VolumeDMG,
|
||||||
BACKGROUND_PNG_FILE=BackgroundPNG,
|
BACKGROUND_PNG_FILE=BackgroundPNG,
|
||||||
ITEM_1='%s' % BundleName, X1='860', Y1='165',
|
ITEM_1='%s' % BundleName, X1='900', Y1='165',
|
||||||
ITEM_2='Applications', X2='860', Y2='345',
|
ITEM_2='Applications', X2='900', Y2='345',
|
||||||
ITEM_3=Item3AppleScript,
|
ITEM_3=Item3AppleScript,
|
||||||
CHECK_BASH='[ -f " & dotDSStore & " ]; echo $?'
|
CHECK_BASH='[ -f " & dotDSStore & " ]; echo $?'
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -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 <srlno>] : make DMG | disabled\n"
|
||||||
|
Usage += " [--cleandmg <srlno>] : clean DMG | disabled\n"
|
||||||
|
Usage += " [--upload <dropbox>] : upload to $HOME/Dropbox/klayout/<dropbox> | 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
|
||||||
|
#---------------
|
||||||
Loading…
Reference in New Issue