diff --git a/macbuild/ReadMe.md b/macbuild/ReadMe.md
index 09344755b..c23589f7b 100644
--- a/macbuild/ReadMe.md
+++ b/macbuild/ReadMe.md
@@ -1,27 +1,28 @@
-Relevant KLayout version: 0.26.7
+Relevant KLayout version: 0.26.9
# 1. Introduction
-This directory **`macbuild`** contains different files required for building KLayout (http://www.klayout.de/) version 0.26.1 or later for different 64-bit Mac OSXs including:
+This directory **`macbuild`** contains different files required for building KLayout (http://www.klayout.de/) version 0.26.1 or later for different 64-bit Mac OSXs, including:
* El Capitan (10.11)
* Sierra (10.12)
* High Sierra (10.13)
* Mojave (10.14)
-* Catalina (10.15)
+* Catalina (10.15) : the primary development environment
+* Big Sur (11.0) : under development for the future support
# 2. Qt5 Frameworks
-By default, Qt frameworks are "Qt5" from MacPorts (https://www.macports.org/) which is usually located under:
+By default, the Qt framework is "Qt5" from MacPorts (https://www.macports.org/), which is usually located under:
```
/opt/local/libexec/qt5/
```
-Alternatively, you can use "Qt5" from Homebrew (https://brew.sh/) which is usually located under:
+Alternatively, you can use "Qt5" from Homebrew (https://brew.sh/), which is usually located under:
```
/usr/local/opt/qt/
```
OR
-"Qt5" from Anaconda3 (https://www.anaconda.com/) which is usually located under:
+"Qt5" from Anaconda3 (https://www.anaconda.com/), which is usually located under:
```
$HOME/opt/anaconda3/pkgs/qt-{version}
```
@@ -41,9 +42,9 @@ $ /usr/bin/ruby -v
$ /usr/bin/python --version
Python 2.7.16
```
-Even in the latest OS as of today (December 2019), Python 3.x is not bundled with the OS, and this is the main reason why users want non-OS-standard script language support.
+Even in the latest OS (11.0 Big Sur) as of today (November 2020), Python 3.x is not bundled with the OS, which is why users want non-OS-standard script language support.
-To meet such a requirement, the build script **`build4mac.py`** provides several possible combinations of Qt5, Ruy and Python module.
+To meet such a requirement, the build script **`build4mac.py`** provides several possible combinations of Qt5, Ruy, and Python module.
Some typical use cases are described in Section 6.
# 4. Prerequisites
@@ -66,22 +67,24 @@ $ [python] ./build4mac.py
: Qt5MacPorts: use Qt5 from MacPorts |
: Qt5Brew: use Qt5 from Homebrew |
: Qt5Ana3: use Qt5 from Anaconda3 |
- [-r|--ruby ] : case-insensitive type=['nil', 'Sys', 'MP26', 'HB27', 'Ana3'] | sys
+ [-r|--ruby ] : case-insensitive type=['nil', 'Sys', 'MP27', 'HB27', 'Ana3'] | sys
: nil: don't bind Ruby |
: Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS |
- : MP26: use Ruby 2.6 from MacPorts |
+ : MP27: use Ruby 2.7 from MacPorts |
: HB27: use Ruby 2.7 from Homebrew |
: Ana3: use Ruby 2.5 from Anaconda3 |
- [-p|--python ] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3'] | sys
+ [-p|--python ] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | sys
+ : 'HBAuto'] |
: nil: don't bind Python |
- : Sys: use OS-bundled Python 2.7 [ElCapitan -- Catalina] |
+ : Sys: use OS-bundled Python 2.7 [ElCapitan -- BigSur] |
: MP38: use Python 3.8 from MacPorts |
: HB38: use Python 3.8 from Homebrew |
- : Ana3: use Python 3.8 from Anaconda3 |
+ : Ana3: use Python 3.7 from Anaconda3 |
+ : HBAuto: use the latest Python 3.x auto-detected from Homebrew |
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
[-m|--make ] : option passed to 'make' | '-j4'
[-d|--debug] : enable debug mode build | disabled
- [-c|--checkcom] : check command line and exit without building | disabled
+ [-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
: from the source code and use the tools in the same machine |
@@ -98,7 +101,7 @@ $ [python] ./build4mac.py
```
# 6. Use-cases
-In this section, the actual file- and directory names are those obtained on macOS Catalina.
+In this section, the actual file names and directory names are those obtained on macOS Catalina.
On different OS, those names differ accordingly.
### 6A. Standard build using the OS-bundled Ruby and Python
@@ -108,40 +111,40 @@ $ cd /where/'build.sh'/exists
$ ./build4mac.py
```
2. Confirm successful build (it will take about one hour depending on your machine spec).
-3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-y" to deploy executables and libraries (including Qt's frameworks) under **`klayout.app`** bundle.
+3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-y" to deploy executables and libraries (including Qt's framework) under **`klayout.app`** bundle.
The buddy command-line tools (strm*) will also be deployed in this step.
```
$ ./build4mac.py -y
```
The application bundle **`klayout.app`** is located under:
- **`ST-qt5MP.pkg.macos-Catalina-release-RsysPsys`** directory, where the three parts below are important.
+ **`ST-qt5MP.pkg.macos-Catalina-release-RsysPsys`** directory, where the three name parts below are important.
* "ST-" means that this is a standard package (LW-, HW-, and EX- are other possibilities explained below).
* "qt5MP" means that Qt5 from MacPorts is used.
* "RsysPsys" means that Ruby is OS-bundled; Python is OS-bundled.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
-If you use "-Y" option instead of "-y" in Step-3, Qt5 frameworks is NOT deployed in the application bundle.
+If you use the "-Y" option instead of the "-y" in Step-3, the Qt5 framework is NOT deployed in the application bundle.
Then the directory name will be **`LW-qt5MP.pkg.macos-Catalina-release-RsysPsys`**, where
* "LW-" means that this is a lightweight package.
-#### If you build KLayout from the source code AND use it on the same machine, "-Y" option is highly recommended. ####
+#### If you build KLayout from the source code AND run it on the same machine, the "-Y" option is highly recommended. ####
-### 6B. Fully MacPorts-flavored build with MacPorts Ruby 2.6 and MacPorts Python 3.8
+### 6B. Fully MacPorts-flavored build with MacPorts Ruby 2.7 and MacPorts Python 3.8
```
$ cd /where/'build.sh'/exists
-$ ./build4mac.py -q qt5macports -r mp26 -p mp38
+$ ./build4mac.py -q qt5macports -r mp27 -p mp38
```
2. Confirm successful build (it will take about one hour depending on your machine spec).
3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.
The buddy command-line tools (strm*) will also be deployed in this step.
```
-$ ./build4mac.py -q qt5macports -r mp26 -p mp38 -Y
+$ ./build4mac.py -q qt5macports -r mp27 -p mp38 -Y
```
The application bundle **`klayout.app`** is located under:
- **`LW-qt5MP.pkg.macos-Catalina-release-Rmp26Pmp38`** directory, where
+ **`LW-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38`** directory, where
* "LW-" means that this is a lightweight package.
* "qt5MP" means that Qt5 from MacPorts is used.
-* "Rmp26Pmp38" means that Ruby is 2.6 from MacPorts; Python is 3.8 from MacPorts.
+* "Rmp27Pmp38" means that Ruby is 2.7 from MacPorts; Python is 3.8 from MacPorts.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6C. Fully Homebrew-flavored build with Homebrew Ruby 2.7 and Homebrew Python 3.8
@@ -168,7 +171,7 @@ $ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5brew -r sys -p hb38
```
2. Confirm successful build (it will take about one hour depending on your machine spec).
-3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-y" to deploy executables and libraries (including Qt's frameworks and Python frameworks) under **`klayout.app`** bundle.
+3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-y" to deploy executables and libraries (including Qt's framework and Python framework) under **`klayout.app`** bundle.
The buddy command-line tools (strm*) will also be deployed in this step.
```
$ ./build4mac.py -q qt5brew -r sys -p hb38 -y
@@ -180,8 +183,8 @@ $ ./build4mac.py -q qt5brew -r sys -p hb38 -y
* "RsysPhb38" means that Ruby is OS-bundled; Python is 3.8 from Homebrew.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### Important ###
-So far, deployment of Homebrew Ruby is not supported.
-Therefore, if you intend to use "-y" option, you need to use "-r sys" for building.
+So far, the deployment of Homebrew Ruby is not supported.
+Therefore, if you intend to use the "-y" option for deployment, you need to use the "-r sys" option for building.
### 6E. Fully Anaconda3-flavored build with Anaconda3 Ruby 2.5 and Anaconda3 Python 3.8
```
@@ -225,8 +228,8 @@ $ cd /where/'build.sh'/exists
$ ./makeDMG4mac.py -p ST-qt5MP.pkg.macos-Catalina-release-RsysPsys -m
```
This command will generate the two files below:
-* **`ST-klayout-0.26.5-macOS-Catalina-1-qt5MP-RsysPsys.dmg`** ---(1) the main DMG file
-* **`ST-klayout-0.26.5-macOS-Catalina-1-qt5MP-RsysPsys.dmg.md5`** ---(2) MD5-value text file
+* **`ST-klayout-0.26.9-macOS-Catalina-1-qt5MP-RsysPsys.dmg`** ---(1) the main DMG file
+* **`ST-klayout-0.26.9-macOS-Catalina-1-qt5MP-RsysPsys.dmg.md5`** ---(2) MD5-value text file
# Known issues
Because we assume some specific versions of non-OS-standard Ruby and Python, updating MacPorts, Homebrew, or Anaconda3 may cause build- and link errors.
@@ -234,7 +237,7 @@ In such cases, you need to update the dictionary contents of **`build4mac_env.py
# Final comments
No need to say, KLayout is a great tool!
-With the object-oriented script language (both Ruby and Python) support, our error-prone jobs can be simplified and speed-up.
+With the object-oriented script language (both Ruby and Python) support, our error-prone jobs can be greatly simplified and speed-up.
Building KLayout from its source code is not difficult. Try it with your favorite environment!
[End of File]
diff --git a/macbuild/Resources/KLayoutDMG-Back.logoist b/macbuild/Resources/KLayoutDMG-Back.logoist
index 336c51a9e..c85a5342e 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 88e0a1108..b2433a0fc 100644
Binary files a/macbuild/Resources/KLayoutDMG-Back.png and b/macbuild/Resources/KLayoutDMG-Back.png differ
diff --git a/macbuild/Resources/script-bundle-P.zip b/macbuild/Resources/script-bundle-P.zip
index afdc90968..22987f14b 100644
Binary files a/macbuild/Resources/script-bundle-P.zip and b/macbuild/Resources/script-bundle-P.zip differ
diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py
index 9657b9f94..5e3e884be 100755
--- a/macbuild/build4mac.py
+++ b/macbuild/build4mac.py
@@ -15,6 +15,7 @@ import glob
import platform
import optparse
import subprocess
+import pprint
#-------------------------------------------------------------------------------
## To import global dictionaries of different modules and utility functions
@@ -25,38 +26,11 @@ from build4mac_env import *
from build4mac_util import *
#-------------------------------------------------------------------------------
-## To set global variables including present directory and platform info.
+## To get the default configurations
+#
+# @return a dictionary containing the default configuration for the macOS build
#-------------------------------------------------------------------------------
-def get_default_config():
- """
- Returns a dictionary containing the default configuration for the macOS build.
- """
- # global ProjectDir # project directory where "build.sh" exists
- # global Usage # string on usage
- # global BuildBash # the main build Bash script
- # global Platform # platform
- # global ModuleQt # Qt module to be used
- # global ModuleRuby # Ruby module to be used
- # global ModulePython # Python module to be used
- # global NonOSStdLang # True if non-OS-standard language is chosen
- # global NoQtBindings # True if not creating Qt bindings for Ruby scripts
- # global MakeOptions # options passed to `make`
- # global DebugMode # True if debug mode build
- # global CheckComOnly # True if only for checking the command line parameters to "build.sh"
- # global DeploymentF # True if fully (including Qt's Frameworks) deploy the binaries for bundles
- # global DeploymentP # True if partially deploy the binaries excluding Qt's Frameworks
- # global PackagePrefix # the package prefix: 'ST-', 'LW-', 'HW-', or 'EX-'
- # global DeployVerbose # -verbose=<0-3> level passed to 'macdeployqt' tool
- # global Version # KLayout's version
- # global ModuleSet # (Qt, Ruby, Python)-tuple
- # # auxiliary variables on platform
- # global System # 6-tuple from platform.uname()
- # global Node # - do -
- # global Release # - do -
- # global Version # - do -
- # global Machine # - do -
- # global Processor # - do -
-
+def Get_Default_Config():
Usage = "\n"
Usage += "---------------------------------------------------------------------------------------------------------\n"
Usage += "<< Usage of 'build4mac.py' >>\n"
@@ -69,22 +43,24 @@ def get_default_config():
Usage += " : Qt5MacPorts: use Qt5 from MacPorts | \n"
Usage += " : Qt5Brew: use Qt5 from Homebrew | \n"
Usage += " : Qt5Ana3: use Qt5 from Anaconda3 | \n"
- Usage += " [-r|--ruby ] : case-insensitive type=['nil', 'Sys', 'MP26', 'HB27', 'Ana3'] | sys \n"
+ Usage += " [-r|--ruby ] : case-insensitive type=['nil', 'Sys', 'MP27', 'HB27', 'Ana3'] | sys \n"
Usage += " : nil: don't bind Ruby | \n"
- Usage += " : Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS | \n"
- Usage += " : MP26: use Ruby 2.6 from MacPorts | \n"
+ Usage += " : Sys: use OS-bundled Ruby [2.0 - 2.7] depending on OS | \n"
+ Usage += " : MP27: use Ruby 2.7 from MacPorts | \n"
Usage += " : HB27: use Ruby 2.7 from Homebrew | \n"
Usage += " : Ana3: use Ruby 2.5 from Anaconda3 | \n"
- Usage += " [-p|--python ] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3'] | sys \n"
+ Usage += " [-p|--python ] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | sys \n"
+ Usage += " : 'HBAuto'] | \n"
Usage += " : nil: don't bind Python | \n"
- Usage += " : Sys: use OS-bundled Python 2.7 [ElCapitan -- Catalina] | \n"
+ Usage += " : Sys: use OS-bundled Python 2.7 [ElCapitan -- BigSur] | \n"
Usage += " : MP38: use Python 3.8 from MacPorts | \n"
Usage += " : HB38: use Python 3.8 from Homebrew | \n"
Usage += " : Ana3: use Python 3.7 from Anaconda3 | \n"
+ Usage += " : HBAuto: use the latest Python 3.x auto-detected from Homebrew | \n"
Usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled \n"
Usage += " [-m|--make ] : option passed to 'make' | '-j4' \n"
Usage += " [-d|--debug] : enable debug mode build | disabled \n"
- Usage += " [-c|--checkcom] : check command line and exit without building | disabled \n"
+ Usage += " [-c|--checkcom] : check command-line and exit without building | disabled \n"
Usage += " [-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled \n"
Usage += " [-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled \n"
Usage += " : from the source code and use the tools in the same machine | \n"
@@ -137,7 +113,10 @@ def get_default_config():
# Set the default modules
ModuleQt = "Qt5MacPorts"
- if Platform == "Catalina":
+ if Platform == "BigSur":
+ ModuleRuby = "RubyBigSur"
+ ModulePython = "PythonBigSur"
+ elif Platform == "Catalina":
ModuleRuby = "RubyCatalina"
ModulePython = "PythonCatalina"
elif Platform == "Mojave":
@@ -169,131 +148,140 @@ def get_default_config():
ModuleSet = ( 'qt5MP', 'Sys', 'Sys' )
config = dict()
-
- config['ProjectDir'] = ProjectDir # project directory where "build.sh" exists
- config['Usage'] = Usage # string on usage
- config['BuildBash'] = BuildBash # the main build Bash script
- config['Platform'] = Platform # platform
- config['ModuleQt'] = ModuleQt # Qt module to be used
- config['ModuleRuby'] = ModuleRuby # Ruby module to be used
- config['ModulePython'] = ModulePython # Python module to be used
- config['NonOSStdLang'] = NonOSStdLang # True if non-OS-standard language is chosen
- config['NoQtBindings'] = NoQtBindings # True if not creating Qt bindings for Ruby scripts
- config['MakeOptions'] = MakeOptions # options passed to `make`
- config['DebugMode'] = DebugMode # True if debug mode build
- config['CheckComOnly'] = CheckComOnly # True if only for checking the command line parameters to "build.sh"
- config['DeploymentF'] = DeploymentF # True if fully (including Qt's Frameworks) deploy the binaries for bundles
- config['DeploymentP'] = DeploymentP # True if partially deploy the binaries excluding Qt's Frameworks
- config['PackagePrefix'] = PackagePrefix # the package prefix: 'ST-', 'LW-', 'HW-', or 'EX-'
- config['DeployVerbose'] = DeployVerbose # -verbose=<0-3> level passed to 'macdeployqt' tool
- config['Version'] = Version # KLayout's version
- config['ModuleSet'] = ModuleSet # (Qt, Ruby, Python)-tuple
+ config['ProjectDir'] = ProjectDir # project directory where "build.sh" exists
+ config['Usage'] = Usage # string on usage
+ config['BuildBash'] = BuildBash # the main build Bash script
+ config['Platform'] = Platform # platform
+ config['ModuleQt'] = ModuleQt # Qt module to be used
+ config['ModuleRuby'] = ModuleRuby # Ruby module to be used
+ config['ModulePython'] = ModulePython # Python module to be used
+ config['NonOSStdLang'] = NonOSStdLang # True if non-OS-standard language is chosen
+ config['NoQtBindings'] = NoQtBindings # True if not creating Qt bindings for Ruby scripts
+ config['MakeOptions'] = MakeOptions # options passed to `make`
+ config['DebugMode'] = DebugMode # True if debug mode build
+ config['CheckComOnly'] = CheckComOnly # True if only for checking the command line parameters to "build.sh"
+ config['DeploymentF'] = DeploymentF # True if fully (including Qt's Frameworks) deploy the binaries for bundles
+ config['DeploymentP'] = DeploymentP # True if partially deploy the binaries excluding Qt's Frameworks
+ config['PackagePrefix'] = PackagePrefix # the package prefix: 'ST-', 'LW-', 'HW-', or 'EX-'
+ config['DeployVerbose'] = DeployVerbose # -verbose=<0-3> level passed to 'macdeployqt' tool
+ config['Version'] = Version # KLayout's version
+ config['ModuleSet'] = ModuleSet # (Qt, Ruby, Python)-tuple
# auxiliary variables on platform
- config['System'] = System # 6-tuple from platform.uname()
- config['Node'] = Node # - do -
- config['Release'] = Release # - do -
- config['MacVersion'] = MacVersion # - do -
- config['Machine'] = Machine # - do -
- config['Processor'] = Processor # - do -
+ config['System'] = System # 6-tuple from platform.uname()
+ config['Node'] = Node # - do -
+ config['Release'] = Release # - do -
+ config['MacVersion'] = MacVersion # - do -
+ config['Machine'] = Machine # - do -
+ config['Processor'] = Processor # - do -
return config
#------------------------------------------------------------------------------
-## To get command line parameters
+## To parse the command line parameters
+#
+# @param[in] config dictionary containing the default configuration
+#
+# @return the configuration dictionary updated with the CLI parameters
#------------------------------------------------------------------------------
-def parse_cli_args(config):
- Usage = config['Usage'] #
- Platform = config['Platform'] #
- Release = config['Release'] #
- Machine = config['Machine'] #
- ModuleQt = config['ModuleQt'] #
- ModuleRuby = config['ModuleRuby'] #
- ModulePython = config['ModulePython'] #
- NonOSStdLang = config['NonOSStdLang'] #
- NoQtBindings = config['NoQtBindings'] #
- MakeOptions = config['MakeOptions'] #
- DebugMode = config['DebugMode'] #
- CheckComOnly = config['CheckComOnly'] #
- DeploymentF = config['DeploymentF'] #
- DeploymentP = config['DeploymentP'] #
- PackagePrefix = config['PackagePrefix'] #
- DeployVerbose = config['DeployVerbose'] #
- ModuleSet = config['ModuleSet'] #
+def Parse_CLI_Args(config):
+ #-----------------------------------------------------
+ # [1] Retrieve the configuration
+ #-----------------------------------------------------
+ Usage = config['Usage']
+ Platform = config['Platform']
+ Release = config['Release']
+ Machine = config['Machine']
+ ModuleQt = config['ModuleQt']
+ ModuleRuby = config['ModuleRuby']
+ ModulePython = config['ModulePython']
+ NonOSStdLang = config['NonOSStdLang']
+ NoQtBindings = config['NoQtBindings']
+ MakeOptions = config['MakeOptions']
+ DebugMode = config['DebugMode']
+ CheckComOnly = config['CheckComOnly']
+ DeploymentF = config['DeploymentF']
+ DeploymentP = config['DeploymentP']
+ PackagePrefix = config['PackagePrefix']
+ DeployVerbose = config['DeployVerbose']
+ ModuleSet = config['ModuleSet']
- p = optparse.OptionParser( usage=Usage )
+ #-----------------------------------------------------
+ # [2] Parse the CLI arguments
+ #-----------------------------------------------------
+ p = optparse.OptionParser(usage=Usage)
p.add_option( '-q', '--qt',
- dest='type_qt',
- help="Qt type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3']" )
+ dest='type_qt',
+ help="Qt type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3']" )
p.add_option( '-r', '--ruby',
- dest='type_ruby',
- help="Ruby type=['nil', 'Sys', 'MP26', 'HB27', 'Ana3']" )
+ dest='type_ruby',
+ help="Ruby type=['nil', 'Sys', 'MP27', 'HB27', 'Ana3']" )
p.add_option( '-p', '--python',
- dest='type_python',
- help="Python type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3']" )
+ dest='type_python',
+ help="Python type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', 'HBAuto']" )
p.add_option( '-n', '--noqtbinding',
- action='store_true',
- dest='no_qt_binding',
- default=False,
- help="do not create Qt bindings for Ruby scripts" )
+ action='store_true',
+ dest='no_qt_binding',
+ default=False,
+ help="do not create Qt bindings for Ruby scripts" )
p.add_option( '-m', '--make',
- dest='make_option',
- help="options passed to `make`" )
+ dest='make_option',
+ help="options passed to `make`" )
p.add_option( '-d', '--debug',
- action='store_true',
- dest='debug_build',
- default=False,
- help="enable debug mode build" )
+ action='store_true',
+ dest='debug_build',
+ default=False,
+ help="enable debug mode build" )
p.add_option( '-c', '--checkcom',
- action='store_true',
- dest='check_command',
- default=False,
- help="check command line and exit without building" )
+ action='store_true',
+ dest='check_command',
+ default=False,
+ help="check command line and exit without building" )
p.add_option( '-y', '--deploy',
- action='store_true',
- dest='deploy_full',
- default=False,
- help="fully deploy built binaries" )
+ action='store_true',
+ dest='deploy_full',
+ default=False,
+ help="fully deploy built binaries" )
p.add_option( '-Y', '--DEPLOY',
- action='store_true',
- dest='deploy_partial',
- default=False,
- help="deploy built binaries when non-OS-standard script language is chosen" )
+ action='store_true',
+ dest='deploy_partial',
+ default=False,
+ help="deploy built binaries when non-OS-standard script language is chosen" )
p.add_option( '-v', '--verbose',
- dest='deploy_verbose',
- help="verbose level of `macdeployqt` tool" )
+ dest='deploy_verbose',
+ help="verbose level of `macdeployqt` tool" )
p.add_option( '-?', '--??',
- action='store_true',
- dest='checkusage',
- default=False,
- help='check usage' )
+ action='store_true',
+ dest='checkusage',
+ default=False,
+ help='check usage' )
p.set_defaults( type_qt = "qt5macports",
- type_ruby = "sys",
- type_python = "sys",
- no_qt_binding = False,
- make_option = "-j4",
- debug_build = False,
- check_command = False,
- deploy_full = False,
- deploy_partial = False,
- deploy_verbose = "1",
- checkusage = False )
+ type_ruby = "sys",
+ type_python = "sys",
+ no_qt_binding = False,
+ make_option = "-j4",
+ debug_build = False,
+ check_command = False,
+ deploy_full = False,
+ deploy_partial = False,
+ deploy_verbose = "1",
+ checkusage = False )
opt, args = p.parse_args()
if (opt.checkusage):
print(Usage)
sys.exit(0)
- # Determine the Qt type
+ # (A) Determine the Qt type
candidates = dict()
candidates['QT5MACPORTS'] = 'Qt5MacPorts'
candidates['QT5BREW'] = 'Qt5Brew'
@@ -319,11 +307,11 @@ def parse_cli_args(config):
# By default, OS-standard (-bundled) script languages (Ruby and Python) are used
NonOSStdLang = False
- # Determine the Ruby type
+ # (B) Determine the Ruby type
candidates = dict()
candidates['NIL'] = 'nil'
candidates['SYS'] = 'Sys'
- candidates['MP26'] = 'MP26'
+ candidates['MP27'] = 'MP27'
candidates['HB27'] = 'HB27'
candidates['ANA3'] = 'Ana3'
try:
@@ -337,7 +325,9 @@ def parse_cli_args(config):
ModuleRuby = 'nil'
elif choiceRuby == "Sys":
choiceRuby = "Sys"
- if Platform == "Catalina":
+ if Platform == "BigSur":
+ ModuleRuby = 'RubyBigSur'
+ elif Platform == "Catalina":
ModuleRuby = 'RubyCatalina'
elif Platform == "Mojave":
ModuleRuby = 'RubyMojave'
@@ -347,8 +337,8 @@ def parse_cli_args(config):
ModuleRuby = 'RubySierra'
elif Platform == "ElCapitan":
ModuleRuby = 'RubyElCapitan'
- elif choiceRuby == "MP26":
- ModuleRuby = 'Ruby26MacPorts'
+ elif choiceRuby == "MP27":
+ ModuleRuby = 'Ruby27MacPorts'
NonOSStdLang = True
elif choiceRuby == "HB27":
ModuleRuby = 'Ruby27Brew'
@@ -363,13 +353,14 @@ def parse_cli_args(config):
print(Usage)
sys.exit(1)
- # Determine the Python type
- candidates = dict()
- candidates['NIL'] = 'nil'
- candidates['SYS'] = 'Sys'
- candidates['MP38'] = 'MP38'
- candidates['HB38'] = 'HB38'
- candidates['ANA3'] = 'Ana3'
+ # (C) Determine the Python type
+ candidates = dict()
+ candidates['NIL'] = 'nil'
+ candidates['SYS'] = 'Sys'
+ candidates['MP38'] = 'MP38'
+ candidates['HB38'] = 'HB38'
+ candidates['ANA3'] = 'Ana3'
+ candidates['HBAUTO'] = 'HBAuto'
try:
choicePython = candidates[ opt.type_python.upper() ]
except KeyError:
@@ -380,7 +371,9 @@ def parse_cli_args(config):
if choicePython == "nil":
ModulePython = 'nil'
elif choicePython == "Sys":
- if Platform == "Catalina":
+ if Platform == "BigSur":
+ ModulePython = 'PythonBigSur'
+ elif Platform == "Catalina":
ModulePython = 'PythonCatalina'
elif Platform == "Mojave":
ModulePython = 'PythonMojave'
@@ -399,6 +392,9 @@ def parse_cli_args(config):
elif choicePython == "Ana3":
ModulePython = 'PythonAnaconda3'
NonOSStdLang = True
+ elif choicePython == "HBAuto":
+ ModulePython = 'PythonAutoBrew'
+ NonOSStdLang = True
if ModulePython == '':
print("")
print( "!!! Unknown Python type <%s>. Case-insensitive candidates: %s" % \
@@ -406,7 +402,7 @@ def parse_cli_args(config):
print(Usage)
sys.exit(1)
- # Set of modules chosen
+ # (D) Set of modules chosen
ModuleSet = ( choiceQt5, choiceRuby, choicePython )
NoQtBindings = opt.no_qt_binding
@@ -444,9 +440,9 @@ def parse_cli_args(config):
if (ModuleRuby in RubySys) and (ModulePython in PythonSys):
PackagePrefix = "ST-"
message += "a standard (ST-) package including Qt5 and using OS-bundled Ruby and Python..."
- elif ModulePython == 'Python38Brew':
+ elif ModulePython == 'Python38Brew' or ModulePython == 'PythonAutoBrew':
PackagePrefix = "HW-"
- message += "a heavyweight (HW-) package including Qt5 and Python3.8 from Homebrew..."
+ message += "a heavyweight (HW-) package including Qt5 and Python3.8~ from Homebrew..."
else:
PackagePrefix = "EX-"
message += "a package with exceptional (EX-) combinations of different modules..."
@@ -456,93 +452,90 @@ def parse_cli_args(config):
if CheckComOnly:
sys.exit(0)
- config['Usage'] = Usage #
- config['Platform'] = Platform #
- config['ModuleQt'] = ModuleQt #
- config['ModuleRuby'] = ModuleRuby #
- config['ModulePython'] = ModulePython #
- config['NonOSStdLang'] = NonOSStdLang #
- config['NoQtBindings'] = NoQtBindings #
- config['MakeOptions'] = MakeOptions #
- config['DebugMode'] = DebugMode #
- config['CheckComOnly'] = CheckComOnly #
- config['DeploymentF'] = DeploymentF #
- config['DeploymentP'] = DeploymentP #
- config['PackagePrefix'] = PackagePrefix #
- config['DeployVerbose'] = DeployVerbose #
- config['ModuleSet'] = ModuleSet #
-
+ #-----------------------------------------------------
+ # [3] Update the configuration to return
+ #-----------------------------------------------------
+ config['Usage'] = Usage
+ config['Platform'] = Platform
+ config['ModuleQt'] = ModuleQt
+ config['ModuleRuby'] = ModuleRuby
+ config['ModulePython'] = ModulePython
+ config['NonOSStdLang'] = NonOSStdLang
+ config['NoQtBindings'] = NoQtBindings
+ config['MakeOptions'] = MakeOptions
+ config['DebugMode'] = DebugMode
+ config['CheckComOnly'] = CheckComOnly
+ config['DeploymentF'] = DeploymentF
+ config['DeploymentP'] = DeploymentP
+ config['PackagePrefix'] = PackagePrefix
+ config['DeployVerbose'] = DeployVerbose
+ config['ModuleSet'] = ModuleSet #
return config
#------------------------------------------------------------------------------
## To run the main Bash script "build.sh" with appropriate options
#
-# @return 0 on success; non-zero on failure
+# @param[in] config dictionary containing the build configuration
+
+# @return a dictionary containing the build parameters
#------------------------------------------------------------------------------
-def get_build_parameters(config):
- ProjectDir = config['ProjectDir'] #
- Platform = config['Platform'] #
- BuildBash = config['BuildBash'] #
- ModuleQt = config['ModuleQt'] #
- ModuleRuby = config['ModuleRuby'] #
- ModulePython = config['ModulePython'] #
- ModuleSet = config['ModuleSet'] #
- NoQtBindings = config['NoQtBindings'] #
- MakeOptions = config['MakeOptions'] #
- DebugMode = config['DebugMode'] #
- CheckComOnly = config['CheckComOnly'] #
- DeploymentF = config['DeploymentF'] #
- DeploymentP = config['DeploymentP'] #
- PackagePrefix = config['PackagePrefix'] #
+def Get_Build_Parameters(config):
+ #-----------------------------------------------------
+ # [1] Retrieve the configuration
+ #-----------------------------------------------------
+ ProjectDir = config['ProjectDir']
+ Platform = config['Platform']
+ BuildBash = config['BuildBash']
+ ModuleQt = config['ModuleQt']
+ ModuleRuby = config['ModuleRuby']
+ ModulePython = config['ModulePython']
+ ModuleSet = config['ModuleSet']
+ NoQtBindings = config['NoQtBindings']
+ MakeOptions = config['MakeOptions']
+ DebugMode = config['DebugMode']
+ CheckComOnly = config['CheckComOnly']
+ DeploymentF = config['DeploymentF']
+ DeploymentP = config['DeploymentP']
+ PackagePrefix = config['PackagePrefix']
#-----------------------------------------------------
- # [1] Set parameters passed to the main Bash script
+ # [2] Set parameters passed to the main Bash script
#-----------------------------------------------------
parameters = dict()
-
- parameters['build_cmd'] = BuildBash
+ parameters['build_cmd'] = BuildBash
parameters['check_cmd_only'] = CheckComOnly
# (A) debug or release
parameters['debug_mode'] = DebugMode # True if debug, False if release
if parameters["debug_mode"]:
- mode = "debug"
+ mode = "debug"
else:
- mode = "release"
+ mode = "release"
# (B) Modules
(qt, ruby, python) = ModuleSet # ( 'qt5MP', 'Sys', 'Sys' )
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)
- # AbsMacPkgDir = "%s/%s" % (ProjectDir, MacPkgDir)
- # AbsMacBinDir = "%s/%s" % (ProjectDir, MacBinDir)
- # AbsMacBuildDir = "%s/%s" % (ProjectDir, MacBuildDir)
- # AbsMacBuildLog = "%s/%s" % (ProjectDir, MacBuildLog)
-
- MacBuildDirQAT = MacBuildDir + ".macQAT"
+ 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)
+ MacBuildDirQAT = MacBuildDir + ".macQAT"
parameters['logfile'] = MacBuildLog
# (D) Qt5
if ModuleQt == 'Qt5MacPorts':
- parameters['qmake'] = Qt5MacPorts['qmake']
+ parameters['qmake'] = Qt5MacPorts['qmake']
parameters['deploy_tool'] = Qt5MacPorts['deploy']
elif ModuleQt == 'Qt5Brew':
- parameters['qmake'] = Qt5Brew['qmake']
+ parameters['qmake'] = Qt5Brew['qmake']
parameters['deploy_tool'] = Qt5Brew['deploy']
elif ModuleQt == 'Qt5Ana3':
- parameters['qmake'] = Qt5Ana3['qmake']
+ parameters['qmake'] = Qt5Ana3['qmake']
parameters['deploy_tool'] = Qt5Ana3['deploy']
- parameters['bin'] = MacBinDir
+ parameters['bin'] = MacBinDir
parameters['build'] = MacBuildDir
parameters['rpath'] = "@executable_path/../Frameworks"
@@ -555,7 +548,7 @@ def get_build_parameters(config):
# (G) about Ruby
if ModuleRuby != "nil":
- parameters['ruby'] = RubyDictionary[ModuleRuby]['exe']
+ parameters['ruby'] = RubyDictionary[ModuleRuby]['exe']
parameters['rbinc'] = RubyDictionary[ModuleRuby]['inc']
parameters['rblib'] = RubyDictionary[ModuleRuby]['lib']
if 'inc2' in RubyDictionary[ModuleRuby]:
@@ -564,50 +557,49 @@ def get_build_parameters(config):
# (H) about Python
if ModulePython != "nil":
parameters['python'] = PythonDictionary[ModulePython]['exe']
- parameters['pyinc'] = PythonDictionary[ModulePython]['inc']
- parameters['pylib'] = PythonDictionary[ModulePython]['lib']
+ parameters['pyinc'] = PythonDictionary[ModulePython]['inc']
+ parameters['pylib'] = PythonDictionary[ModulePython]['lib']
- config['MacPkgDir'] = MacPkgDir # relative path to package directory
- config['MacBinDir'] = MacBinDir # relative path to binary directory
- config['MacBuildDir'] = MacBuildDir # relative path to build directory
- config['MacBuildDirQAT'] = MacBuildDirQAT # relative path to build directory for QATest
- config['MacBuildLog'] = MacBuildLog # relative path to build log file
- # config['AbsMacPkgDir'] = AbsMacPkgDir # absolute path to package directory
- # config['AbsMacBinDir'] = AbsMacBinDir # absolute path to binary directory
- # config['AbsMacBuildDir'] = AbsMacBuildDir # absolute path to build directory
- # config['AbsMacBuildDirQAT'] = AbsMacBuildDirQAT # absolute path to build directory for QATest
- # config['AbsMacBuildLog'] = AbsMacBuildLog # absolute path to build log file
+ config['MacPkgDir'] = MacPkgDir # relative path to package directory
+ config['MacBinDir'] = MacBinDir # relative path to binary directory
+ config['MacBuildDir'] = MacBuildDir # relative path to build directory
+ config['MacBuildDirQAT'] = MacBuildDirQAT # relative path to build directory for QATest
+ config['MacBuildLog'] = MacBuildLog # relative path to build log file
- # Extra parameteres needed for deployment
+ # (I) Extra parameteres needed for deployment
parameters['project_dir'] = ProjectDir
-
return parameters
-def run_build_command(parameters):
-
+#------------------------------------------------------------------------------
+## To run the main Bash script "build.sh" with appropriate options
+#
+# @param[in] parameters dictionary containing the build parameters
+#
+# @return 0 on success; non-zero (1), otherwise
+#------------------------------------------------------------------------------
+def Run_Build_Command(parameters):
#-----------------------------------------------------
# [1] Set parameters passed to the main Bash script
#-----------------------------------------------------
-
cmd_args = ""
# (A) debug or release
if parameters["debug_mode"]:
- mode = "debug"
+ mode = "debug"
cmd_args += " -debug"
else:
- mode = "release"
+ mode = "release"
cmd_args += " -release"
# (C) Target directories and files
- MacBuildDirQAT = parameters['build'] + ".macQAT"
+ MacBuildDirQAT = parameters['build'] + ".macQAT"
# (D) Qt5
- cmd_args += " \\\n -qt5"
- cmd_args += " \\\n -qmake %s" % parameters['qmake']
- cmd_args += " \\\n -bin %s" % parameters['bin']
- cmd_args += " \\\n -build %s" % parameters['build']
- cmd_args += " \\\n -rpath %s" % parameters['rpath']
+ cmd_args += " \\\n -qt5"
+ cmd_args += " \\\n -qmake %s" % parameters['qmake']
+ cmd_args += " \\\n -bin %s" % parameters['bin']
+ cmd_args += " \\\n -build %s" % parameters['build']
+ cmd_args += " \\\n -rpath %s" % parameters['rpath']
# (E) want Qt bindings with Ruby scripts?
if parameters['no_qt_bindings']:
@@ -653,7 +645,6 @@ def run_build_command(parameters):
#-----------------------------------------------------
# [3] Invoke the main Bash script; takes time:-)
#-----------------------------------------------------
-
myscript = os.path.basename(__file__)
ret = subprocess.call( command, shell=True )
if ret != 0:
@@ -717,9 +708,15 @@ def run_build_command(parameters):
#
# Reference: "Deploying an Application on Mac OS X" of Qt Assistant.
#
+# @param[in] config the build configuration
+# @param[in] parameters the build parameters
+#
# @return 0 on success; non-zero on failure
#------------------------------------------------------------------------------
-def DeployBinariesForBundle(config, parameters):
+def Deploy_Binaries_For_Bundle(config, parameters):
+ #-----------------------------------------------------
+ # [0] Retrieve the configuration and build parameters
+ #-----------------------------------------------------
NonOSStdLang = config['NonOSStdLang']
DeploymentF = config['DeploymentF']
DeploymentP = config['DeploymentP']
@@ -729,15 +726,16 @@ def DeployBinariesForBundle(config, parameters):
ModuleRuby = config['ModuleRuby']
ModulePython = config['ModulePython']
- ProjectDir = parameters['project_dir']
- MacBinDir = parameters['bin']
- MacBuildDir = parameters['build']
- MacBuildLog = parameters['logfile']
+ ProjectDir = parameters['project_dir']
+ MacBinDir = parameters['bin']
+ MacBuildDir = parameters['build']
+ MacBuildLog = parameters['logfile']
+
+ AbsMacPkgDir = "%s/%s" % (ProjectDir, MacPkgDir)
+ AbsMacBinDir = "%s/%s" % (ProjectDir, MacBinDir)
+ AbsMacBuildDir = "%s/%s" % (ProjectDir, MacBuildDir)
+ AbsMacBuildLog = "%s/%s" % (ProjectDir, MacBuildLog)
- AbsMacPkgDir = "%s/%s" % (ProjectDir, MacPkgDir)
- AbsMacBinDir = "%s/%s" % (ProjectDir, MacBinDir)
- AbsMacBuildDir = "%s/%s" % (ProjectDir, MacBuildDir)
- AbsMacBuildLog = "%s/%s" % (ProjectDir, MacBuildLog)
print("")
print( "##### Started deploying libraries and executables for #####" )
@@ -1033,17 +1031,24 @@ def DeployBinariesForBundle(config, parameters):
return 1
#-----------------------------------------------------------------------------------------------
- # [9] Special deployment of Python3.8 from Homebrew
+ # [9] Special deployment of Python3.8 or newer from Homebrew
# To use Python3.8 from Homebrew on Catalina...
- # in "/usr/local/opt/python/lib/"
+ # in "/usr/local/opt/python@3.8/lib/"
# Python.framework -> ../Frameworks/Python.framework/ <=== this symbolic was needed
# pkgconfig/
#-----------------------------------------------------------------------------------------------
- deploymentPython38HB = (ModulePython == 'Python38Brew')
- if deploymentPython38HB and NonOSStdLang:
+ deploymentPython38HB = (ModulePython == 'Python38Brew')
+ deploymentPythonAutoHB = (ModulePython == 'PythonAutoBrew')
+ if (deploymentPython38HB or deploymentPythonAutoHB) and NonOSStdLang:
from build4mac_util import WalkFrameworkPaths, PerformChanges
- pythonHBVer = "3.8" # 'pinned' to this version as of KLayout version 0.26.7 (2020-09-13)
+ if deploymentPython38HB:
+ HBPythonFrameworkPath = HBPython38FrameworkPath
+ pythonHBVer = "3.8" # 'pinned' to this version as of KLayout version 0.26.7 (2020-09-13)
+ elif deploymentPythonAutoHB:
+ HBPythonFrameworkPath = HBPythonAutoFrameworkPath
+ pythonHBVer = HBPythonAutoVersion
+
bundlePath = AbsMacPkgDir + '/klayout.app'
bundleExecPathAbs = '%s/Contents/MacOS/' % bundlePath
pythonFrameworkPath = '%s/Contents/Frameworks/Python.framework' % bundlePath
@@ -1052,14 +1057,14 @@ def DeployBinariesForBundle(config, parameters):
resourceTarget2 = '%s/Resources' % pythonFrameworkPath
binTarget = '%s/Versions/%s/bin' % (pythonFrameworkPath, pythonHBVer)
sitepackagesTarget = '%s/Versions/%s/lib/python%s/site-packages' % (pythonFrameworkPath, pythonHBVer, pythonHBVer)
- sitepackagesSource = '%s/Versions/%s/lib/python%s/site-packages' % (HBPython38FrameworkPath, pythonHBVer, pythonHBVer)
+ sitepackagesSource = '%s/Versions/%s/lib/python%s/site-packages' % (HBPythonFrameworkPath, pythonHBVer, pythonHBVer)
print( "" )
- print( " [9] Optional deployment of Python from %s ..." % HBPython38FrameworkPath )
+ print( " [9] Optional deployment of Python from %s ..." % HBPythonFrameworkPath )
print( " [9.1] Copying Python Framework" )
cmd01 = "rm -rf %s" % pythonFrameworkPath
- cmd02 = "rsync -a --safe-links %s/ %s" % (HBPython38FrameworkPath, pythonFrameworkPath)
+ cmd02 = "rsync -a --safe-links %s/ %s" % (HBPythonFrameworkPath, pythonFrameworkPath)
cmd03 = "rm -rf %s" % testTarget
cmd04 = "rm -rf %s" % resourceTarget1
@@ -1094,7 +1099,7 @@ def DeployBinariesForBundle(config, parameters):
print(" [9.2.1] Patching Python Framework" )
depdict = WalkFrameworkPaths( pythonFrameworkPath )
appPythonFrameworkPath = '@executable_path/../Frameworks/Python.framework/'
- PerformChanges(depdict, [(HBPython38FrameworkPath, appPythonFrameworkPath, False)], bundleExecPathAbs)
+ PerformChanges(depdict, [(HBPythonFrameworkPath, appPythonFrameworkPath, False)], bundleExecPathAbs)
print(" [9.2.2] Patching /usr/local/opt/ libs")
usrLocalPath = '/usr/local/opt/'
@@ -1120,11 +1125,11 @@ def DeployBinariesForBundle(config, parameters):
print(" [9.3] Relinking dylib dependencies for klayout")
klayoutPath = bundleExecPathAbs
depdict = WalkFrameworkPaths(klayoutPath, filter_regex=r'klayout$')
- PerformChanges(depdict, [(HBPython38FrameworkPath, appPythonFrameworkPath, False)], bundleExecPathAbs)
+ PerformChanges(depdict, [(HBPythonFrameworkPath, appPythonFrameworkPath, False)], bundleExecPathAbs)
libKlayoutPath = bundleExecPathAbs + '../Frameworks'
depdict = WalkFrameworkPaths(libKlayoutPath, filter_regex=r'libklayout')
- PerformChanges(depdict, [(HBPython38FrameworkPath, appPythonFrameworkPath, False)], bundleExecPathAbs)
+ PerformChanges(depdict, [(HBPythonFrameworkPath, appPythonFrameworkPath, False)], bundleExecPathAbs)
print(" [9.4] Patching site.py, pip/, and distutils/")
site_module = "%s/Versions/%s/lib/python%s/site.py" % (pythonFrameworkPath, pythonHBVer, pythonHBVer)
@@ -1184,8 +1189,8 @@ def DeployBinariesForBundle(config, parameters):
#-------------------------------------------------------------
# [10] Special deployment of Ruby2.7 from Homebrew?
#-------------------------------------------------------------
- deploymentRuby26HB = (ModuleRuby == 'Ruby27Brew')
- if deploymentRuby26HB and NonOSStdLang:
+ deploymentRuby27HB = (ModuleRuby == 'Ruby27Brew')
+ if deploymentRuby27HB and NonOSStdLang:
print( "" )
print( " [10] You have reached optional deployment of Ruby from %s ..." % HBRuby27Path )
@@ -1209,19 +1214,19 @@ def DeployBinariesForBundle(config, parameters):
#------------------------------------------------------------------------------
## The main function
#------------------------------------------------------------------------------
-def main():
- import pprint
- pp = pprint.PrettyPrinter(indent=4)
- config = get_default_config()
- parse_cli_args(config)
+def Main():
+ pp = pprint.PrettyPrinter( indent=4, width=140 )
+ config = Get_Default_Config()
+ Parse_CLI_Args(config)
+
#----------------------------------------------------------
# [The main build stage]
#----------------------------------------------------------
- parameters = get_build_parameters(config)
+ parameters = Get_Build_Parameters(config)
pp.pprint(parameters)
if not config['DeploymentF'] and not config['DeploymentP']:
- ret = run_build_command(parameters)
+ ret = Run_Build_Command(parameters)
pp.pprint(config)
if not ret == 0:
sys.exit(1)
@@ -1231,13 +1236,13 @@ def main():
# Deployment of dynamic link libraries, executables and
# resources to make the main "klayout.app" bundle
#----------------------------------------------------------
- ret = DeployBinariesForBundle(config, parameters)
+ ret = Deploy_Binaries_For_Bundle(config, parameters)
if not ret == 0:
sys.exit(1)
#===================================================================================
if __name__ == "__main__":
- main()
+ Main()
#---------------
# End of file
diff --git a/macbuild/build4mac_env.py b/macbuild/build4mac_env.py
index 89b9f7690..ea3a84f22 100755
--- a/macbuild/build4mac_env.py
+++ b/macbuild/build4mac_env.py
@@ -11,7 +11,7 @@
# This file is imported by 'build4mac.py' script.
#===============================================================================
import os
-MyHome = os.environ['HOME']
+import glob
#-----------------------------------------------------
# [0] Xcode's tools
@@ -54,8 +54,8 @@ Qt5Ana3 = { 'qmake' : '/Applications/anaconda3/bin/qmake',
# [2] Ruby
#-----------------------------------------------------
RubyNil = [ 'nil' ]
-RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave', 'RubyCatalina' ]
-RubyExt = [ 'Ruby26MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]
+RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave', 'RubyCatalina', 'RubyBigSur' ]
+RubyExt = [ 'Ruby27MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]
Rubies = RubyNil + RubySys + RubyExt
#-----------------------------------------------------
@@ -103,20 +103,43 @@ RubyMojave = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2
# Bundled with Catalina (10.15)
# !!! Catalina does not allow to hack the "/System" directory; it's READ ONLY even for the super user!
# Hence, we need to refer to the Ruby header file in "Xcode.app" directly.
+#
+# With the major release of "macOS Big Sur (11.0)" in November 2020, Xcode has been updated, too.
+# (base) MacBookPro2{kazzz-s}(1)$ pwd
+# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
+#
+# (base) MacBookPro2{kazzz-s}(2)$ ll
+# total 4
+# drwxr-xr-x 6 root wheel 192 11 15 20:57 .
+# drwxr-xr-x 3 root wheel 96 10 20 05:33 ..
+# drwxr-xr-x 23 root wheel 736 10 24 11:57 ruby
+# -rw-r--r-- 1 root wheel 868 10 19 19:32 ruby.h
+# lrwxr-xr-x 1 root wheel 19 11 15 20:57 universal-darwin19 -> universal-darwin20/ <=== manually created this symbolic link
+# drwxr-xr-x 6 root wheel 192 10 20 05:33 universal-darwin20
# [Key Type Name] = 'Sys'
-CatalinaSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk"
-RubyCatalina = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
- 'inc': '%s/System/Library/Frameworks/Ruby.framework/Headers' % CatalinaSDK,
+CatalinaSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
+RubyCatalina = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
+ 'inc': '%s/System/Library/Frameworks/Ruby.framework/Headers' % CatalinaSDK,
'inc2': '%s/System/Library/Frameworks/Ruby.framework/Headers/ruby' % CatalinaSDK,
- 'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.dylib'
+ 'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.dylib'
}
-# Ruby 2.6 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
-# install with 'sudo port install ruby26'
-# [Key Type Name] = 'MP26'
-Ruby26MacPorts = { 'exe': '/opt/local/bin/ruby2.6',
- 'inc': '/opt/local/include/ruby-2.6.0',
- 'lib': '/opt/local/lib/libruby.2.6.dylib'
+# Bundled with Big Sur (11.0)
+# Refer to the "Catalina" section above
+# [Key Type Name] = 'Sys'
+BigSurSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
+RubyBigSur = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
+ 'inc': '%s/System/Library/Frameworks/Ruby.framework/Headers' % BigSurSDK,
+ 'inc2': '%s/System/Library/Frameworks/Ruby.framework/Headers/ruby' % BigSurSDK,
+ 'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.dylib'
+ }
+
+# Ruby 2.7 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
+# install with 'sudo port install ruby27'
+# [Key Type Name] = 'MP27'
+Ruby27MacPorts = { 'exe': '/opt/local/bin/ruby2.7',
+ 'inc': '/opt/local/include/ruby-2.7.0',
+ 'lib': '/opt/local/lib/libruby.2.7.dylib'
}
# Ruby 2.7 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
@@ -145,7 +168,8 @@ RubyDictionary = { 'nil' : None,
'RubyHighSierra': RubyHighSierra,
'RubyMojave' : RubyMojave,
'RubyCatalina' : RubyCatalina,
- 'Ruby26MacPorts': Ruby26MacPorts,
+ 'RubyBigSur' : RubyBigSur,
+ 'Ruby27MacPorts': Ruby27MacPorts,
'Ruby27Brew' : Ruby27Brew,
'RubyAnaconda3' : RubyAnaconda3
}
@@ -154,8 +178,8 @@ RubyDictionary = { 'nil' : None,
# [3] Python
#-----------------------------------------------------
PythonNil = [ 'nil' ]
-PythonSys = [ 'PythonElCapitan', 'PythonSierra', 'PythonHighSierra', 'PythonMojave', 'PythonCatalina' ]
-PythonExt = [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3' ]
+PythonSys = [ 'PythonElCapitan', 'PythonSierra', 'PythonHighSierra', 'PythonMojave', 'PythonCatalina', 'PythonBigSur' ]
+PythonExt = [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3', 'PythonAutoBrew' ]
Pythons = PythonNil + PythonSys + PythonExt
#-----------------------------------------------------
@@ -198,13 +222,20 @@ PythonMojave = { 'exe': '/System/Library/Frameworks/Python.framework/Versions
'lib': '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib'
}
-# Bundled with Mojave (10.15)
+# Bundled with Catalina (10.15)
# [Key Type Name] = 'Sys'
PythonCatalina = { 'exe': '/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python',
'inc': '/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7',
'lib': '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib'
}
+# Bundled with Big Sur (11.0)
+# [Key Type Name] = 'Sys'
+PythonBigSur = { 'exe': '/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python',
+ 'inc': '/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7',
+ 'lib': '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib'
+ }
+
# Python 3.8 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
# install with 'sudo port install python38'
# [Key Type Name] = 'MP38'
@@ -216,27 +247,12 @@ Python38MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versi
# Python 3.8 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install python'
# [Key Type Name] = 'HB38'
-HBPython38FrameworkPath = '/usr/local/opt/python3/Frameworks/Python.framework'
+HBPython38FrameworkPath = '/usr/local/opt/python@3.8/Frameworks/Python.framework'
Python38Brew = { 'exe': '%s/Versions/3.8/bin/python3.8' % HBPython38FrameworkPath,
'inc': '%s/Versions/3.8/include/python3.8' % HBPython38FrameworkPath,
'lib': '%s/Versions/3.8/lib/libpython3.8.dylib' % HBPython38FrameworkPath
}
-# # Latest Python from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
-# # install with 'brew install python'
-# # [Key Type Name] = 'HBAuto'
-
-# import glob
-# # In my system, there are four candidates: (python, python3, python@3, python@3.8)
-# # Hard to tell which is going to be available to the user. Picking the last one
-# HBAutoFrameworkPath = glob.glob("/usr/local/opt/python*/Frameworks/Python.framework/")[-1]
-# # expand 3* into _py_version, there should be only one, but I am taking no chances.
-# HBAutoFrameworkVersionPath, _py_version = os.path.split(glob.glob("%s/Versions/3*" % HBAutoFrameworkPath)[0])
-# PythonAutoBrew = { 'exe': '%s/bin/python%s' % (HBAutoFrameworkVersionPath, _py_version),
-# 'inc': '%s/include/python%s' % (HBAutoFrameworkVersionPath, _py_version),
-# 'lib': glob.glob("%s/lib/*.dylib" % HBAutoFrameworkVersionPath)[0]
-# }
-
# Python 3.8 bundled with anaconda3 installed under /Applications/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
@@ -246,17 +262,42 @@ PythonAnaconda3 = { 'exe': '/Applications/anaconda3/bin/python3.8',
'lib': '/Applications/anaconda3/lib/libpython3.8.dylib'
}
+# Latest Python from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
+# install with 'brew install python'
+# There can be multiple candidates such as: (python, python3, python@3, python@3.8, python@3.9)
+# Hard to tell which is going to be available to the user. Picking the last one.
+# [Key Type Name] = 'HBAuto'
+HBPythonAutoFrameworkPath = ""
+HBPythonAutoVersion = ""
+try:
+ HBPythonAutoFrameworkPath = glob.glob( "/usr/local/opt/python*/Frameworks/Python.framework" )[-1]
+ # expand 3* into HBPythonAutoVersion, there should be only one, but I am taking no chances.
+ HBAutoFrameworkVersionPath, HBPythonAutoVersion = os.path.split( glob.glob( "%s/Versions/3*" % HBPythonAutoFrameworkPath )[0] )
+ PythonAutoBrew = { 'exe': '%s/%s/bin/python%s' % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion, HBPythonAutoVersion ),
+ 'inc': '%s/%s/include/python%s' % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion, HBPythonAutoVersion ),
+ 'lib': glob.glob( "%s/%s/lib/*.dylib" % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion ) )[0]
+ }
+except Exception as e:
+ _have_Homebrew_Python = False
+ print( " WARNING!!! Since you don't have the Homebrew Python Frameworks, you cannot use the '-p HBAuto' option. " )
+ pass
+else:
+ _have_Homebrew_Python = True
+
# Consolidated dictionary kit for Python
-PythonDictionary= { 'nil' : None,
- 'PythonElCapitan' : PythonElCapitan,
- 'PythonSierra' : PythonSierra,
- 'PythonHighSierra': PythonHighSierra,
- 'PythonMojave' : PythonMojave,
- 'PythonCatalina' : PythonCatalina,
- 'Python38MacPorts': Python38MacPorts,
- 'Python38Brew' : Python38Brew,
- 'PythonAnaconda3' : PythonAnaconda3
- }
+PythonDictionary = { 'nil' : None,
+ 'PythonElCapitan' : PythonElCapitan,
+ 'PythonSierra' : PythonSierra,
+ 'PythonHighSierra': PythonHighSierra,
+ 'PythonMojave' : PythonMojave,
+ 'PythonCatalina' : PythonCatalina,
+ 'PythonBigSur' : PythonBigSur,
+ 'Python38MacPorts': Python38MacPorts,
+ 'Python38Brew' : Python38Brew,
+ 'PythonAnaconda3' : PythonAnaconda3
+ }
+if _have_Homebrew_Python:
+ PythonDictionary['PythonAutoBrew'] = PythonAutoBrew
#-----------------------------------------------------
# [4] KLayout executables including buddy tools
diff --git a/macbuild/macQAT.py b/macbuild/macQAT.py
index 907330f1c..73e45b956 100755
--- a/macbuild/macQAT.py
+++ b/macbuild/macQAT.py
@@ -16,8 +16,6 @@ import os
import datetime
from time import sleep
import six
-import shutil
-import glob
import platform
import optparse
import subprocess
@@ -27,55 +25,55 @@ import subprocess
#
#-------------------------------------------------------------------------------
def SetGlobals():
- global ProjectDir # project directory where "ut_runner" exists
- global RunnerUsage # True to print the usage of 'ut_runner'
- global Run # True to run this script
- global ContinueOnError # True to continue after an error
- global TestsExcluded # list of tests to exclude
- global Arguments # other arguments
- global GitSHA1 # Git's short SHA1 value of the HEAD
- global TimeStamp # time stamp
- global WorkDir # work directory name
- global LogFile # log file name
- global Usage # string on usage
- # auxiliary variables on platform
- global System # 6-tuple from platform.uname()
- global Node # - do -
- global Release # - do -
- global Version # - do -
- global Machine # - do -
- global Processor # - do -
- global Bit # machine bit-size
+ global ProjectDir # project directory where "ut_runner" exists
+ global RunnerUsage # True to print the usage of 'ut_runner'
+ global Run # True to run this script
+ global ContinueOnError # True to continue after an error
+ global TestsExcluded # list of tests to exclude
+ global Arguments # other arguments
+ global GitSHA1 # Git's short SHA1 value of the HEAD
+ global TimeStamp # time stamp
+ global WorkDir # work directory name
+ global LogFile # log file name
+ global Usage # string on usage
+ # auxiliary variables on platform
+ global System # 6-tuple from platform.uname()
+ global Node # - do -
+ global Release # - do -
+ global Version # - do -
+ global Machine # - do -
+ global Processor # - do -
+ global Bit # machine bit-size
- Usage = "\n"
- Usage += "----------------------------------------------------------------------------------------\n"
- Usage += "<< Usage of 'macQAT.py' >>\n"
- Usage += " for running 'ut_runner' after building KLayout.\n"
- Usage += "\n"
- Usage += "$ [python] ./macQAT.py \n"
- Usage += " option & argument : descriptions | default value\n"
- Usage += " -----------------------------------------------------------------+---------------\n"
- Usage += " [-u|--usage] : print usage of 'ut_runner'and exit | disabled \n"
- Usage += " | \n"
- Usage += " <-r|--run> : run this script | disabled \n"
- Usage += " [-s|--stop] : stop on error | disabled \n"
- Usage += " [-x|--exclude ] : exclude test(s) such as 'pymod,pya' | '' \n"
- Usage += " [-a|--args ] : arguments other than '-x' and '-c' | '' \n"
- Usage += " [-?|--?] : print this usage and exit | disabled \n"
- Usage += "--------------------------------------------------------------------+-------------------\n"
+ Usage = "\n"
+ Usage += "----------------------------------------------------------------------------------------\n"
+ Usage += "<< Usage of 'macQAT.py' >>\n"
+ Usage += " for running 'ut_runner' after building KLayout.\n"
+ Usage += "\n"
+ Usage += "$ [python] ./macQAT.py \n"
+ Usage += " option & argument : descriptions | default value\n"
+ Usage += " -----------------------------------------------------------------+---------------\n"
+ Usage += " [-u|--usage] : print usage of 'ut_runner'and exit | disabled \n"
+ Usage += " | \n"
+ Usage += " <-r|--run> : run this script | disabled \n"
+ Usage += " [-s|--stop] : stop on error | disabled \n"
+ Usage += " [-x|--exclude ] : exclude test(s) such as 'pymod,pya' | '' \n"
+ Usage += " [-a|--args ] : arguments other than '-x' and '-c' | '' \n"
+ Usage += " [-?|--?] : print this usage and exit | disabled \n"
+ Usage += "--------------------------------------------------------------------+-------------------\n"
- ProjectDir = os.getcwd()
- RunnerUsage = False
- Run = False
- ContinueOnError = True
- TestsExcluded = list()
- Arguments = ""
- GitSHA1 = GetGitShortSHA1()
- TimeStamp = GetTimeStamp()
- WorkDir = "QATest_%s_%s__%s" % (GitSHA1, TimeStamp, os.path.basename(ProjectDir) )
- LogFile = WorkDir + ".log"
+ ProjectDir = os.getcwd()
+ RunnerUsage = False
+ Run = False
+ ContinueOnError = True
+ TestsExcluded = list()
+ Arguments = ""
+ GitSHA1 = GetGitShortSHA1()
+ TimeStamp = GetTimeStamp()
+ WorkDir = "QATest_%s_%s__%s" % (GitSHA1, TimeStamp, os.path.basename(ProjectDir) )
+ LogFile = WorkDir + ".log"
- (System, Node, Release, Version, Machine, Processor) = platform.uname()
+ (System, Node, Release, Version, Machine, Processor) = platform.uname()
#-------------------------------------------------------------------------------
## Get git's short SHA1 value of the HEAD
@@ -83,9 +81,9 @@ def SetGlobals():
# @return SHA1 value string
#-------------------------------------------------------------------------------
def GetGitShortSHA1():
- command = "git rev-parse --short HEAD 2>/dev/null"
- sha1val = os.popen( command ).read().strip()
- return sha1val
+ command = "git rev-parse --short HEAD 2>/dev/null"
+ sha1val = os.popen( command ).read().strip()
+ return sha1val
#-------------------------------------------------------------------------------
## Get the time stamp
@@ -93,108 +91,108 @@ def GetGitShortSHA1():
# @return time stamp string
#-------------------------------------------------------------------------------
def GetTimeStamp():
- ts = datetime.datetime.today()
- return "%04d_%02d%02d_%02d%02d" % (ts.year, ts.month, ts.day, ts.hour, ts.minute)
+ ts = datetime.datetime.today()
+ return "%04d_%02d%02d_%02d%02d" % (ts.year, ts.month, ts.day, ts.hour, ts.minute)
#-------------------------------------------------------------------------------
## To parse the command line arguments
#
#-------------------------------------------------------------------------------
def ParseCommandLineArguments():
- global Usage
- global RunnerUsage
- global Run
- global ContinueOnError
- global TestsExcluded
- global Arguments
+ global Usage
+ global RunnerUsage
+ global Run
+ global ContinueOnError
+ global TestsExcluded
+ global Arguments
- p = optparse.OptionParser( usage=Usage )
- p.add_option( '-u', '--usage',
- action='store_true',
- dest='runner_usage',
- default=False,
- help="print usage of 'ut_runner' and exit (false)" )
+ p = optparse.OptionParser( usage=Usage )
+ p.add_option( '-u', '--usage',
+ action='store_true',
+ dest='runner_usage',
+ default=False,
+ help="print usage of 'ut_runner' and exit (false)" )
- p.add_option( '-r', '--run',
- action='store_true',
- dest='runme',
- default=False,
- help='run this script (false)' )
+ p.add_option( '-r', '--run',
+ action='store_true',
+ dest='runme',
+ default=False,
+ help='run this script (false)' )
- p.add_option( '-s', '--stop',
- action='store_true',
- dest='stop_on_error',
- default=False,
- help='stop on error (false)' )
+ p.add_option( '-s', '--stop',
+ action='store_true',
+ dest='stop_on_error',
+ default=False,
+ help='stop on error (false)' )
- p.add_option( '-x', '--exclude',
- dest='exclude_tests',
- help="exclude test(s) such as 'pymod,pya' ('')" )
+ p.add_option( '-x', '--exclude',
+ dest='exclude_tests',
+ help="exclude test(s) such as 'pymod,pya' ('')" )
- p.add_option( '-a', '--args',
- dest='arguments',
- help="arguments other than '-x' and '-c' ('')" )
+ p.add_option( '-a', '--args',
+ dest='arguments',
+ help="arguments other than '-x' and '-c' ('')" )
- p.add_option( '-?', '--??',
- action='store_true',
- dest='checkusage',
- default=False,
- help='check usage (false)' )
+ p.add_option( '-?', '--??',
+ action='store_true',
+ dest='checkusage',
+ default=False,
+ help='check usage (false)' )
- p.set_defaults( runner_usage = False,
- runme = False,
- stop_on_error = False,
- exclude_tests = "",
- arguments = "",
- checkusage = False )
+ p.set_defaults( runner_usage = False,
+ runme = False,
+ stop_on_error = False,
+ exclude_tests = "",
+ arguments = "",
+ checkusage = False )
- opt, args = p.parse_args()
- if opt.checkusage:
- print(Usage)
- quit()
+ opt, args = p.parse_args()
+ if opt.checkusage:
+ print(Usage)
+ quit()
- RunnerUsage = opt.runner_usage
- Run = opt.runme
- ContinueOnError = not opt.stop_on_error
- if not opt.exclude_tests == "":
- TestsExcluded = [ item.strip() for item in opt.exclude_tests.split(',') ]
- else:
- TestsExcluded = []
- Arguments = opt.arguments
+ RunnerUsage = opt.runner_usage
+ Run = opt.runme
+ ContinueOnError = not opt.stop_on_error
+ if not opt.exclude_tests == "":
+ TestsExcluded = [ item.strip() for item in opt.exclude_tests.split(',') ]
+ else:
+ TestsExcluded = []
+ Arguments = opt.arguments
#-------------------------------------------------------------------------------
## Hide/Show the private directory
#
#-------------------------------------------------------------------------------
def HidePrivateDir():
- if os.path.isdir( "../private" ):
- os.rename( "../private", "../private.stash" )
+ if os.path.isdir( "../private" ):
+ os.rename( "../private", "../private.stash" )
def ShowPrivateDir():
- if os.path.isdir( "../private.stash" ):
- os.rename( "../private.stash", "../private" )
+ if os.path.isdir( "../private.stash" ):
+ os.rename( "../private.stash", "../private" )
#-------------------------------------------------------------------------------
## Export environment variables for "ut_runner"
#
#-------------------------------------------------------------------------------
def ExportEnvVariables():
- global ProjectDir
- global WorkDir
- global MyEnviron # my environment variables; can be independently used later
+ global ProjectDir
+ global WorkDir
+ global MyEnviron # my environment variables; can be independently used later
- # In older versions of subprocess module, 'env=None' argument is not provided
- MyEnviron = os.environ.copy()
- MyEnviron[ 'TESTSRC' ] = ".."
- MyEnviron[ 'TESTTMP' ] = WorkDir
- if System == "Darwin":
- MyEnviron[ 'DYLD_LIBRARY_PATH' ] = "%s:%s/db_plugins" % (ProjectDir, ProjectDir)
- for env in [ 'TESTSRC', 'TESTTMP', 'DYLD_LIBRARY_PATH' ]:
- os.environ[env] = MyEnviron[env]
- else:
- MyEnviron[ 'LD_LIBRARY_PATH' ] = "%s:%s/db_plugins" % (ProjectDir, ProjectDir)
- for env in [ 'TESTSRC', 'TESTTMP', 'LD_LIBRARY_PATH' ]:
- os.environ[env] = MyEnviron[env]
+ # In older versions of subprocess module, 'env=None' argument is not provided
+ MyEnviron = os.environ.copy()
+ MyEnviron[ 'TESTSRC' ] = ".."
+ MyEnviron[ 'TESTTMP' ] = WorkDir
+ if System == "Darwin":
+ MyEnviron[ 'DYLD_LIBRARY_PATH' ] = "%s:%s/db_plugins" % (ProjectDir, ProjectDir)
+ for env in [ 'TESTSRC', 'TESTTMP', 'DYLD_LIBRARY_PATH' ]:
+ os.environ[env] = MyEnviron[env]
+ else:
+ MyEnviron[ 'LD_LIBRARY_PATH' ] = "%s:%s/db_plugins" % (ProjectDir, ProjectDir)
+ for env in [ 'TESTSRC', 'TESTTMP', 'LD_LIBRARY_PATH' ]:
+ os.environ[env] = MyEnviron[env]
#-------------------------------------------------------------------------------
## Run the tester
@@ -203,75 +201,77 @@ def ExportEnvVariables():
# @param[in] logfile log file name
#-------------------------------------------------------------------------------
def RunTester( command, logfile="" ):
- if six.PY3:
- proc = subprocess.Popen( command.split(), stdout=subprocess.PIPE, \
- stderr=subprocess.STDOUT, \
- universal_newlines=True )
- else:
- proc = subprocess.Popen( command.split(), stdout=subprocess.PIPE, \
- stderr=subprocess.STDOUT )
+ if six.PY3:
+ proc = subprocess.Popen( command.split(),
+ stdout=subprocess.PIPE, \
+ stderr=subprocess.STDOUT, \
+ universal_newlines=True )
+ else:
+ proc = subprocess.Popen( command.split(),
+ stdout=subprocess.PIPE, \
+ stderr=subprocess.STDOUT )
- if not logfile == "":
- with proc.stdout, open( logfile, 'w' ) as file:
- for line in proc.stdout:
- sys.stdout.write(line)
- file.write(line)
- proc.wait()
- else:
- with proc.stdout:
- for line in proc.stdout:
- sys.stdout.write(line)
- proc.wait()
+ if not logfile == "":
+ with proc.stdout, open( logfile, 'w' ) as file:
+ for line in proc.stdout:
+ sys.stdout.write(line)
+ file.write(line)
+ proc.wait()
+ else:
+ with proc.stdout:
+ for line in proc.stdout:
+ sys.stdout.write(line)
+ proc.wait()
#-------------------------------------------------------------------------------
# Main function
#-------------------------------------------------------------------------------
def Main():
- #-------------------------------------------------------
- # [1] Initialize
- #-------------------------------------------------------
- SetGlobals()
- ParseCommandLineArguments()
- ExportEnvVariables()
+ #-------------------------------------------------------
+ # [1] Initialize
+ #-------------------------------------------------------
+ SetGlobals()
+ ParseCommandLineArguments()
+ ExportEnvVariables()
- #-------------------------------------------------------
- # [2] Print the runner's usage
- #-------------------------------------------------------
- if RunnerUsage:
- command = './ut_runner --help-all'
- RunTester( command )
- quit()
+ #-------------------------------------------------------
+ # [2] Print the runner's usage
+ #-------------------------------------------------------
+ if RunnerUsage:
+ command = './ut_runner --help-all'
+ RunTester( command )
+ quit()
- #-------------------------------------------------------
- # [3] Run the unit tester
- #-------------------------------------------------------
- if not Run:
- print( "! pass <-r|--run> option to run" )
- print(Usage)
- quit()
+ #-------------------------------------------------------
+ # [3] Run the unit tester
+ #-------------------------------------------------------
+ if not Run:
+ print( "! pass <-r|--run> option to run" )
+ print(Usage)
+ quit()
- command = './ut_runner'
- if ContinueOnError:
- command += " -c"
- for item in TestsExcluded:
- command += ' -x %s' % item
- if not Arguments == "":
- command += " %s" % Arguments
+ command = './ut_runner'
+ if ContinueOnError:
+ command += " -c"
+ for item in TestsExcluded:
+ command += ' -x %s' % item
+ if not Arguments == "":
+ command += " %s" % Arguments
- print( "" )
- print( "### Dumping the log to <%s>" % LogFile )
- print( "------------------------------------------------------------" )
- print( " Git SHA1 = %s" % GitSHA1 )
- print( " Time stamp = %s" % TimeStamp )
- print( "------------------------------------------------------------" )
- sleep( 1.0 )
- HidePrivateDir()
- RunTester( command, logfile=LogFile )
- ShowPrivateDir()
+ print( "" )
+ print( "### Dumping the log to <%s>" % LogFile )
+ print( "------------------------------------------------------------" )
+ print( " Git SHA1 = %s" % GitSHA1 )
+ print( " Time stamp = %s" % TimeStamp )
+ print( "------------------------------------------------------------" )
+ sleep( 1.0 )
+ HidePrivateDir()
+ RunTester( command, logfile=LogFile )
+ ShowPrivateDir()
#===================================================================================
if __name__ == "__main__":
- Main()
+ Main()
#---------------
# End of file
diff --git a/macbuild/macQAT.sh b/macbuild/macQAT.sh
index 36ac52e3e..8668cf91d 100755
--- a/macbuild/macQAT.sh
+++ b/macbuild/macQAT.sh
@@ -14,23 +14,23 @@
# Functions
#----------------------------------------------------------------
function GetPresentDir() {
- path=$1
- array=( `echo $path | tr -s '/' ' '`)
- last_index=`expr ${#array[@]} - 1`
- echo ${array[${last_index}]}
- return 0
+ 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
+ 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
+ if [ -d "../private.stash" ]; then
+ ret=$(/bin/mv ../private.stash ../private)
+ fi
}
#----------------------------------------------------------------
@@ -52,17 +52,28 @@ 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
+ 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}"
@@ -72,17 +83,6 @@ if [ $# -eq 1 ]; then
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
#--------------
diff --git a/macbuild/makeDMG4mac.py b/macbuild/makeDMG4mac.py
index 5ef4edd6f..3d2b26a65 100755
--- a/macbuild/makeDMG4mac.py
+++ b/macbuild/makeDMG4mac.py
@@ -36,147 +36,150 @@ from build4mac_util import *
## To set global variables including present directory and platform info.
#-------------------------------------------------------------------------------
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
- global UnsafePkg # flags whether to proceed to making "invalid" dmg
- global OpClean # 'clean' operation
- global OpMake # 'make' operation
- global DefaultBundleName # the default bundle name 'klayout.app'
- global BundleName # application bundle name in the DMG
- global DMGSerialNum # the DMG serial number
- global PackagePrefix # the package prefix: 'ST-', 'LW-', 'HW-', or 'EX-'
- global QtIdentification # Qt identification
- global RubyPythonID # Ruby- and Python-identification
- global KLVersion # KLayout's version
- global OccupiedDS # approx. occupied disc space
- global BackgroundPNG # the background PNG image file
- global VolumeIcons # the volume icon file
- global AppleScriptDMG # the AppleScript for KLayout DMG
- global WorkDMG # work DMG file created under ProjectDir/
- global VolumeDMG # the volume name of DMG
- global TargetDMG # the name of target DMG file
- global RootApplications # reserved directory name for applications
- 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
- global System # 6-tuple from platform.uname()
- global Node # - do -
- global Release # - do -
- global Version # - do -
- global Machine # - do -
- global Processor # - do -
- global Bit # machine bit-size
+ 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
+ global UnsafePkg # flags whether to proceed to making "invalid" dmg
+ global OpClean # 'clean' operation
+ global OpMake # 'make' operation
+ global DefaultBundleName # the default bundle name 'klayout.app'
+ global BundleName # application bundle name in the DMG
+ global DMGSerialNum # the DMG serial number
+ global PackagePrefix # the package prefix: 'ST-', 'LW-', 'HW-', or 'EX-'
+ global QtIdentification # Qt identification
+ global RubyPythonID # Ruby- and Python-identification
+ global KLVersion # KLayout's version
+ global OccupiedDS # approx. occupied disc space
+ global BackgroundPNG # the background PNG image file
+ global VolumeIcons # the volume icon file
+ global AppleScriptDMG # the AppleScript for KLayout DMG
+ global WorkDMG # work DMG file created under ProjectDir/
+ global VolumeDMG # the volume name of DMG
+ global TargetDMG # the name of target DMG file
+ global RootApplications # reserved directory name for applications
+ 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
+ global System # 6-tuple from platform.uname()
+ global Node # - do -
+ global Release # - do -
+ global Version # - do -
+ global Machine # - do -
+ global Processor # - do -
+ global Bit # machine bit-size
- Usage = "\n"
- Usage += "--------------------------------------------------------------------------------------------------------\n"
- Usage += "<< Usage of 'makeDMG4mac.py' >>\n"
- Usage += " for making a DMG file of KLayout 0.26.1 or later on different Apple Mac OSX platforms.\n"
- Usage += "\n"
- Usage += "$ [python] ./makeDMG4mac.py \n"
- Usage += " option & argument : descriptions | default value\n"
- Usage += " ----------------------------------------------------------------------------------+---------------\n"
- Usage += " <-p|--pkg > : package directory created by `build4mac.py` with [-y|-Y] | `` \n"
- Usage += " : like 'ST-qt5MP.pkg.macos-Catalina-release-RsysPsys' | \n"
- Usage += " <-c|--clean> : clean the work directory | disabled \n"
- Usage += " <-m|--make> : make a compressed DMG file | disabled \n"
- Usage += " : <-c|--clean> and <-m|--make> are mutually exclusive | \n"
- Usage += " [-b|--bundle ] : forcibly use this bundle name in the DMG | '' \n"
- Usage += " [-s|--serial ] : DMG serial number | 1 \n"
- Usage += " <-u|--unsafe> : Ignores a few checks (use with caution) | disabled \n"
- Usage += " <-t|--targetdmg> : Specify output .dmg filename | chosen by script \n"
- Usage += " [-?|--?] : print this usage and exit | disabled \n"
- Usage += "-------------------------------------------------------------------------------------+------------------\n"
+ Usage = "\n"
+ Usage += "--------------------------------------------------------------------------------------------------------\n"
+ Usage += "<< Usage of 'makeDMG4mac.py' >>\n"
+ Usage += " for making a DMG file of KLayout 0.26.1 or later on different Apple Mac OSX platforms.\n"
+ Usage += "\n"
+ Usage += "$ [python] ./makeDMG4mac.py \n"
+ Usage += " option & argument : descriptions | default value\n"
+ Usage += " ----------------------------------------------------------------------------------+---------------\n"
+ Usage += " <-p|--pkg > : package directory created by `build4mac.py` with [-y|-Y] | `` \n"
+ Usage += " : like 'ST-qt5MP.pkg.macos-Catalina-release-RsysPsys' | \n"
+ Usage += " <-c|--clean> : clean the work directory | disabled \n"
+ Usage += " <-m|--make> : make a compressed DMG file | disabled \n"
+ Usage += " : <-c|--clean> and <-m|--make> are mutually exclusive | \n"
+ Usage += " [-b|--bundle ] : forcibly use this bundle name in the DMG | '' \n"
+ Usage += " [-s|--serial ] : DMG serial number | 1 \n"
+ Usage += " <-u|--unsafe> : Ignores a few checks (use with caution) | disabled \n"
+ Usage += " <-t|--targetdmg> : Specify output .dmg filename | chosen by script \n"
+ Usage += " [-?|--?] : print this usage and exit | disabled \n"
+ Usage += "-------------------------------------------------------------------------------------+------------------\n"
- ProjectDir = os.getcwd()
- (System, Node, Release, Version, Machine, Processor) = platform.uname()
+ ProjectDir = os.getcwd()
+ (System, Node, Release, Version, Machine, Processor) = platform.uname()
- if not System == "Darwin":
- print("")
- print( "!!! Sorry. Your system <%s> looks like non-Mac" % System, file=sys.stderr )
- print(Usage)
- quit()
+ if not System == "Darwin":
+ print("")
+ print( "!!! Sorry. Your system <%s> looks like non-Mac" % System, file=sys.stderr )
+ print(Usage)
+ 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"
- elif release == 17:
- GenOSName = "macOS"
- Platform = "HighSierra"
- elif release == 16:
- Platform = "Sierra"
- GenOSName = "macOS"
- elif release == 15:
- GenOSName = "MacOSX"
- Platform = "ElCapitan"
- else:
- Platform = ""
- print("")
- print( "!!! Sorry. Unsupported major OS release <%d>" % release, file=sys.stderr )
- print(Usage)
- sys.exit(1)
+ release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0']
+ LatestOS = ""
+ if release == 20:
+ GenOSName = "macOS"
+ Platform = "BigSur"
+ elif release == 19:
+ GenOSName = "macOS"
+ Platform = "Catalina"
+ LatestOS = Platform
+ elif release == 18:
+ GenOSName = "macOS"
+ Platform = "Mojave"
+ elif release == 17:
+ GenOSName = "macOS"
+ Platform = "HighSierra"
+ elif release == 16:
+ Platform = "Sierra"
+ GenOSName = "macOS"
+ elif release == 15:
+ GenOSName = "MacOSX"
+ Platform = "ElCapitan"
+ else:
+ Platform = ""
+ print("")
+ print( "!!! Sorry. Unsupported major OS release <%d>" % release, file=sys.stderr )
+ print(Usage)
+ sys.exit(1)
- if not Machine == "x86_64":
- print("")
- print( "!!! Sorry. Only x86_64 architecture machine is supported but found <%s>" % Machine, file=sys.stderr )
- print(Usage)
- sys.exit(1)
+ if not Machine == "x86_64":
+ print("")
+ print( "!!! Sorry. Only x86_64 architecture machine is supported but found <%s>" % Machine, file=sys.stderr )
+ print(Usage)
+ sys.exit(1)
- PkgDir = ""
- UnsafePkg = False
- OpClean = False
- OpMake = False
- DefaultBundleName = "klayout.app"
- BundleName = ""
- DMGSerialNum = 1
- PackagePrefix = ""
- QtIdentification = ""
- RubyPythonID = ""
- KLVersion = GetKLayoutVersionFrom( "./version.sh" )
- OccupiedDS = -1
- BackgroundPNG = "KLayoutDMG-Back.png"
- VolumeIcons = "KLayoutHDD.icns"
- AppleScriptDMG = "macbuild/Resources/KLayoutDMG.applescript"
- WorkDMG = "work-KLayout.dmg"
- VolumeDMG = "KLayout"
- TargetDMG = ""
- RootApplications = "/Applications"
- LatestOSMacPorts = False
- LatestOSHomebrew = False
- LatestOSAnaconda3 = False
- DicLightWeight = dict()
- Item3AppleScript = ""
- # Populate DicLightWeight
- DicLightWeight[ "ports" ] = dict()
- DicLightWeight[ "brew" ] = dict()
- DicLightWeight[ "ana3" ] = dict()
+ PkgDir = ""
+ UnsafePkg = False
+ OpClean = False
+ OpMake = False
+ DefaultBundleName = "klayout.app"
+ BundleName = ""
+ DMGSerialNum = 1
+ PackagePrefix = ""
+ QtIdentification = ""
+ RubyPythonID = ""
+ KLVersion = GetKLayoutVersionFrom( "./version.sh" )
+ OccupiedDS = -1
+ BackgroundPNG = "KLayoutDMG-Back.png"
+ VolumeIcons = "KLayoutHDD.icns"
+ AppleScriptDMG = "macbuild/Resources/KLayoutDMG.applescript"
+ WorkDMG = "work-KLayout.dmg"
+ VolumeDMG = "KLayout"
+ TargetDMG = ""
+ RootApplications = "/Applications"
+ LatestOSMacPorts = False
+ LatestOSHomebrew = False
+ LatestOSAnaconda3 = False
+ DicLightWeight = dict()
+ Item3AppleScript = ""
+ # Populate DicLightWeight
+ 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[ "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[ "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}'
+ 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 +187,8 @@ def SetGlobals():
# The package directory name should look like:
# * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys --- (1)
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
-# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb26Phb38
-# * LW-qt5MP.pkg.macos-Catalina-release-Rmp26Pmp38
+# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38
+# * LW-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38
#
# Generated DMG will be, for example,
# (1) ---> ST-klayout-0.26.1-macOS-Catalina-1-qt5MP-RsysPsys.dmg
@@ -194,257 +197,257 @@ def SetGlobals():
# on failure, -1
#------------------------------------------------------------------------------
def CheckPkgDirectory():
- global PkgDir
- global UnsafePkg
- global Platform
- global OpClean
- global OpMake
- global DefaultBundleName
- global BundleName
- global PackagePrefix
- global QtIdentification
- global RubyPythonID
- global LatestOSMacPorts
- global LatestOSHomebrew
- global LatestOSAnaconda3
- global DicLightWeight
- global Item3AppleScript
+ global PkgDir
+ global UnsafePkg
+ global Platform
+ global OpClean
+ global OpMake
+ global DefaultBundleName
+ global BundleName
+ global PackagePrefix
+ global QtIdentification
+ global RubyPythonID
+ global LatestOSMacPorts
+ global LatestOSHomebrew
+ global LatestOSAnaconda3
+ global DicLightWeight
+ global Item3AppleScript
- #-----------------------------------------------------------------------------
- # [1] Check the contents of the package directory
- #-----------------------------------------------------------------------------
- if PkgDir == "":
- print( "! Package directory is not specified", file=sys.stderr )
- print(Usage)
- return -1
+ #-----------------------------------------------------------------------------
+ # [1] Check the contents of the package directory
+ #-----------------------------------------------------------------------------
+ if PkgDir == "":
+ print( "! Package directory is not specified", file=sys.stderr )
+ print(Usage)
+ return -1
- if not os.path.isdir(PkgDir):
- print( "! Specified package directory <%s> does not exist" % PkgDir, file=sys.stderr )
- print( "" )
- return -1
+ if not os.path.isdir(PkgDir):
+ print( "! Specified package directory <%s> does not exist" % PkgDir, file=sys.stderr )
+ print( "" )
+ return -1
- #-----------------------------------------------------------------------------
- # [2] Identify (Qt, Ruby, Python) from PkgDir
- #
- # * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys
- # * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
- # * LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38
- # * HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb38
- # * EX-qt5MP.pkg.macos-Catalina-release-Rmp26Pmp38
- #-----------------------------------------------------------------------------
- patQRP = u'(ST|LW|HW|EX)([-])(qt5[0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-]release[-])([0-9A-Za-z]+)'
- regQRP = re.compile(patQRP)
- if not regQRP.match(PkgDir):
- print( "! Cannot identify (Qt, Ruby, Python) from the package directory name" )
- if UnsafePkg:
- print( "! Ignoring..." )
+ #-----------------------------------------------------------------------------
+ # [2] Identify (Qt, Ruby, Python) from PkgDir
+ #
+ # * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys
+ # * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
+ # * LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38
+ # * HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb38
+ # * EX-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38
+ #-----------------------------------------------------------------------------
+ patQRP = u'(ST|LW|HW|EX)([-])(qt5[0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-]release[-])([0-9A-Za-z]+)'
+ regQRP = re.compile(patQRP)
+ if not regQRP.match(PkgDir):
+ print( "! Cannot identify (Qt, Ruby, Python) from the package directory name" )
+ if UnsafePkg:
+ print( "! Ignoring..." )
+ else:
+ print( "" )
+ return -1
else:
- print( "" )
- return -1
- else:
- pkgdirComponents = regQRP.match(PkgDir).groups()
- PackagePrefix = pkgdirComponents[0]
- QtIdentification = pkgdirComponents[2]
- RubyPythonID = pkgdirComponents[5]
+ pkgdirComponents = regQRP.match(PkgDir).groups()
+ PackagePrefix = pkgdirComponents[0]
+ QtIdentification = pkgdirComponents[2]
+ RubyPythonID = pkgdirComponents[5]
- #-----------------------------------------------------------------------------
- # [3] Check if the "LatestOS" with MacPorts / Homebrew / Anaconda3
- #-----------------------------------------------------------------------------
- LatestOSMacPorts = Platform == LatestOS
- LatestOSMacPorts &= PackagePrefix == "LW"
- LatestOSMacPorts &= QtIdentification == "qt5MP"
- LatestOSMacPorts &= RubyPythonID == "Rmp26Pmp38"
+ #-----------------------------------------------------------------------------
+ # [3] Check if the "LatestOS" with MacPorts / Homebrew / Anaconda3
+ #-----------------------------------------------------------------------------
+ LatestOSMacPorts = Platform == LatestOS
+ LatestOSMacPorts &= PackagePrefix == "LW"
+ LatestOSMacPorts &= QtIdentification == "qt5MP"
+ LatestOSMacPorts &= RubyPythonID == "Rmp26Pmp38"
- LatestOSHomebrew = Platform == LatestOS
- LatestOSHomebrew &= PackagePrefix == "LW"
- LatestOSHomebrew &= QtIdentification == "qt5Brew"
- LatestOSHomebrew &= RubyPythonID == "Rhb27Phb38"
+ LatestOSHomebrew = Platform == LatestOS
+ LatestOSHomebrew &= PackagePrefix == "LW"
+ LatestOSHomebrew &= QtIdentification == "qt5Brew"
+ LatestOSHomebrew &= RubyPythonID == "Rhb27Phb38" or RubyPythonID == "Rhb27Phbauto"
- LatestOSAnaconda3 = Platform == LatestOS
- LatestOSAnaconda3 &= PackagePrefix == "LW"
- LatestOSAnaconda3 &= QtIdentification == "qt5Ana3"
- LatestOSAnaconda3 &= RubyPythonID == "Rana3Pana3"
+ 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:
- 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"]
+ if LatestOSMacPorts:
+ mydic = DicLightWeight["ports"]
+ 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"]
- if LatestOSHomebrew:
- mydic = DicLightWeight["brew"]
- 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"]
+ if LatestOSHomebrew:
+ mydic = DicLightWeight["brew"]
+ 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"]
- 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"]
+ 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
- #------------------------------------------------------
- os.chdir(PkgDir)
- if not os.path.isdir( DefaultBundleName ):
- print( "! The package directory <%s> does not hold <%s> bundle" % (PkgDir, DefaultBundleName), file=sys.stderr )
- print( "" )
+ #------------------------------------------------------
+ # [4] Check the presence of the default bundle
+ #------------------------------------------------------
+ os.chdir(PkgDir)
+ if not os.path.isdir( DefaultBundleName ):
+ print( "! The package directory <%s> does not hold <%s> bundle" % (PkgDir, DefaultBundleName), file=sys.stderr )
+ print( "" )
+ os.chdir(ProjectDir)
+ return -1
+
+ #------------------------------------------------------
+ # [5] Check the occupied disk space
+ #------------------------------------------------------
+ command = "\du -sm %s" % DefaultBundleName
+ sizeApp = int( os.popen(command).read().strip("\n").split("\t")[0] )
+
+ #------------------------------------------------------
+ # [6] Change the application bundle name if required
+ #------------------------------------------------------
+ if OpMake and BundleName != "" and BundleName != DefaultBundleName:
+ os.rename( DefaultBundleName, BundleName )
os.chdir(ProjectDir)
- return -1
-
- #------------------------------------------------------
- # [5] Check the occupied disk space
- #------------------------------------------------------
- command = "\du -sm %s" % DefaultBundleName
- sizeApp = int( os.popen(command).read().strip("\n").split("\t")[0] )
-
- #------------------------------------------------------
- # [6] Change the application bundle name if required
- #------------------------------------------------------
- if OpMake and BundleName != "" and BundleName != DefaultBundleName:
- os.rename( DefaultBundleName, BundleName )
- os.chdir(ProjectDir)
- return sizeApp
+ return sizeApp
#------------------------------------------------------------------------------
## To get command line parameters
#------------------------------------------------------------------------------
def ParseCommandLineArguments():
- global ProjectDir
- global Usage
- global GenOSName
- global Platform
- global PkgDir
- global OpClean
- global OpMake
- global BundleName
- global DMGSerialNum
- global UnsafePkg
- global PackagePrefix
- global QtIdentification
- global RubyPythonID
- global KLVersion
- global OccupiedDS
- global TargetDMG
+ global ProjectDir
+ global Usage
+ global GenOSName
+ global Platform
+ global PkgDir
+ global OpClean
+ global OpMake
+ global BundleName
+ global DMGSerialNum
+ global UnsafePkg
+ global PackagePrefix
+ global QtIdentification
+ global RubyPythonID
+ global KLVersion
+ global OccupiedDS
+ global TargetDMG
- p = optparse.OptionParser( usage=Usage )
- p.add_option( '-p', '--pkg',
- dest='pkg_dir',
- help="the pkg directory" )
+ p = optparse.OptionParser( usage=Usage )
+ p.add_option( '-p', '--pkg',
+ dest='pkg_dir',
+ help="the pkg directory" )
- p.add_option( '-c', '--clean',
- action='store_true',
- dest='operation_clean',
- default=False,
- help="clean operation" )
+ p.add_option( '-c', '--clean',
+ action='store_true',
+ dest='operation_clean',
+ default=False,
+ help="clean operation" )
- p.add_option( '-m', '--make',
- action='store_true',
- dest='operation_make',
- default=False,
- help="make operation" )
+ p.add_option( '-m', '--make',
+ action='store_true',
+ dest='operation_make',
+ default=False,
+ help="make operation" )
- p.add_option( '-b', '--bundle',
- dest='bundle_name',
- help="forcibly use this bundle name in the DMG" )
+ p.add_option( '-b', '--bundle',
+ dest='bundle_name',
+ help="forcibly use this bundle name in the DMG" )
- p.add_option( '-s', '--serial',
- dest='dmg_serial',
- help="DMG serial number" )
+ p.add_option( '-s', '--serial',
+ dest='dmg_serial',
+ help="DMG serial number" )
- p.add_option( '-t', '--targetdmg',
- dest='target_dmg',
- help="output DMG filename" )
+ p.add_option( '-t', '--targetdmg',
+ dest='target_dmg',
+ help="output DMG filename" )
- p.add_option( '-z', '--unsafe',
- action='store_true',
- dest='unsafe',
- default=False,
- help="If set, do not check whether pkg folder is empty" )
+ p.add_option( '-z', '--unsafe',
+ action='store_true',
+ dest='unsafe',
+ default=False,
+ help="If set, do not check whether pkg folder is empty" )
- p.add_option( '-?', '--??',
- action='store_true',
- dest='checkusage',
- default=False,
- help='check usage' )
+ p.add_option( '-?', '--??',
+ action='store_true',
+ dest='checkusage',
+ default=False,
+ help='check usage' )
- p.set_defaults( pkg_dir = "",
- operation_clean = False,
- operation_make = False,
- bundle_name = "",
- target_dmg = "",
- dmg_serial = "1",
- unsafe = False,
- checkusage = False )
+ p.set_defaults( pkg_dir = "",
+ operation_clean = False,
+ operation_make = False,
+ bundle_name = "",
+ target_dmg = "",
+ dmg_serial = "1",
+ unsafe = False,
+ checkusage = False )
- #-----------------------------------------------------------
- # [1] Parse the command line options
- #-----------------------------------------------------------
- opt, args = p.parse_args()
- if (opt.checkusage):
- print(Usage)
- quit()
+ #-----------------------------------------------------------
+ # [1] Parse the command line options
+ #-----------------------------------------------------------
+ opt, args = p.parse_args()
+ if (opt.checkusage):
+ print(Usage)
+ quit()
- PkgDir = opt.pkg_dir
- OpClean = opt.operation_clean
- OpMake = opt.operation_make
- DMGSerialNum = int(opt.dmg_serial)
- UnsafePkg = opt.unsafe
+ PkgDir = opt.pkg_dir
+ OpClean = opt.operation_clean
+ OpMake = opt.operation_make
+ DMGSerialNum = int(opt.dmg_serial)
+ UnsafePkg = opt.unsafe
- if not opt.bundle_name == "":
- base, ext = os.path.splitext( os.path.basename(opt.bundle_name) )
- BundleName = base + ".app"
- else:
- BundleName = DefaultBundleName
+ if not opt.bundle_name == "":
+ base, ext = os.path.splitext( os.path.basename(opt.bundle_name) )
+ BundleName = base + ".app"
+ else:
+ BundleName = DefaultBundleName
- if (OpClean and OpMake) or (not OpClean and not OpMake):
- print( "! Specify <-c|--clean> OR <-m|--make>", file=sys.stderr )
- print(Usage)
- quit()
+ if (OpClean and OpMake) or (not OpClean and not OpMake):
+ print( "! Specify <-c|--clean> OR <-m|--make>", file=sys.stderr )
+ print(Usage)
+ quit()
- #------------------------------------------------------------------------------------
- # [2] Check the PKG directory to set QtIdentification, RubyPythonID, and BundleName
- #------------------------------------------------------------------------------------
- OccupiedDS = CheckPkgDirectory()
- if not 0 < OccupiedDS and not UnsafePkg:
- print( "! Failed to check the PKG directory" )
- print( "" )
- quit()
+ #------------------------------------------------------------------------------------
+ # [2] Check the PKG directory to set QtIdentification, RubyPythonID, and BundleName
+ #------------------------------------------------------------------------------------
+ OccupiedDS = CheckPkgDirectory()
+ if not 0 < OccupiedDS and not UnsafePkg:
+ print( "! Failed to check the PKG directory" )
+ print( "" )
+ quit()
- if opt.target_dmg != "":
- TargetDMG = opt.target_dmg
- else:
- TargetDMG = "%s-klayout-%s-%s-%s-%d-%s-%s.dmg" \
- % (PackagePrefix, KLVersion, GenOSName, Platform, DMGSerialNum, QtIdentification, RubyPythonID)
- return
+ if opt.target_dmg != "":
+ TargetDMG = opt.target_dmg
+ else:
+ TargetDMG = "%s-klayout-%s-%s-%s-%d-%s-%s.dmg" \
+ % (PackagePrefix, KLVersion, GenOSName, Platform, DMGSerialNum, QtIdentification, RubyPythonID)
+ return
#------------------------------------------------------------------------------
## Make the target DMG file
@@ -454,221 +457,221 @@ def ParseCommandLineArguments():
# @return True on success; False on failure
#------------------------------------------------------------------------------
def MakeTargetDMGFile(msg=""):
- #-----------------------------------------------------------------------
- # The work DMG is mounted like:
- # /dev/disk6s1 248Mi 228Mi 20Mi 93% 58449 5027 92% /Volumes/KLayout
- #-----------------------------------------------------------------------
- global MountDir # the mount directory: eg. /Volumes/KLayout
- global FileSys # the file system : eg. /dev/disk6s1
+ #-----------------------------------------------------------------------
+ # The work DMG is mounted like:
+ # /dev/disk6s1 248Mi 228Mi 20Mi 93% 58449 5027 92% /Volumes/KLayout
+ #-----------------------------------------------------------------------
+ global MountDir # the mount directory: eg. /Volumes/KLayout
+ global FileSys # the file system : eg. /dev/disk6s1
- #-------------------------------------------------------------
- # [1] Print message
- #-------------------------------------------------------------
- if not msg == "":
- print(msg)
+ #-------------------------------------------------------------
+ # [1] Print message
+ #-------------------------------------------------------------
+ if not msg == "":
+ print(msg)
- #-------------------------------------------------------------
- # [2] Do the following jobs (0) through (14) sequentially
- #-------------------------------------------------------------
+ #-------------------------------------------------------------
+ # [2] Do the following jobs (0) through (14) sequentially
+ #-------------------------------------------------------------
- #--------------------------------------------------------
- # (0) Cleanup ProjectDir/
- #--------------------------------------------------------
- CleanUp()
+ #--------------------------------------------------------
+ # (0) Cleanup ProjectDir/
+ #--------------------------------------------------------
+ CleanUp()
- #--------------------------------------------------------
- # (1) Read the AppleScript template file and generate
- # the actual one to execute later
- #--------------------------------------------------------
- os.chdir(ProjectDir)
- print( ">>> (1) Preparing AppleScript to execute later..." )
- tempScr = "macbuild/Resources/template-KLayoutDMG.applescript"
- try:
- fd = open( tempScr, "r" )
- tmpl = fd.read()
- fd.close()
- except Exception as e:
- print( " ! Failed to read <%s>" % tempScr, file=sys.stderr )
- return False
- else:
- t = string.Template(tmpl)
- # Figures below were determined by experiments for best fit
- applescript = t.safe_substitute(
- ORGX='50', ORGY='100',
- WIN_WIDTH='1000', WIN_HEIGHT='500',
- FULL_PATH_DS_STORE='/Volumes/%s/.DS_Store' % VolumeDMG,
- BACKGROUND_PNG_FILE=BackgroundPNG,
- ITEM_1='%s' % BundleName, X1='900', Y1='165',
- ITEM_2='Applications', X2='900', Y2='345',
- ITEM_3=Item3AppleScript,
- CHECK_BASH='[ -f " & dotDSStore & " ]; echo $?'
- )
- try:
- # print(applescript)
- fd = open( AppleScriptDMG, "w" )
- fd.write(applescript)
- fd.close()
- except Exception as e:
- print( "! Failed to write <%s>" % AppleScriptDMG, file=sys.stderr )
- return False
- else:
- print( " saved <%s>" % AppleScriptDMG )
+ #--------------------------------------------------------
+ # (1) Read the AppleScript template file and generate
+ # the actual one to execute later
+ #--------------------------------------------------------
+ os.chdir(ProjectDir)
+ print( ">>> (1) Preparing AppleScript to execute later..." )
+ tempScr = "macbuild/Resources/template-KLayoutDMG.applescript"
+ try:
+ fd = open( tempScr, "r" )
+ tmpl = fd.read()
+ fd.close()
+ except Exception as e:
+ print( " ! Failed to read <%s>" % tempScr, file=sys.stderr )
+ return False
+ else:
+ t = string.Template(tmpl)
+ # Figures below were determined by experiments for best fit
+ applescript = t.safe_substitute(
+ ORGX='50', ORGY='100',
+ WIN_WIDTH='1000', WIN_HEIGHT='500',
+ FULL_PATH_DS_STORE='/Volumes/%s/.DS_Store' % VolumeDMG,
+ BACKGROUND_PNG_FILE=BackgroundPNG,
+ ITEM_1='%s' % BundleName, X1='900', Y1='165',
+ ITEM_2='Applications', X2='900', Y2='345',
+ ITEM_3=Item3AppleScript,
+ CHECK_BASH='[ -f " & dotDSStore & " ]; echo $?'
+ )
+ try:
+ # print(applescript)
+ fd = open( AppleScriptDMG, "w" )
+ fd.write(applescript)
+ fd.close()
+ except Exception as e:
+ print( "! Failed to write <%s>" % AppleScriptDMG, file=sys.stderr )
+ return False
+ else:
+ print( " saved <%s>" % AppleScriptDMG )
- #----------------------------------------------------
- # (2) Create a work disk image under ProjectDir/
- #----------------------------------------------------
- if os.path.exists(WorkDMG):
- os.remove(WorkDMG)
- dmgsize = OccupiedDS + 20 # approx. occupied size plus 20[MB]
- cmdline = 'hdiutil create -srcfolder %s -volname %s -fs HFS+ -fsargs "-c c=64,a=16,e=16" '
- cmdline += '-format UDRW -size %dm %s'
- command = cmdline % (PkgDir, VolumeDMG, dmgsize, WorkDMG)
- print( ">>> (2) Creating a work DMG file <%s> of <%d> [MB] with the volume name of <%s>..." % (WorkDMG, dmgsize, VolumeDMG) )
- os.system(command)
- MountDir = "/Volumes/%s" % VolumeDMG
+ #----------------------------------------------------
+ # (2) Create a work disk image under ProjectDir/
+ #----------------------------------------------------
+ if os.path.exists(WorkDMG):
+ os.remove(WorkDMG)
+ dmgsize = OccupiedDS + 20 # approx. occupied size plus 20[MB]
+ cmdline = 'hdiutil create -srcfolder %s -volname %s -fs HFS+ -fsargs "-c c=64,a=16,e=16" '
+ cmdline += '-format UDRW -size %dm %s'
+ command = cmdline % (PkgDir, VolumeDMG, dmgsize, WorkDMG)
+ print( ">>> (2) Creating a work DMG file <%s> of <%d> [MB] with the volume name of <%s>..." % (WorkDMG, dmgsize, VolumeDMG) )
+ os.system(command)
+ MountDir = "/Volumes/%s" % VolumeDMG
- #--------------------------------------------------------
- # (3) Check if the mount point 'MountDir' already exists.
- # If so, unmount it first.
- #--------------------------------------------------------
- command1 = "hdiutil info | grep %s | grep \"/dev/\" | awk '{print $1}'" % VolumeDMG
- print ( ">>> (3) Checking if the mount point <%s> already exists..." % MountDir)
- FileSys = os.popen(command1).read().strip('\n')
- if os.path.isdir(MountDir) and not FileSys == "":
- command2 = "hdiutil detach %s" % FileSys
+ #--------------------------------------------------------
+ # (3) Check if the mount point 'MountDir' already exists.
+ # If so, unmount it first.
+ #--------------------------------------------------------
+ command1 = "hdiutil info | grep %s | grep \"/dev/\" | awk '{print $1}'" % VolumeDMG
+ print ( ">>> (3) Checking if the mount point <%s> already exists..." % MountDir)
+ FileSys = os.popen(command1).read().strip('\n')
+ if os.path.isdir(MountDir) and not FileSys == "":
+ command2 = "hdiutil detach %s" % FileSys
+ os.system(command2)
+ print( " Mount directory <%s> was detached" % MountDir )
+ else:
+ print( " Mount directory <%s> does not exist; nothing to do" % MountDir )
+
+ #--------------------------------------------------------
+ # (4) Mount the DMG
+ #--------------------------------------------------------
+ print( ">>> (4) Mounting <%s> to <%s>" % (WorkDMG, MountDir ) )
+ command1 = "hdiutil attach %s -readwrite -noverify -quiet -noautoopen" % WorkDMG
+ os.system(command1)
+
+ command2 = "hdiutil info | grep %s | grep \"/dev/\" | awk '{print $1}'" % VolumeDMG
+ FileSys = os.popen(command2).read().strip('\n')
+ if FileSys == "":
+ print( "! Failed to identify the file system on which <%s> is mounted" % VolumeDMG )
+ return False
+ else:
+ print( " File System = %s" % FileSys )
+
+ #--------------------------------------------------------
+ # (5) Copy the background image
+ #--------------------------------------------------------
+ print( ">>> (5) Copying the background image..." )
+ imageSrc = "macbuild/Resources/%s" % BackgroundPNG
+ imageDest = "%s/.background" % MountDir
+ if not os.path.isdir(imageDest):
+ os.mkdir(imageDest)
+ command = "\cp -p %s %s/%s" % (imageSrc, imageDest, BackgroundPNG)
+ os.system(command)
+
+ #--------------------------------------------------------
+ # (6) Create a symbolic link to /Applications
+ #--------------------------------------------------------
+ print( ">>> (6) Creating a symbolic link to /Applications..." )
+ command = "\ln -s %s %s/%s" % (RootApplications, MountDir, RootApplications)
+ os.system(command)
+
+ #--------------------------------------------------------
+ # (7) Run the AppleScript
+ #--------------------------------------------------------
+ print( ">>> (7) Running the AppleScript..." )
+ command = "/usr/bin/osascript %s %s" % (AppleScriptDMG, VolumeDMG)
+ process = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True )
+ output, error = process.communicate()
+ if not output == "":
+ print( " STDOUT: %s" % output )
+ if not error == "":
+ print( " STDERR: %s" % error )
+
+ #--------------------------------------------------------
+ # (8) Copy the custom volume icon
+ #--------------------------------------------------------
+ sleep(4)
+ print( ">>> (8) Copying the volume icon..." )
+ iconsSrc = "macbuild/Resources/%s" % VolumeIcons
+ iconsDest = "%s/.VolumeIcon.icns" % MountDir
+ command1 = "\cp -p %s %s" % (iconsSrc, iconsDest)
+ command2 = "SetFile -c icnC %s" % iconsDest
+ os.system(command1)
+ sleep(2)
os.system(command2)
- print( " Mount directory <%s> was detached" % MountDir )
- else:
- print( " Mount directory <%s> does not exist; nothing to do" % MountDir )
+ sleep(2)
- #--------------------------------------------------------
- # (4) Mount the DMG
- #--------------------------------------------------------
- print( ">>> (4) Mounting <%s> to <%s>" % (WorkDMG, MountDir ) )
- command1 = "hdiutil attach %s -readwrite -noverify -quiet -noautoopen" % WorkDMG
- os.system(command1)
+ #--------------------------------------------------------
+ # (9) Change the permission
+ #--------------------------------------------------------
+ print( ">>> (9) Changing permission to 755..." )
+ command = "\chmod -Rf 755 %s &> /dev/null" % MountDir
+ os.system(command)
- command2 = "hdiutil info | grep %s | grep \"/dev/\" | awk '{print $1}'" % VolumeDMG
- FileSys = os.popen(command2).read().strip('\n')
- if FileSys == "":
- print( "! Failed to identify the file system on which <%s> is mounted" % VolumeDMG )
- return False
- else:
- print( " File System = %s" % FileSys )
+ #--------------------------------------------------------
+ # (10) Set volume bootability and startup disk options.
+ # The folder will open on mount.
+ #--------------------------------------------------------
+ print( ">>> (10) Setting volume bootability and startup disk options..." )
+ command = "bless --folder %s --openfolder %s" % (MountDir, MountDir)
+ os.system(command)
+ sleep(2)
- #--------------------------------------------------------
- # (5) Copy the background image
- #--------------------------------------------------------
- print( ">>> (5) Copying the background image..." )
- imageSrc = "macbuild/Resources/%s" % BackgroundPNG
- imageDest = "%s/.background" % MountDir
- if not os.path.isdir(imageDest):
- os.mkdir(imageDest)
- command = "\cp -p %s %s/%s" % (imageSrc, imageDest, BackgroundPNG)
- os.system(command)
+ #--------------------------------------------------------
+ # (11) Set attributes of files and directories
+ #--------------------------------------------------------
+ print( ">>> (11) Setting attributes of files and directories..." )
+ command = "SetFile -a C %s" % MountDir # Custom icon (allowed on folders)
+ os.system(command)
+ sleep(2)
- #--------------------------------------------------------
- # (6) Create a symbolic link to /Applications
- #--------------------------------------------------------
- print( ">>> (6) Creating a symbolic link to /Applications..." )
- command = "\ln -s %s %s/%s" % (RootApplications, MountDir, RootApplications)
- os.system(command)
+ #--------------------------------------------------------
+ # (12) Unmount the disk image
+ #--------------------------------------------------------
+ print( ">>> (12) Unmounting the disk image..." )
+ command = "hdiutil detach %s" % FileSys
+ os.system(command)
- #--------------------------------------------------------
- # (7) Run the AppleScript
- #--------------------------------------------------------
- print( ">>> (7) Running the AppleScript..." )
- command = "/usr/bin/osascript %s %s" % (AppleScriptDMG, VolumeDMG)
- process = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True )
- output, error = process.communicate()
- if not output == "":
- print( " STDOUT: %s" % output )
- if not error == "":
- print( " STDERR: %s" % error )
+ #--------------------------------------------------------
+ # (13) Compress the disk image
+ #--------------------------------------------------------
+ print( "" )
+ print( ">>> (13) Compressing the disk image..." )
+ command = "hdiutil convert %s -format UDZO -imagekey zlib-level=9 -o %s" % (WorkDMG, TargetDMG)
+ os.system(command)
+ os.remove(WorkDMG)
+ print( "" )
+ print( " generated compressed target DMG <%s>" % TargetDMG )
- #--------------------------------------------------------
- # (8) Copy the custom volume icon
- #--------------------------------------------------------
- sleep(4)
- print( ">>> (8) Copying the volume icon..." )
- iconsSrc = "macbuild/Resources/%s" % VolumeIcons
- iconsDest = "%s/.VolumeIcon.icns" % MountDir
- command1 = "\cp -p %s %s" % (iconsSrc, iconsDest)
- command2 = "SetFile -c icnC %s" % iconsDest
- os.system(command1)
- sleep(2)
- os.system(command2)
- sleep(2)
+ #--------------------------------------------------------
+ # (14) Compute MD5 checksum
+ #--------------------------------------------------------
+ print( "" )
+ print( ">>> (14) Computing MD5 checksum..." )
+ with open( TargetDMG, "rb" ) as f:
+ data = f.read()
+ md5 = hashlib.md5(data).hexdigest()
+ md5 += " *%s\n" % TargetDMG
+ f.close()
+ path, ext = os.path.splitext( os.path.basename(TargetDMG) )
+ md5TargetDMG = path + ".dmg.md5"
+ with open( md5TargetDMG, "w" ) as f:
+ f.write(md5)
+ f.close()
+ print( " generated MD5 checksum file <%s>" % md5TargetDMG )
+ print( "" )
- #--------------------------------------------------------
- # (9) Change the permission
- #--------------------------------------------------------
- print( ">>> (9) Changing permission to 755..." )
- command = "\chmod -Rf 755 %s &> /dev/null" % MountDir
- os.system(command)
+ #-------------------------------------------------------------------------
+ # [3] Rename back the application bundle to the default name if required
+ #-------------------------------------------------------------------------
+ if BundleName != "" and BundleName != DefaultBundleName:
+ dirPresent = "%s/%s" % (PkgDir, BundleName)
+ dirDefault = "%s/%s" % (PkgDir, DefaultBundleName)
+ os.rename( dirPresent, dirDefault )
- #--------------------------------------------------------
- # (10) Set volume bootability and startup disk options.
- # The folder will open on mount.
- #--------------------------------------------------------
- print( ">>> (10) Setting volume bootability and startup disk options..." )
- command = "bless --folder %s --openfolder %s" % (MountDir, MountDir)
- os.system(command)
- sleep(2)
-
- #--------------------------------------------------------
- # (11) Set attributes of files and directories
- #--------------------------------------------------------
- print( ">>> (11) Setting attributes of files and directories..." )
- command = "SetFile -a C %s" % MountDir # Custom icon (allowed on folders)
- os.system(command)
- sleep(2)
-
- #--------------------------------------------------------
- # (12) Unmount the disk image
- #--------------------------------------------------------
- print( ">>> (12) Unmounting the disk image..." )
- command = "hdiutil detach %s" % FileSys
- os.system(command)
-
- #--------------------------------------------------------
- # (13) Compress the disk image
- #--------------------------------------------------------
- print( "" )
- print( ">>> (13) Compressing the disk image..." )
- command = "hdiutil convert %s -format UDZO -imagekey zlib-level=9 -o %s" % (WorkDMG, TargetDMG)
- os.system(command)
- os.remove(WorkDMG)
- print( "" )
- print( " generated compressed target DMG <%s>" % TargetDMG )
-
- #--------------------------------------------------------
- # (14) Compute MD5 checksum
- #--------------------------------------------------------
- print( "" )
- print( ">>> (14) Computing MD5 checksum..." )
- with open( TargetDMG, "rb" ) as f:
- data = f.read()
- md5 = hashlib.md5(data).hexdigest()
- md5 += " *%s\n" % TargetDMG
- f.close()
- path, ext = os.path.splitext( os.path.basename(TargetDMG) )
- md5TargetDMG = path + ".dmg.md5"
- with open( md5TargetDMG, "w" ) as f:
- f.write(md5)
- f.close()
- print( " generated MD5 checksum file <%s>" % md5TargetDMG )
- print( "" )
-
- #-------------------------------------------------------------------------
- # [3] Rename back the application bundle to the default name if required
- #-------------------------------------------------------------------------
- if BundleName != "" and BundleName != DefaultBundleName:
- dirPresent = "%s/%s" % (PkgDir, BundleName)
- dirDefault = "%s/%s" % (PkgDir, DefaultBundleName)
- os.rename( dirPresent, dirDefault )
-
- return True
+ return True
#------------------------------------------------------------------------------
## Clean up
@@ -678,55 +681,55 @@ def MakeTargetDMGFile(msg=""):
#------------------------------------------------------------------------------
def CleanUp(msg=""):
- #----------------------------------------------------
- # [1] Print message
- #----------------------------------------------------
- if not msg == "":
- print(msg)
+ #----------------------------------------------------
+ # [1] Print message
+ #----------------------------------------------------
+ if not msg == "":
+ print(msg)
- #----------------------------------------------------
- # [2] Clean up *.dmg*
- #----------------------------------------------------
- os.chdir(ProjectDir)
- dmgs = glob.glob( "*.dmg*" )
- for item in dmgs:
- print("Removing %s" % item)
- os.system( "rm -Rf -- \"%s\"" % item )
+ #----------------------------------------------------
+ # [2] Clean up *.dmg*
+ #----------------------------------------------------
+ os.chdir(ProjectDir)
+ dmgs = glob.glob( "*.dmg*" )
+ for item in dmgs:
+ print("Removing %s" % item)
+ os.system( "rm -Rf -- \"%s\"" % item )
- #----------------------------------------------------
- # [3] Clean up AppleScript if any
- #----------------------------------------------------
- if os.path.exists(AppleScriptDMG) and os.path.isfile(AppleScriptDMG):
- os.remove(AppleScriptDMG)
+ #----------------------------------------------------
+ # [3] Clean up AppleScript if any
+ #----------------------------------------------------
+ if os.path.exists(AppleScriptDMG) and os.path.isfile(AppleScriptDMG):
+ os.remove(AppleScriptDMG)
#------------------------------------------------------------------------------
## The main function
#------------------------------------------------------------------------------
def Main():
- SetGlobals()
- ParseCommandLineArguments()
- if OpMake:
- print( "" )
- print( " ### You are going to make <%s> from <%s>" % (TargetDMG, PkgDir) )
- print( " KLayout bundles occupy about <%d> [MB] of disc space." % OccupiedDS )
- print( "" )
- ok = MakeTargetDMGFile()
- if not ok:
- print( " !!! Failed to make the target DMG <%s> ..." % TargetDMG, file=sys.stderr )
- print( "", file=sys.stderr )
+ SetGlobals()
+ ParseCommandLineArguments()
+ if OpMake:
+ print( "" )
+ print( " ### You are going to make <%s> from <%s>" % (TargetDMG, PkgDir) )
+ print( " KLayout bundles occupy about <%d> [MB] of disc space." % OccupiedDS )
+ print( "" )
+ ok = MakeTargetDMGFile()
+ if not ok:
+ print( " !!! Failed to make the target DMG <%s> ..." % TargetDMG, file=sys.stderr )
+ print( "", file=sys.stderr )
+ else:
+ print( " ### Done making the target DMG" )
+ print( "" )
else:
- print( " ### Done making the target DMG" )
- print( "" )
- else:
- print( "" )
- print( " ### You are going to clean up <%s> directory" % ProjectDir )
- CleanUp()
- print( " ### Done cleaning up" )
- print( "" )
+ print( "" )
+ print( " ### You are going to clean up <%s> directory" % ProjectDir )
+ CleanUp()
+ print( " ### Done cleaning up" )
+ print( "" )
#===================================================================================
if __name__ == "__main__":
- Main()
+ Main()
#---------------
# End of file
diff --git a/macbuild/nightyCatalina.py b/macbuild/nightyCatalina.py
index 38badd7c3..57ab7f9ef 100755
--- a/macbuild/nightyCatalina.py
+++ b/macbuild/nightyCatalina.py
@@ -6,245 +6,461 @@ import sys
import os
import shutil
import glob
-import platform
import optparse
import subprocess
-Variation = [ 'std', 'ports', 'brew', 'ana3' ]
+#------------------------------------------------------------------------------
+## To populate the build target dictionary
+#
+# @return a dictionary; key=integer, value=mnemonic
+#------------------------------------------------------------------------------
+def Get_Build_Target_Dict():
+ buildTargetDic = dict()
+ buildTargetDic[0] = 'std'
+ buildTargetDic[1] = 'ports'
+ buildTargetDic[2] = 'brew'
+ buildTargetDic[3] = 'brewHW'
+ buildTargetDic[4] = '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"
+ buildTargetDic[5] = 'brewA'
+ buildTargetDic[6] = 'brewAHW'
+ return buildTargetDic
-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
+#------------------------------------------------------------------------------
+## To get the build option dictionary
+#
+# @param[in] targetDic build target dictionary
+#
+# @return a dictionary; key=mnemonic, value=build option list
+#------------------------------------------------------------------------------
+def Get_Build_Options( targetDic ):
+ buildOp = dict()
+ for key in targetDic.keys():
+ target = targetDic[key]
+ if target == "std": # use 'Qt5Brew' that provides Qt 5.15.1 to run on "Big Sur", too
+ buildOp["std"] = [ '-q', 'Qt5Brew', '-r', 'sys', '-p', 'sys' ]
+ elif target == "ports":
+ buildOp["ports"] = [ '-q', 'Qt5MacPorts', '-r', 'MP27', '-p', 'MP38' ]
+ elif target == "brew":
+ buildOp["brew"] = [ '-q', 'Qt5Brew', '-r', 'HB27', '-p', 'HB38' ]
+ elif target == "brewHW":
+ buildOp["brewHW"] = [ '-q', 'Qt5Brew', '-r', 'sys', '-p', 'HB38' ]
+ elif target == "ana3":
+ buildOp["ana3"] = [ '-q', 'Qt5Ana3', '-r', 'Ana3', '-p', 'Ana3' ]
+ elif target == "brewA":
+ buildOp["brewA"] = [ '-q', 'Qt5Brew', '-r', 'HB27', '-p', 'HBAuto' ]
+ elif target == "brewAHW":
+ buildOp["brewAHW"] = [ '-q', 'Qt5Brew', '-r', 'sys', '-p', 'HBAuto' ]
+ return buildOp
- p = optparse.OptionParser( usage=Usage )
- p.add_option( '--build',
- action='store_true',
- dest='build',
- default=False,
- help='build and deploy' )
+#------------------------------------------------------------------------------
+## To get the ".macQAT" dictionary for QA Test
+#
+# @param[in] targetDic build target dictionary
+#
+# @return a dictionary; key=mnemonic, value=".macQAT" directory
+#------------------------------------------------------------------------------
+def Get_QAT_Directory( targetDic ):
+ dirQAT = dict()
+ for key in targetDic.keys():
+ target = targetDic[key]
+ if target == "std":
+ dirQAT["std"] = 'qt5Brew.build.macos-Catalina-release-RsysPsys.macQAT'
+ elif target == "ports":
+ dirQAT["ports"] = 'qt5MP.build.macos-Catalina-release-Rmp27Pmp38.macQAT'
+ elif target == "brew":
+ dirQAT["brew"] = 'qt5Brew.build.macos-Catalina-release-Rhb27Phb38.macQAT'
+ elif target == "brewHW":
+ dirQAT["brewHW"] = 'qt5Brew.build.macos-Catalina-release-RsysPhb38.macQAT'
+ elif target == "ana3":
+ dirQAT["ana3"] = 'qt5Ana3.build.macos-Catalina-release-Rana3Pana3.macQAT'
+ elif target == "brewA":
+ dirQAT["brewA"] = 'qt5Brew.build.macos-Catalina-release-Rhb27Phbauto.macQAT'
+ elif target == "brewAHW":
+ dirQAT["brewAHW"] = 'qt5Brew.build.macos-Catalina-release-RsysPhbauto.macQAT'
+ return dirQAT
- p.add_option( '--makedmg',
- dest='makedmg',
- help='make DMG' )
+#------------------------------------------------------------------------------
+## To get the build option dictionary for making/cleaning DMG
+#
+# @param[in] targetDic build target dictionary
+# @param[in] srlDMG serial number of DMG
+# @param[in] makeflag True to make; False to clean
+#
+# @return a dictionary; key=mnemonic, value=build option list
+#------------------------------------------------------------------------------
+def Get_Package_Options( targetDic, srlDMG, makeflag ):
+ if makeflag:
+ flag = '-m'
+ else:
+ flag = '-c'
- p.add_option( '--cleandmg',
- dest='cleandmg',
- help='clean DMG' )
+ packOp = dict()
+ for key in targetDic.keys():
+ target = targetDic[key]
+ if target == "std":
+ packOp["std"] = [ '-p', 'ST-qt5Brew.pkg.macos-Catalina-release-RsysPsys', '-s', '%d' % srlDMG, '%s' % flag ]
+ elif target == "ports":
+ packOp["ports"] = [ '-p', 'LW-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38', '-s', '%d' % srlDMG, '%s' % flag ]
+ elif target == "brew":
+ packOp["brew"] = [ '-p', 'LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38', '-s', '%d' % srlDMG, '%s' % flag ]
+ elif target == "brewHW":
+ packOp["brewHW"] = [ '-p', 'HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb38', '-s', '%d' % srlDMG, '%s' % flag ]
+ elif target == "ana3":
+ packOp["ana3"] = [ '-p', 'LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3', '-s', '%d' % srlDMG, '%s' % flag ]
+ elif target == "brewA":
+ packOp["brewA"] = [ '-p', 'LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phbauto', '-s', '%d' % srlDMG, '%s' % flag ]
+ elif target == "brewAHW":
+ packOp["brewAHW"] = [ '-p', 'HW-qt5Brew.pkg.macos-Catalina-release-RsysPhbauto', '-s', '%d' % srlDMG, '%s' % flag ]
+ return packOp
- p.add_option( '--upload',
- dest='upload',
- help='upload to Dropbox' )
+#------------------------------------------------------------------------------
+## To parse the command line arguments
+#------------------------------------------------------------------------------
+def Parse_CommandLine_Arguments():
+ global Usage # usage
+ global Target # target list
+ global Build # operation flag
+ global QATest # operation flag
+ global QACheck # operation flag
+ global MakeDMG # operation flag
+ global CleanDMG # operation flag
+ global Upload # operation flag
+ global SrlDMG # DMG serial number
+ global Dropbox # Dropbox directory
- p.add_option( '-?', '--??',
- action='store_true',
- dest='checkusage',
- default=False,
- help='check usage (false)' )
+ 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 += " [--target ] : 0='std', 1='ports', 2='brew', 3='brewHW', 4='ana3', | '0,1,2,3,4'\n"
+ Usage += " 5='brewA', 6='brewAHW' | \n"
+ Usage += " [--build] : build and deploy | disabled\n"
+ Usage += " [--test] : run the QA Test | disabled\n"
+ Usage += " [--check] : check the QA Test results | disabled\n"
+ Usage += " [--makedmg|--cleandmg ] : make or clean DMGs | disabled\n"
+ Usage += " [--upload ] : upload DMGs to $HOME/Dropbox/klayout/ | disabled\n"
+ Usage += " [-?|--?] : print this usage and exit | disabled\n"
+ Usage += " | \n"
+ Usage += " Standard sequence for using this script: | \n"
+ Usage += " (1) $ ./nightyCatalina.py --build | \n"
+ Usage += " (2) (confirm the build results) | \n"
+ Usage += " (3) $ ./nightyCatalina.py --test | \n"
+ Usage += " (4) $ ./nightyCatalina.py --check (confirm the QA Test results) | \n"
+ Usage += " (5) $ ./nightyCatalina.py --makedmg 1 | \n"
+ Usage += " (6) $ ./nightyCatalina.py --upload '0.26.9' | \n"
+ Usage += " (7) $ ./nightyCatalina.py --cleandmg 1 | \n"
+ Usage += "---------------------------------------------------------------------------+----------------\n"
- p.set_defaults( build = False,
- makedmg = "",
- cleandmg = "",
- upload = "",
- checkusage = False )
+ p = optparse.OptionParser( usage=Usage )
+ p.add_option( '--target',
+ dest='targets',
+ help='build target list' )
- opt, args = p.parse_args()
- if opt.checkusage:
- print(Usage)
- quit()
+ p.add_option( '--build',
+ action='store_true',
+ dest='build',
+ default=False,
+ help='build and deploy' )
- Build = False
- MakeDMG = False
- CleanDMG = False
- Upload = False
+ p.add_option( '--test',
+ action='store_true',
+ dest='qa_test',
+ default=False,
+ help='run the QA Test' )
- Build = opt.build
+ p.add_option( '--check',
+ action='store_true',
+ dest='qa_check',
+ default=False,
+ help='check the QA Test results' )
- if not opt.makedmg == "":
- MakeDMG = True
- CleanDMG = False
- SrlDMG = int(opt.makedmg)
+ p.add_option( '--makedmg',
+ dest='makedmg',
+ help='make DMG' )
- if not opt.cleandmg == "":
+ 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' )
+
+ p.set_defaults( targets = "0,1,2,3,4",
+ build = False,
+ qa_test = False,
+ qa_check = False,
+ makedmg = "",
+ cleandmg = "",
+ upload = "",
+ checkusage = False )
+
+ opt, args = p.parse_args()
+ if opt.checkusage:
+ print(Usage)
+ quit()
+
+ targetDic = Get_Build_Target_Dict()
+ Target = list()
+ for idx in sorted( list( set( [ int(item) for item in opt.targets.split(",") ] ) ) ):
+ if idx in range(0, 7):
+ Target.append( targetDic[idx] )
+
+ Build = opt.build
+ QATest = opt.qa_test
+ QACheck = opt.qa_check
MakeDMG = False
- CleanDMG = True
- SrlDMG = int(opt.cleandmg)
+ CleanDMG = False
+ Upload = False
- if not opt.upload == "":
- Upload = True
- Dropbox = opt.upload
+ if not opt.makedmg == "":
+ MakeDMG = True
+ SrlDMG = int(opt.makedmg)
- if not (Build or MakeDMG or CleanDMG or Upload):
- print( "! No option selected" )
- print(Usage)
- quit()
+ if not opt.cleandmg == "":
+ CleanDMG = True
+ SrlDMG = int(opt.cleandmg)
+ if MakeDMG and CleanDMG:
+ print( "! --makedmg and --cleandmg cannot be used simultaneously" )
+ print(Usage)
+ quit()
-def BuildDeploy():
- PyBuild = "./build4mac.py"
+ if not opt.upload == "":
+ Upload = True
+ Dropbox = opt.upload
- 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' ]
+ if not (Build or QATest or QACheck or MakeDMG or CleanDMG or Upload):
+ print( "! No option selected" )
+ print(Usage)
+ quit()
- 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
+#------------------------------------------------------------------------------
+## To build and deploy
+#------------------------------------------------------------------------------
+def Build_Deploy():
+ pyBuilder = "./build4mac.py"
+ buildOp = Get_Build_Options( Get_Build_Target_Dict() )
- 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 )
+ for key in Target:
+ command1 = [ pyBuilder ] + buildOp[key]
+ if key in [ "std", "brewHW", "brewAHW" ] :
+ command2 = [ pyBuilder ] + buildOp[key] + ['-y']
+ else:
+ command2 = [ pyBuilder ] + buildOp[key] + ['-Y']
+ print(command1)
+ print(command2)
+ #continue
- 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 )
+ if subprocess.call( command1, shell=False ) != 0:
+ print( "", file=sys.stderr )
+ print( "-----------------------------------------------------------------", file=sys.stderr )
+ print( "!!! <%s>: failed to build KLayout" % pyBuilder, 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" % pyBuilder, 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" % pyBuilder, 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" % pyBuilder, file=sys.stderr )
+ print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr )
+ print( "", file=sys.stderr )
+#------------------------------------------------------------------------------
+## To run the QA tests
+#
+# @param[in] exclude test to exclude such as 'pymod,pya'
+#------------------------------------------------------------------------------
+def Run_QATest( exclude ):
+ pyRunnerQAT = "./macQAT.py"
+ dirQAT = Get_QAT_Directory( Get_Build_Target_Dict() )
+
+ for key in Target:
+ command1 = [ pyRunnerQAT ] + [ '--run', '--exclude', '%s' % exclude ]
+ print( dirQAT[key], command1 )
+ #continue
+ os.chdir( dirQAT[key] )
+
+ if subprocess.call( command1, shell=False ) != 0:
+ print( "", file=sys.stderr )
+ print( "-----------------------------------------------------------------", file=sys.stderr )
+ print( "!!! <%s>: failed to run the QA Test" % pyRunnerQAT, 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 ran the QA Test" % pyRunnerQAT, file=sys.stderr )
+ print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr )
+ print( "", file=sys.stderr )
+
+ os.chdir( "../" )
+
+#------------------------------------------------------------------------------
+## To check the QA test results
+#
+# @param[in] lines number of lines to dump from the tail
+#------------------------------------------------------------------------------
+def Check_QATest_Results( lines ):
+ tailCommand = "/usr/bin/tail"
+ dirQAT = Get_QAT_Directory( Get_Build_Target_Dict() )
+
+ for key in Target:
+ os.chdir( dirQAT[key] )
+ logfile = glob.glob( "*.log" )
+ command1 = [ tailCommand ] + [ '-n', '%d' % lines ] + logfile
+ print( dirQAT[key], command1 )
+ #continue
+
+ if subprocess.call( command1, shell=False ) != 0:
+ print( "", file=sys.stderr )
+ print( "-----------------------------------------------------------------", file=sys.stderr )
+ print( "!!! <%s>: failed to check the QA Test results" % tailCommand, 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 checked the QA Test results" % tailCommand, file=sys.stderr )
+ print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr )
+ print( "", file=sys.stderr )
+
+ os.chdir( "../" )
+
+#------------------------------------------------------------------------------
+## To make DMGs
+#
+# @param[in] srlDMG DMG's serial number
+#------------------------------------------------------------------------------
def DMG_Make( srlDMG ):
- PyDMG = "./makeDMG4mac.py"
- Stash = "./DMGStash"
+ pyDMGmaker = "./makeDMG4mac.py"
+ stashDMG = "./DMGStash"
+ packOp = Get_Package_Options( Get_Build_Target_Dict(), srlDMG, makeflag=True )
- 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( stashDMG ):
+ shutil.rmtree( stashDMG )
+ os.mkdir( stashDMG )
- if os.path.isdir( Stash ):
- shutil.rmtree( Stash )
- os.mkdir( Stash )
+ for key in Target:
+ command1 = [ pyDMGmaker ] + packOp[key]
+ print(command1)
+ #continue
- 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 )
+ if subprocess.call( command1, shell=False ) != 0:
+ print( "", file=sys.stderr )
+ print( "-----------------------------------------------------------------", file=sys.stderr )
+ print( "!!! <%s>: failed to make KLayout DMG" % pyDMGmaker, 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" % pyDMGmaker, file=sys.stderr )
+ print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr )
+ print( "", file=sys.stderr )
+ dmgs = glob.glob( "*.dmg*" )
+ for item in dmgs:
+ shutil.move( item, stashDMG )
+#------------------------------------------------------------------------------
+## To clean up DMGs
+#
+# @param[in] srlDMG DMG's serial number
+#------------------------------------------------------------------------------
def DMG_Clean( srlDMG ):
- PyDMG = "./makeDMG4mac.py"
- Stash = "./DMGStash"
+ pyDMGmaker = "./makeDMG4mac.py"
+ stashDMG = "./DMGStash"
+ packOp = Get_Package_Options( Get_Build_Target_Dict(), srlDMG, makeflag=False )
- 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( stashDMG ):
+ shutil.rmtree( stashDMG )
- if os.path.isdir( Stash ):
- shutil.rmtree( Stash )
+ for key in Target:
+ command1 = [ pyDMGmaker ] + packOp[key]
+ print(command1)
+ #continue
- for key in Variation:
- command3 = [ PyDMG ] + Pack[key]
- print(command3)
- #continue
+ if subprocess.call( command1, shell=False ) != 0:
+ print( "", file=sys.stderr )
+ print( "-----------------------------------------------------------------", file=sys.stderr )
+ print( "!!! <%s>: failed to clean KLayout DMG" % pyDMGmaker, 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" % pyDMGmaker, file=sys.stderr )
+ print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", file=sys.stderr )
+ print( "", file=sys.stderr )
- 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 )
+#------------------------------------------------------------------------------
+## To upload DMGs to Dropbox
+#
+# @param[in] targetdir existing target directory such as "0.26.9"
+#------------------------------------------------------------------------------
+def Upload_To_Dropbox( targetdir ):
+ stashDMG = "./DMGStash"
+ distDir = os.environ["HOME"] + "/Dropbox/klayout/" + targetdir
+ if not os.path.isdir(distDir):
+ os.makedirs(distDir)
-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 )
-
+ dmgs = glob.glob( "%s/*.dmg*" % stashDMG )
+ for item in dmgs:
+ shutil.copy2( item, distDir )
+#------------------------------------------------------------------------------
+## The main function
+#------------------------------------------------------------------------------
def Main():
- ParseCommandLineArguments()
+ Parse_CommandLine_Arguments()
- if Build:
- BuildDeploy()
- elif MakeDMG:
- DMG_Make( SrlDMG )
- elif CleanDMG:
- DMG_Clean( SrlDMG )
- elif Upload:
- UploadToDropbox( Dropbox )
+ if Build:
+ Build_Deploy()
+ if QATest:
+ Run_QATest( 'pymod,pya' )
+ if QACheck:
+ Check_QATest_Results( 20 )
+ elif MakeDMG:
+ DMG_Make( SrlDMG )
+ elif Upload:
+ Upload_To_Dropbox( Dropbox )
+ elif CleanDMG:
+ DMG_Clean( SrlDMG )
#===================================================================================
if __name__ == "__main__":
- Main()
+ Main()
#---------------
# End of file