Overhauled the build system for MacOS ['Monterey', 'Ventura', 'Sonoma'] to build KLayout-0.28.13 or later with support for libgit2.

This commit is contained in:
Kazunari Sekigawa 2023-11-23 15:13:41 +09:00
parent 5961eab84b
commit 267a5ee7b0
22 changed files with 828 additions and 976 deletions

View File

@ -1,39 +1,37 @@
Relevant KLayout version: 0.28.6<br> Relevant KLayout version: 0.28.13<br>
Author: Kazzz-S<br> Author: Kazzz-S<br>
Last modified: 2023-03-19<br> Last modified: 2023-11-11<br>
# 1. Introduction # 1. Introduction
This directory **`macbuild`** contains various files required for building KLayout (http://www.klayout.de/) version 0.28.6 or later for different 64-bit macOS, including: This directory **`macbuild`** contains various files required for building KLayout (http://www.klayout.de/) version 0.28.13 or later for different 64-bit macOS, including:
* Catalina (10.15.7) : the primary development environment * Monterey (12.x) : the primary development environment
* Big Sur (11.x) : experimental; Apple (M1|M2) chip is not tested since the author does not own an (M1|M2) Mac * Ventura (13.x) : experimental
* Monterey (12.x) : -- ditto -- * Sonoma (14.x) : -- ditto --
* Ventura (13.x) : -- ditto --
Building KLayout for the previous operating systems listed below should still be possible. <br> Building KLayout for the previous operating systems listed below has been discontinued.<br>
However, they are not actively supported, and DMG packages are not provided. Pre-built DMG packages are also not provided.
* Big Sur (11.7.10)
* Catalina (10.15.7)
* Mojave (10.14) * Mojave (10.14)
* High Sierra (10.13) * High Sierra (10.13)
* Sierra (10.12) * Sierra (10.12)
* El Capitan (10.11) * El Capitan (10.11)
Throughout this document, the primary target machine is **Intel x86_64** with **macOS Catalina**.<br> Throughout this document, the primary target machine is **Intel x86_64** with **macOS Monterey**.<br>
A **((Notes))** marker indicates special notes for specific operating systems. All Apple (M1|M2|M3) chips are still untested, as the author does not own an (M1|M2|M3) Mac.<br>
# 2. Qt Frameworks # 2. Qt Frameworks
**((Notes))** For **Catalina**
The default Qt framework is "Qt5" from MacPorts (https://www.macports.org/), which is usually located under:
```
/opt/local/libexec/qt5/
```
**((Notes))** For **Big Sur**, **Monterey**, and **Ventura**
The default Qt framework is "Qt5" from Homebrew (https://brew.sh/), which is usually located under: The default Qt framework is "Qt5" from Homebrew (https://brew.sh/), which is usually located under:
``` ```
/usr/local/opt/qt@5/ /usr/local/opt/qt@5/
``` ```
If you prefer **MacPorts** (https://www.macports.org/), "Qt5" is usually located under:
```
/opt/local/libexec/qt5/
```
You can also choose "Qt5" from Anaconda3 (https://www.anaconda.com/), which is usually located under: You can also choose "Qt5" from Anaconda3 (https://www.anaconda.com/), which is usually located under:
``` ```
$HOME/opt/anaconda3/pkgs/qt-{version} $HOME/opt/anaconda3/pkgs/qt-{version}
@ -46,91 +44,26 @@ If you have installed Anaconda3 under $HOME/opt/anaconda3/, make a symbolic link
The migration work to "Qt6" is ongoing. You can try to use it; however, you will encounter some build and runtime errors. The migration work to "Qt6" is ongoing. You can try to use it; however, you will encounter some build and runtime errors.
# 3. Script language support: Ruby and Python # 3. Script language support: Ruby and Python
Earlier, by default, supported script languages, i.e., Ruby and Python, were those standard ones bundled with the OS.<br>
```
$ /usr/bin/ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
$ /usr/bin/python --version The build script **`build4mac.py`** provides several possible combinations of Qt5, Ruby, and Python modules to suit the user's needs and preferences.<br>
Python 2.7.16
```
Note that this configuration for backward compatibility is possible only for macOS Catalina (10.15.7).<br>
In contrast, Homebrew's Ruby 3.2 and Python 3.9 are the default environment for Big Sur, Monterey, and Ventura.<br>
Since Python 2.7 is already deprecated, using MacPorts' or Homebrew's Ruby 3.2 and Python 3.9 are also recommended for Catalina.
The build script **`build4mac.py`** provides several possible combinations of Qt5, Ruy, and Python modules to accommodate such a slightly complex environment.<br>
Some typical use cases are described in Section 6. Some typical use cases are described in Section 6.
# 4. Prerequisites # 4. Prerequisites
You need to have the followings: You need to have the followings:
* The latest Xcode and command-line tool kit compliant with each OS * The latest Xcode and command-line tool kit compliant with each OS
* Qt5 package from MacPorts, Homebrew, or Anaconda3 * Qt5 package from Homebrew, MacPorts, or Anaconda3
* Optionally, Ruby and Python packages from MacPorts, Homebrew, or Anaconda3 * Optionally, Ruby and Python packages from Homebrew, MacPorts, or Anaconda3
#### For matching versions of Ruby and Python, please also refer to `build4mac_env.py`. #### For matching versions of Ruby and Python, please also refer to `build4mac_env.py`.
# 5. Command-line options of **`build4mac.py`** # 5. Command-line options of **`build4mac.py`**
**((Notes))** For **Catalina**
**`build4mac.py`** is the top level Python script for for building KLayout for a macOS.
The operating system type is detected automatically.
``` ```
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >> << Usage of 'build4mac.py' >>
for building KLayout 0.28.6 or later on different Apple macOS / Mac OSX platforms. for building KLayout 0.28.13 or later on different Apple macOS platforms.
$ [python] ./build4mac.py
option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value
--------------------------------------------------------------------------------------+---------------
[-q|--qt <type>] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3', | qt5macports
: 'Qt6MacPorts', 'Qt6Brew'] |
: Qt5MacPorts: use Qt5 from MacPorts |
: Qt5Brew: use Qt5 from Homebrew |
: Qt5Ana3: use Qt5 from Anaconda3 |
: Qt6MacPorts: use Qt6 from MacPorts (*) |
: Qt6Brew: use Qt6 from Homebrew (*) |
: (*) migration to Qt6 is ongoing |
[-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP31', 'HB31', 'Ana3', | sys
: 'MP32', HB32'] |
: nil: don't bind Ruby |
: Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS |
: MP31: use Ruby 3.1 from MacPorts |
: HB31: use Ruby 3.1 from Homebrew |
: Ana3: use Ruby 3.1 from Anaconda3 |
: MP32: use Ruby 3.2 from MacPorts |
: HB32: use Ruby 3.2 from Homebrew |
[-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | sys
: 'MP39', HB39', 'HBAuto'] |
: nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 up to Catalina |
: MP38: use Python 3.8 from MacPorts |
: HB38: use Python 3.8 from Homebrew |
: Ana3: use Python 3.9 from Anaconda3 |
: MP39: use Python 3.9 from MacPorts |
: HB39: use Python 3.9 from Homebrew |
: HBAuto: use the latest Python 3.x auto-detected from Homebrew |
[-P|--buildPymod] : build and deploy Pymod (*.whl and *.egg) for LW-*.dmg | disabled
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
[-m|--make <option>] : option passed to 'make' | '--jobs=4'
[-d|--debug] : enable debug mode build | 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 |
: ! After confirmation of the successful build of 'klayout.app', |
: rerun this script with BOTH: |
: 1) the same options used for building AND |
: 2) <-y|--deploy> OR <-Y|--DEPLOY> |
: optionally with [-v|--verbose <0-3>] |
[-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1
: 0 = no output, 1 = error/warning (default), |
: 2 = normal, 3 = debug |
[-?|--?] : print this usage and exit; in zsh, quote like '-?' or '--?' | disabled
-----------------------------------------------------------------------------------------+---------------
```
**((Notes))** For **Big Sur**, **Monterey**, and **Ventura**
```
---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >>
for building KLayout 0.28.6 or later on different Apple macOS / Mac OSX platforms.
$ [python] ./build4mac.py $ [python] ./build4mac.py
option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value
@ -143,28 +76,26 @@ $ [python] ./build4mac.py
: Qt6MacPorts: use Qt6 from MacPorts (*) | : Qt6MacPorts: use Qt6 from MacPorts (*) |
: Qt6Brew: use Qt6 from Homebrew (*) | : Qt6Brew: use Qt6 from Homebrew (*) |
: (*) migration to Qt6 is ongoing | : (*) migration to Qt6 is ongoing |
[-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP31', 'HB31', 'Ana3', | hb32 [-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP32', 'HB32', 'Ana3'] | hb32
: 'MP32', HB32'] |
: nil: don't bind Ruby | : nil: don't bind Ruby |
: Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS | : Sys: use [Sonoma|Ventura|Monterey]-bundled Ruby 2.6 |
: MP31: use Ruby 3.1 from MacPorts |
: HB31: use Ruby 3.1 from Homebrew |
: Ana3: use Ruby 3.1 from Anaconda3 |
: MP32: use Ruby 3.2 from MacPorts | : MP32: use Ruby 3.2 from MacPorts |
: HB32: use Ruby 3.2 from Homebrew | : HB32: use Ruby 3.2 from Homebrew |
[-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | hb39 : Ana3: use Ruby 3.1 from Anaconda3 |
: 'MP39', HB39', 'HBAuto'] | [-p|--python <type>] : case-insensitive type=['nil', 'MP311', 'HB311', 'Ana3', | hb311
: 'MP39', 'hb311', 'HBAuto'] |
: nil: don't bind Python | : nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 up to Catalina | : MP311: use Python 3.11 from MacPorts |
: MP38: use Python 3.8 from MacPorts | : HB311: use Python 3.11 from Homebrew |
: HB38: use Python 3.8 from Homebrew | : Ana3: use Python 3.11 from Anaconda3 |
: Ana3: use Python 3.9 from Anaconda3 | : MP39: use Python 3.9 from MacPorts (+) |
: MP39: use Python 3.9 from MacPorts | : hb311: use Python 3.9 from Homebrew (+) |
: HB39: use Python 3.9 from Homebrew | : (+) for the backward compatibility tests |
: HBAuto: use the latest Python 3.x auto-detected from Homebrew | : HBAuto: use the latest Python 3.x auto-detected from Homebrew |
[-P|--buildPymod] : build and deploy Pymod (*.whl and *.egg) for LW-*.dmg | disabled [-P|--buildPymod] : build and deploy Pymod (*.whl) for LW-*.dmg | disabled
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled [-u|--noqtuitools] : don't include uitools in Qt binding | disabled
[-g|--nolibgit2] : don't include libgit2 for Git package support | disabled
[-m|--make <option>] : option passed to 'make' | '--jobs=4' [-m|--make <option>] : option passed to 'make' | '--jobs=4'
[-d|--debug] : enable debug mode build | disabled [-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
@ -184,81 +115,27 @@ $ [python] ./build4mac.py
``` ```
# 6. Use-cases # 6. Use-cases
In this section, the actual file and directory names are those obtained on macOS Catalina.<br> In this section, the actual file and directory names are those obtained on macOS Monterey.<br>
On different OS, those names differ accordingly. On different OS, those names differ accordingly.
### 6A. Standard build using the OS-bundled Ruby and Python **((Notes))** only for Catalina ### 6A. Standard build using the OS-bundled Ruby and Python with MacPorts
0. Install MacPorts, then install Qt5 by This build has been discontinued.
```
$ sudo port install coreutils
$ sudo port install findutils
$ sudo port install qt5
```
1. Invoke **`build4mac.py`** with the default options: **((Notes))** only for Catalina
```
$ 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 framework) under **`klayout.app`** bundle.<br>
The buddy command-line tools (strm*) will also be deployed in this step.
```
$ ./build4mac.py -y
```
The application bundle **`klayout.app`** is located under:<br>
**`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 the "-Y" option instead of the "-y" in Step-3, the Qt5 framework is NOT deployed in the application bundle.<br> ### 6B. Fully Homebrew-flavored build with Homebrew Ruby 3.2 and Homebrew Python 3.11
Then the directory name will be **`LW-qt5MP.pkg.macos-Catalina-release-RsysPsys`**, where 0. Install Homebrew, then install Qt5, Ruby 3.2, Python 3.11, and libgit2 by
* "LW-" means that this is a lightweight package.
#### 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 3.2 and MacPorts Python 3.9
0. Install MacPorts, then install Qt5, Ruby 3.2, and Python 3.9 by
```
$ sudo port install coreutils
$ sudo port install findutils
$ sudo port install qt5
$ sudo port install ruby32
$ sudo port install python39
$ sudo port install py39-pip
```
1. Invoke **`build4mac.py`** with the following options:
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5macports -r mp32 -p mp39
```
2. Confirm successful build (it will take about one hour, depending on your machine spec).
3. Rerun **`build4mac.py`** with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br>
The buddy command-line tools (strm*) will also be deployed under **klayout.app/Contents/Buddy/** in this step.<br>
If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl) will be built and deployed under **klayout.app/Contents/pymod-dist/**.
```
$ ./build4mac.py -q qt5macports -r mp32 -p mp39 -Y
```
The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5MP.pkg.macos-Catalina-release-Rmp32Pmp39`** directory, where
* "LW-" means this is a lightweight package.
* "qt5MP" means that Qt5 from MacPorts is used.
* "Rmp32Pmp39" means that Ruby is 3.2 from MacPorts; Python is 3.9 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 3.2 and Homebrew Python 3.9
0. Install Homebrew, then install Qt5, Ruby 3.2, and Python 3.9 by
``` ```
$ brew install qt@5 $ brew install qt@5
$ brew install ruby@3.2 $ brew install ruby@3.2
$ brew install python@3.9 $ brew install python@3.11
$ brew install libgit2
$ cd /where/'build.sh'/exists
$ cd macbuild
$ ./python3HB.py -v 3.11
``` ```
1. Invoke **`build4mac.py`** with the following options: **((Notes))** These options are the default for Big Sur, Monterey, and Ventura. 1. Invoke **`build4mac.py`** with the following options: **((Notes))** These options are the default values for Monterey, Ventura, and Sonoma.
``` ```
$ cd /where/'build.sh'/exists $ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5brew -r hb32 -p hb39 $ ./build4mac.py -q qt5brew -r hb32 -p hb311
``` ```
2. Confirm successful build (it will take about one hour, depending on your machine spec). 2. Confirm successful build (it will take about one hour, depending on your machine spec).
3. Rerun **`build4mac.py`** with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br> 3. Rerun **`build4mac.py`** with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br>
@ -266,48 +143,85 @@ $ ./build4mac.py -q qt5brew -r hb32 -p hb39
If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl) will be built and deployed under **klayout.app/Contents/pymod-dist/**. If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl) will be built and deployed under **klayout.app/Contents/pymod-dist/**.
``` ```
$ ./build4mac.py -q qt5brew -r hb32 -p hb39 -Y $ ./build4mac.py -q qt5brew -r hb32 -p hb311 -Y
``` ```
The application bundle **`klayout.app`** is located under:<br> The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5Brew.pkg.macos-Catalina-release-Rhb32Phb39`** directory, where **`LW-qt5Brew.pkg.macos-Monterey-release-Rhb32Phb311`** directory, where
* "LW-" means this is a lightweight package. * "LW-" means this is a lightweight package.
* "qt5Brew" means that Qt5 from Homebrew is used. * "qt5Brew" means that Qt5 from Homebrew is used.
* "Rhb32Phb39" means that Ruby is 3.2 from Homebrew; Python is 3.9 from Homebrew. * "Rhb32Phb311" means that Ruby is 3.2 from Homebrew; Python is 3.11 from Homebrew.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation. 4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6D. Partially Homebrew-flavored build with System Ruby and Homebrew Python 3.9 ### 6C. Partially Homebrew-flavored build with System Ruby and Homebrew Python 3.11
0. Install Homebrew, then install Qt5 and Python 3.9 by 0. Install Homebrew, then install Qt5, Python 3.11, and libgit2 by
``` ```
$ brew install qt@5 $ brew install qt@5
$ brew install python@3.9 $ brew install python@3.11
$ brew install libgit2
$ cd /where/'build.sh'/exists
$ cd macbuild
$ ./python3HB.py -v 3.11
``` ```
1. Invoke **`build4mac.py`** with the following options: 1. Invoke **`build4mac.py`** with the following options:
``` ```
$ cd /where/'build.sh'/exists $ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5brew -r sys -p hb39 $ ./build4mac.py -q qt5brew -r sys -p hb311
``` ```
2. Confirm successful build (it will take about one hour, depending on your machine spec). 2. Confirm successful build (it will take about one hour, depending on your machine spec).
3. Rerun **`build4mac.py`** with the same options used in 1. PLUS "-y" to deploy executables and libraries (including Qt and Python frameworks) under the **`klayout.app`** bundle.<br> 3. Rerun **`build4mac.py`** with the same options used in 1. PLUS "-y" to deploy executables and libraries (including Qt and Python frameworks) under the **`klayout.app`** bundle.<br>
The buddy command-line tools (strm*) will also be deployed under **klayout.app/Contents/Buddy/** in this step. The buddy command-line tools (strm*) will also be deployed under **klayout.app/Contents/Buddy/** in this step.
``` ```
$ ./build4mac.py -q qt5brew -r sys -p hb39 -y $ ./build4mac.py -q qt5brew -r sys -p hb311 -y
``` ```
The application bundle **`klayout.app`** is located under:<br> The application bundle **`klayout.app`** is located under:<br>
**`HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb39`** directory, where **`HW-qt5Brew.pkg.macos-Monterey-release-RsysPhb311`** directory, where
* "HW-" means this is a heavyweight package because both Qt5 and Python Frameworks are deployed. * "HW-" means this is a heavyweight package because both Qt5 and Python Frameworks are deployed.
* "qt5Brew" means that Qt5 from Homebrew is used. * "qt5Brew" means that Qt5 from Homebrew is used.
* "RsysPhb39" means that Ruby is OS-bundled; Python is 3.9 from Homebrew. * "RsysPhb311" means that Ruby is OS-bundled; Python is 3.11 from Homebrew.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation. 4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### Important ### Important
So far, the deployment of Homebrew Ruby is not supported. <br> So far, the deployment of Homebrew Ruby is not supported.<br>
Therefore, if you intend to use the "-y" option for deployment, you need to use the "-r sys" option for building. 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 3.1 and Anaconda3 Python 3.9 ### 6D. Fully MacPorts-flavored build with MacPorts Ruby 3.2 and MacPorts Python 3.11
0. Install Anaconda3, then install Ruby 3.1 by 0. Install MacPorts, then install Qt5, Ruby 3.2, Python 3.11, and libgit2 by
``` ```
$ conda install ruby=3.1.2 $ sudo port install coreutils
$ sudo port install findutils
$ sudo port install qt5
$ sudo port install ruby32
$ sudo port install python311
$ sudo port install py311-pip
$ sudo port install libgit2
``` ```
1. Invoke **`build4mac.py`** with the following options:
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5macports -r mp32 -p mp311
```
2. Confirm successful build (it will take about one hour, depending on your machine spec).
3. Rerun **`build4mac.py`** with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br>
The buddy command-line tools (strm*) will also be deployed under **klayout.app/Contents/Buddy/** in this step.<br>
If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl) will be built and deployed under **klayout.app/Contents/pymod-dist/**.
```
$ ./build4mac.py -q qt5macports -r mp32 -p mp311 -Y
```
The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5MP.pkg.macos-Monterey-release-Rmp32Pmp311`** directory, where
* "LW-" means this is a lightweight package.
* "qt5MP" means that Qt5 from MacPorts is used.
* "Rmp32Pmp311" means that Ruby is 3.2 from MacPorts; Python is 3.11 from MacPorts.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6E. Fully Anaconda3-flavored build with Anaconda3 Ruby 3.1 and Anaconda3 Python 3.11
0. Install Anaconda3 (Anaconda3-2023.09-0-MacOSX-x86_64.pkg), then install Ruby 3.1 and libgit2 by
```
$ conda install ruby=3.1.4
$ conda install -c conda-forge libgit2
```
1. Invoke **`build4mac.py`** with the following options: 1. Invoke **`build4mac.py`** with the following options:
``` ```
$ cd /where/'build.sh'/exists $ cd /where/'build.sh'/exists
@ -322,10 +236,10 @@ $ ./build4mac.py -q qt5ana3 -r ana3 -p ana3
$ ./build4mac.py -q qt5ana3 -r ana3 -p ana3 -Y $ ./build4mac.py -q qt5ana3 -r ana3 -p ana3 -Y
``` ```
The application bundle **`klayout.app`** is located under:<br> The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3`** directory, where **`LW-qt5Ana3.pkg.macos-Monterey-release-Rana3Pana3`** directory, where
* "LW-" means this is a lightweight package. * "LW-" means this is a lightweight package.
* "qt5Ana3" means that Qt5 from Anaconda3 is used. * "qt5Ana3" means that Qt5 from Anaconda3 is used.
* "Rana3Pana3" means that Ruby (3.1) is from Anaconda3; Python (3.9) is from Anaconda3. * "Rana3Pana3" means that Ruby (3.1) is from Anaconda3; Python (3.11) is from Anaconda3.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation. 4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
5. You may have to set the `PYTHONHOME` environment variable like: 5. You may have to set the `PYTHONHOME` environment variable like:
``` ```
@ -333,14 +247,14 @@ export PYTHONHOME=$HOME/opt/anaconda3
``` ```
### 6F. Other combinations ### 6F. Other combinations
Logically, several module combinations other than 6A through 6E are possible, including `nil` choice.<br> Logically, several module combinations other than 6B through 6E are possible, including `nil` choice.<br>
The resultant package directory name will begin with **`EX-`** (exceptional) if you choose such a combination. The resultant package directory name will begin with **`EX-`** (exceptional) if you choose such a combination.
---- ----
# 7. Making a DMG installer # 7. Making a DMG installer
You can make a DMG installer using another Python script **`makeDMG4mac.py`**.<br> You can make a DMG installer using another Python script **`makeDMG4mac.py`**.<br>
This script requires a directory generated by **`build4mac.py`** with the [-y|-Y] option (refer to 6A through 6D). This script requires a directory generated by **`build4mac.py`** with the [-y|-Y] option (refer to 6B through 6E).
1. Make a symbolic link (if it does not exist) from the parent directory (where **`build.sh`** exists) to **`makeDMG4mac.py`**, that is, 1. Make a symbolic link (if it does not exist) from the parent directory (where **`build.sh`** exists) to **`makeDMG4mac.py`**, that is,
``` ```
@ -349,18 +263,18 @@ makeDMG4mac.py -> macbuild/makeDMG4mac.py
2. Invoke **`makeDMG4mac.py`** with -p and -m options, for example, 2. Invoke **`makeDMG4mac.py`** with -p and -m options, for example,
``` ```
$ cd /where/'build.sh'/exists $ cd /where/'build.sh'/exists
$ ./makeDMG4mac.py -p LW-qt5MP.pkg.macos-Catalina-release-Rmp32Pmp39 -m $ ./makeDMG4mac.py -p LW-qt5MP.pkg.macos-Monterey-release-Rmp32Pmp311 -m
``` ```
This command will generate the two files below:<br> This command will generate the two files below:<br>
* **`LW-klayout-0.28.6-macOS-Catalina-1-qt5MP-Rmp32Pmp39.dmg`** ---(1) the main DMG file * **`LW-klayout-0.28.13-macOS-Monterey-1-qt5MP-Rmp32Pmp311.dmg`** ---(1) the main DMG file
* **`LW-klayout-0.28.6-macOS-Catalina-1-qt5MP-Rmp32Pmp39.dmg.md5`** ---(2) MD5-value text file * **`LW-klayout-0.28.13-macOS-Monterey-1-qt5MP-Rmp32Pmp311.dmg.md5`** ---(2) MD5-value text file
# Known issues # 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.<br> Because we assume some specific versions of non-OS-standard Ruby and Python, updating Homebrew, MacPorts, or Anaconda3 may cause build- and link errors.<br>
In such cases, you need to update the dictionary contents of **`build4mac_env.py`**. In such cases, you need to update the dictionary contents of **`build4mac_env.py`**.
# Final comments # Final comments
No need to say KLayout is a great tool! <br> No need to say KLayout is a great tool!<br>
With the object-oriented script language (both Ruby and Python) support, our error-prone layout jobs can be significantly simplified and sped up.<br> With the object-oriented script language (both Ruby and Python) support, our error-prone layout jobs can be significantly simplified and sped up.<br>
Building KLayout from its source code is not difficult. Try it with your favorite environment! Building KLayout from its source code is not difficult. Try it with your favorite environment!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 KiB

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 198 KiB

View File

@ -6,6 +6,25 @@ import os
pwd = os.getcwd() pwd = os.getcwd()
sys.path.append(pwd) sys.path.append(pwd)
piphelpstr = """
--------------------------------------------------------------------------------
(1) Install ['pandas', 'scipy', 'matplotlib']
>>> import pip
>>> pip.main( ['install', 'pandas', 'scipy', 'matplotlib'] )
(2) List modules
>>> import pip
>>> pip.main( ['list'] )
(3) Uninstall ['scipy']
>>> import pip
>>> pip.main( ['uninstall', 'scipy'] )
--------------------------------------------------------------------------------
"""
def howtopip():
print(piphelpstr)
variables = globals().copy() variables = globals().copy()
variables.update(locals()) variables.update(locals())
shell = code.InteractiveConsole(variables) shell = code.InteractiveConsole(variables)

View File

@ -0,0 +1,39 @@
#!/Applications/klayout.app/Contents/MacOS/klayout -b -r
import readline
import code
import sys
import os
pwd = os.getcwd()
sys.path.append(pwd)
rootPython = "/Applications/klayout.app/Contents/Frameworks/Python.framework/Versions"
verPython = "${PYTHON_VER}"
piptarget = [ "--target", "%s/%s/lib/python%s/site-packages" % (rootPython, verPython, verPython) ]
piphelpstr = """
--------------------------------------------------------------------------------
(1) Install ['pandas', 'scipy', 'matplotlib']
>>> import pip
>>> pip.main( ['install', 'pandas', 'scipy', 'matplotlib'] + piptarget )
(2) List modules
>>> import pip
>>> pip.main( ['list'] )
(3) Uninstall ['scipy']
>>> import pip
>>> pip.main( ['uninstall', 'scipy'] )
--------------------------------------------------------------------------------
"""
def howtopip():
print(piphelpstr)
variables = globals().copy()
variables.update(locals())
shell = code.InteractiveConsole(variables)
cprt = 'Type "help", "copyright", "credits" or "license" for more information.'
banner = "Python %s on %s\n%s\n(%s)" % (sys.version, sys.platform,
cprt, "KLayout Python Console")
exit_msg = 'now exiting %s...' % "KLayout Python Console"
shell.interact(banner, exit_msg)

File diff suppressed because it is too large Load Diff

View File

@ -6,11 +6,12 @@
# #
# Here are dictionaries of ... # Here are dictionaries of ...
# different modules for building KLayout (http://www.klayout.de/index.php) # different modules for building KLayout (http://www.klayout.de/index.php)
# version 0.26.1 or later on different Apple Mac OSX platforms. # version 0.28.13 or later on different Apple Mac OSX platforms.
# #
# This file is imported by 'build4mac.py' script. # This file is imported by 'build4mac.py' script.
#=============================================================================== #===============================================================================
import os import os
import re
import glob import glob
import platform import platform
@ -30,25 +31,31 @@ if Machine == "arm64": # Apple Silicon!
HomebrewSearchPathFilter1 = '\t+%s/opt' % DefaultHomebrewRoot HomebrewSearchPathFilter1 = '\t+%s/opt' % DefaultHomebrewRoot
HomebrewSearchPathFilter2 = '\t+@loader_path/../../../../../../../../../../opt' HomebrewSearchPathFilter2 = '\t+@loader_path/../../../../../../../../../../opt'
HomebrewSearchPathFilter3 = '@loader_path/../../../../../../../../../../opt' # no leading white space HomebrewSearchPathFilter3 = '@loader_path/../../../../../../../../../../opt' # no leading white space
# 1: absolute path as in ~python@3.9.17 # 1: absolute path as seen in ~python@3.9.17
# 2: relative path as in python@3.9.18~ # 2: relative path as seen in python@3.9.18
else: else:
DefaultHomebrewRoot = '/usr/local' DefaultHomebrewRoot = '/usr/local'
HomebrewSearchPathFilter1 = '\t+%s/opt' % DefaultHomebrewRoot HomebrewSearchPathFilter1 = '\t+%s/opt' % DefaultHomebrewRoot
HomebrewSearchPathFilter2 = '\t+@loader_path/../../../../../../../../../../opt' HomebrewSearchPathFilter2 = '\t+@loader_path/../../../../../../../../../../opt'
HomebrewSearchPathFilter3 = '@loader_path/../../../../../../../../../../opt' # no leading white space HomebrewSearchPathFilter3 = '@loader_path/../../../../../../../../../../opt' # no leading white space
# 1: absolute path as in ~python@3.9.17 # 1: absolute path as seen in ~python@3.9.17
# BigSur{kazzz-s} lib-dynload (1)% otool -L _sqlite3.cpython-39-darwin.so # BigSur{kazzz-s} lib-dynload (1)% otool -L _sqlite3.cpython-39-darwin.so
# _sqlite3.cpython-39-darwin.so: # _sqlite3.cpython-39-darwin.so:
# ===> /usr/local/opt/sqlite/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0) # ===> /usr/local/opt/sqlite/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)
# /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5) # /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)
# #
# 2: relative path as in python@3.9.18~ # 2: relative path as seen in python@3.9.18
# Monterey{kazzz-s} lib-dynload (1)% otool -L _sqlite3.cpython-39-darwin.so # Monterey{kazzz-s} lib-dynload (1)% otool -L _sqlite3.cpython-39-darwin.so
# _sqlite3.cpython-39-darwin.so: # _sqlite3.cpython-39-darwin.so:
# ===> @loader_path/../../../../../../../../../../opt/sqlite/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0) # ===> @loader_path/../../../../../../../../../../opt/sqlite/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)
# /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3) # /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
# #
# 3. absolute path again as seen in python@3.11
# Monterey{kazzz-s} lib-dynload (1)% otool -L _sqlite3.cpython-311-darwin.so
# _sqlite3.cpython-311-darwin.so:
# ===> /usr/local/opt/sqlite/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)
# /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
#
# Ref. https://github.com/Homebrew/homebrew-core/issues/140930#issuecomment-1701524467 # Ref. https://github.com/Homebrew/homebrew-core/issues/140930#issuecomment-1701524467
del System, Node, Release, MacVersion, Machine, Processor del System, Node, Release, MacVersion, Machine, Processor
@ -102,91 +109,21 @@ Qt6Brew = { 'qmake' : '%s/opt/qt@6/bin/qmake' % DefaultHomebrewRoot,
#----------------------------------------------------- #-----------------------------------------------------
# [2] Ruby # [2] Ruby
# * Dropped the followings (2023-10-24).
# Sys: [ElCapitan - BigSur]
# Ext: [Ruby31]
# * See 415b5aa2efca04928f1148a69e77efd5d76f8c1d
# for the previous states.
#----------------------------------------------------- #-----------------------------------------------------
RubyNil = [ 'nil' ] RubyNil = [ 'nil' ]
RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave' ] RubySys = [ 'RubyMonterey', 'RubyVentura', 'RubySonoma' ]
RubySys += [ 'RubyCatalina', 'RubyBigSur', 'RubyMonterey', 'RubyVentura' ] RubyExt = [ 'Ruby32MacPorts', 'Ruby32Brew', 'RubyAnaconda3' ]
RubyExt = [ 'Ruby31MacPorts', 'Ruby32MacPorts', 'Ruby31Brew', 'Ruby32Brew', 'RubyAnaconda3' ]
Rubies = RubyNil + RubySys + RubyExt Rubies = RubyNil + RubySys + RubyExt
#----------------------------------------------------- #-----------------------------------------------------
# Whereabouts of different components of Ruby # Whereabouts of different components of Ruby
#----------------------------------------------------- #-----------------------------------------------------
# Bundled with Yosemite (10.10)
# !!! Yosemite is no longer supported (KLayout 0.26 ~) but remains here to keep the record of
# the directory structure of earlier generations.
# [Key Type Name] = 'Sys'
RubyYosemite = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby',
'inc': '/System/Library/Frameworks/Ruby.framework/Headers',
'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.dylib'
}
# Bundled with El Capitan (10.11)
# [Key Type Name] = 'Sys'
RubyElCapitan = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby',
'inc': '/System/Library/Frameworks/Ruby.framework/Headers',
'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.dylib'
}
# Bundled with Sierra (10.12)
# [Key Type Name] = 'Sys'
RubySierra = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby',
'inc': '/System/Library/Frameworks/Ruby.framework/Headers',
'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.dylib'
}
# Bundled with High Sierra (10.13)
# [Key Type Name] = 'Sys'
RubyHighSierra = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby',
'inc': '/System/Library/Frameworks/Ruby.framework/Headers',
'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.dylib'
}
# Bundled with Mojave (10.14)
# The missing Ruby header files under "/System/Library/Frameworks/Ruby.framework/" were manually deployed there
# from "Xcode-10.1-beta2" with the corresponding Ruby version.
# [Key Type Name] = 'Sys'
RubyMojave = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby',
'inc': '/System/Library/Frameworks/Ruby.framework/Headers',
'lib': '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.dylib'
}
# 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/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': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % CatalinaSDK
}
# Bundled with Big Sur (11.x)
# 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': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % BigSurSDK
}
# Bundled with Monterey (12.x) # Bundled with Monterey (12.x)
# Refer to the "Catalina" section above
# [Key Type Name] = 'Sys' # [Key Type Name] = 'Sys'
MontereySDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" MontereySDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
RubyMonterey = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby', RubyMonterey = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
@ -195,8 +132,7 @@ RubyMonterey = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % MontereySDK 'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % MontereySDK
} }
# Bundled with Ventura (14.x) # Bundled with Ventura (13.x)
# Refer to the "Catalina" section above
# [Key Type Name] = 'Sys' # [Key Type Name] = 'Sys'
VenturaSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" VenturaSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
RubyVentura = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby', RubyVentura = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
@ -205,15 +141,16 @@ RubyVentura = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % VenturaSDK 'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % VenturaSDK
} }
# Ruby 3.1 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+ # Bundled with Sonoma (14.x)
# install with 'sudo port install ruby31' # [Key Type Name] = 'Sys'
# [Key Type Name] = 'MP31' SonomaSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
Ruby31MacPorts = { 'exe': '/opt/local/bin/ruby3.1', RubySonoma = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
'inc': '/opt/local/include/ruby-3.1.3', 'inc': '%s/System/Library/Frameworks/Ruby.framework/Headers' % SonomaSDK,
'lib': '/opt/local/lib/libruby.3.1.dylib' 'inc2': '%s/System/Library/Frameworks/Ruby.framework/Headers/ruby' % SonomaSDK,
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % SonomaSDK
} }
# Ruby 3.2 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+ # Ruby 3.2 from MacPorts (https://www.macports.org/)
# install with 'sudo port install ruby32' # install with 'sudo port install ruby32'
# [Key Type Name] = 'MP32' # [Key Type Name] = 'MP32'
Ruby32MacPorts = { 'exe': '/opt/local/bin/ruby3.2', Ruby32MacPorts = { 'exe': '/opt/local/bin/ruby3.2',
@ -221,16 +158,7 @@ Ruby32MacPorts = { 'exe': '/opt/local/bin/ruby3.2',
'lib': '/opt/local/lib/libruby.3.2.dylib' 'lib': '/opt/local/lib/libruby.3.2.dylib'
} }
# Ruby 3.1 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+ # Ruby 3.2 from Homebrew
# install with 'brew install ruby@3.1'
# [Key Type Name] = 'HB31'
HBRuby31Path = '%s/opt/ruby@3.1' % DefaultHomebrewRoot
Ruby31Brew = { 'exe': '%s/bin/ruby' % HBRuby31Path,
'inc': '%s/include/ruby-3.1.0' % HBRuby31Path,
'lib': '%s/lib/libruby.3.1.dylib' % HBRuby31Path
}
# Ruby 3.2 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install ruby@3.2' # install with 'brew install ruby@3.2'
# [Key Type Name] = 'HB32' # [Key Type Name] = 'HB32'
HBRuby32Path = '%s/opt/ruby@3.2' % DefaultHomebrewRoot HBRuby32Path = '%s/opt/ruby@3.2' % DefaultHomebrewRoot
@ -239,7 +167,7 @@ Ruby32Brew = { 'exe': '%s/bin/ruby' % HBRuby32Path,
'lib': '%s/lib/libruby.3.2.dylib' % HBRuby32Path 'lib': '%s/lib/libruby.3.2.dylib' % HBRuby32Path
} }
# Ruby 3.1 bundled with anaconda3 installed under /Applications/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+ # Ruby 3.1 bundled with anaconda3 installed under /Applications/anaconda3/
# The standard installation deploys the tool under $HOME/opt/anaconda3/. # The standard installation deploys the tool under $HOME/opt/anaconda3/.
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/ # If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
# [Key Type Name] = 'Ana3' # [Key Type Name] = 'Ana3'
@ -250,157 +178,118 @@ RubyAnaconda3 = { 'exe': '/Applications/anaconda3/bin/ruby',
# Consolidated dictionary kit for Ruby # Consolidated dictionary kit for Ruby
RubyDictionary = { 'nil' : None, RubyDictionary = { 'nil' : None,
'RubyYosemite' : RubyYosemite,
'RubyElCapitan' : RubyElCapitan,
'RubySierra' : RubySierra,
'RubyHighSierra': RubyHighSierra,
'RubyMojave' : RubyMojave,
'RubyCatalina' : RubyCatalina,
'RubyBigSur' : RubyBigSur,
'RubyMonterey' : RubyMonterey, 'RubyMonterey' : RubyMonterey,
'RubyVentura' : RubyVentura, 'RubyVentura' : RubyVentura,
'Ruby31MacPorts': Ruby31MacPorts, 'RubySonoma' : RubySonoma,
'Ruby32MacPorts': Ruby32MacPorts, 'Ruby32MacPorts': Ruby32MacPorts,
'Ruby31Brew' : Ruby31Brew,
'Ruby32Brew' : Ruby32Brew, 'Ruby32Brew' : Ruby32Brew,
'RubyAnaconda3' : RubyAnaconda3 'RubyAnaconda3' : RubyAnaconda3
} }
#----------------------------------------------------- #-----------------------------------------------------
# [3] Python # [3] Python
# * Dropped the followings (2023-10-24).
# Sys: [ElCapitan - Monterey]
# Ext: [Python38]
# * See 415b5aa2efca04928f1148a69e77efd5d76f8c1d
# for the previous states.
#----------------------------------------------------- #-----------------------------------------------------
PythonNil = [ 'nil' ] PythonNil = [ 'nil' ]
PythonSys = [ 'PythonElCapitan', 'PythonSierra', 'PythonHighSierra', 'PythonMojave' ] PythonSys = [ ]
PythonSys += [ 'PythonCatalina', 'PythonBigSur', 'PythonMonterey' ] PythonExt = [ 'Python39MacPorts', 'Python39Brew' ]
PythonExt = [ 'Python38MacPorts', 'Python39MacPorts', 'Python38Brew', 'Python39Brew' ] PythonExt += [ 'Python311MacPorts', 'Python311Brew' ]
PythonExt += [ 'PythonAnaconda3', 'PythonAutoBrew' ] PythonExt += [ 'PythonAnaconda3', 'PythonAutoBrew' ]
Pythons = PythonNil + PythonSys + PythonExt Pythons = PythonNil + PythonSys + PythonExt
#----------------------------------------------------- #-----------------------------------------------------
# Whereabouts of different components of Python # Whereabouts of different components of Python
#----------------------------------------------------- #-----------------------------------------------------
# Bundled with Yosemite (10.10) # Python 3.9 from MacPorts (https://www.macports.org/)
# !!! Yosemite is no longer supported but remains here to keep the record of the directory structure
# of earlier generations.
# [Key Type Name] = 'Sys'
PythonYosemite = { '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 El Capitan (10.11)
# [Key Type Name] = 'Sys'
PythonElCapitan = { '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 Sierra (10.12)
# [Key Type Name] = 'Sys'
PythonSierra = { '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 High Sierra (10.13)
# [Key Type Name] = 'Sys'
PythonHighSierra= { '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 Mojave (10.14)
# [Key Type Name] = 'Sys'
PythonMojave = { '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 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.x)
# ** IMPORTANT NOTES **
# Xcode [13.1 .. ] does not allow to link the legacy Python 2.7 library not to produce unsupported applications.
# This code block remains here to keep the parallelism.
# [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'
}
# Bundled with Monterey (12.x)
# ** IMPORTANT NOTES **
# Xcode [13.1 .. ] does not allow to link the legacy Python 2.7 library not to produce unsupported applications.
# This code block remains here to keep the parallelism.
# [Key Type Name] = 'Sys'
PythonMonterey = { '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'
Python38MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8',
'inc': '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8',
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib'
}
# Python 3.9 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
# install with 'sudo port install python39' # install with 'sudo port install python39'
# [Key Type Name] = 'MP38' # [Key Type Name] = 'MP39'
Python39MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9', Python39MacPorts = { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9',
'inc': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9', 'inc': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9',
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib' 'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib'
} }
# Python 3.8 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+ # Python 3.11 from MacPorts (https://www.macports.org/)
# install with 'brew install python@3.8' # install with 'sudo port install python311'
# [Key Type Name] = 'HB38' # [Key Type Name] = 'MP311'
HBPython38FrameworkPath = '%s/opt/python@3.8/Frameworks/Python.framework' % DefaultHomebrewRoot Python311MacPorts = { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11',
Python38Brew = { 'exe': '%s/Versions/3.8/bin/python3.8' % HBPython38FrameworkPath, 'inc': '/opt/local/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11',
'inc': '%s/Versions/3.8/include/python3.8' % HBPython38FrameworkPath, 'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib'
'lib': '%s/Versions/3.8/lib/libpython3.8.dylib' % HBPython38FrameworkPath }
}
# Python 3.9 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+ # Python 3.9 from Homebrew
# install with 'brew install python@3.9' # install with 'brew install python@3.9'
# [Key Type Name] = 'HB39' # [Key Type Name] = 'HB39'
HBPython39FrameworkPath = '%s/opt/python@3.9/Frameworks/Python.framework' % DefaultHomebrewRoot HBPython39FrameworkPath = '%s/opt/python@3.9/Frameworks/Python.framework' % DefaultHomebrewRoot
Python39Brew = { 'exe': '%s/Versions/3.9/bin/python3.9' % HBPython39FrameworkPath, Python39Brew = { 'exe': '%s/Versions/3.9/bin/python3.9' % HBPython39FrameworkPath,
'inc': '%s/Versions/3.9/include/python3.9' % HBPython39FrameworkPath, 'inc': '%s/Versions/3.9/include/python3.9' % HBPython39FrameworkPath,
'lib': '%s/Versions/3.9/lib/libpython3.9.dylib' % HBPython39FrameworkPath 'lib': '%s/Versions/3.9/lib/libpython3.9.dylib' % HBPython39FrameworkPath
} }
# Python 3.8 bundled with anaconda3 installed under /Applications/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+ # Python 3.11 from Homebrew
# install with 'brew install python@3.11'
# [Key Type Name] = 'HB311'
HBPython311FrameworkPath = '%s/opt/python@3.11/Frameworks/Python.framework' % DefaultHomebrewRoot
Python311Brew = { 'exe': '%s/Versions/3.11/bin/python3.11' % HBPython311FrameworkPath,
'inc': '%s/Versions/3.11/include/python3.11' % HBPython311FrameworkPath,
'lib': '%s/Versions/3.11/lib/libpython3.11.dylib' % HBPython311FrameworkPath
}
# Python 3.11 bundled with anaconda3 installed under /Applications/anaconda3/
# The standard installation deploys the tool under $HOME/opt/anaconda3/. # The standard installation deploys the tool under $HOME/opt/anaconda3/.
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/ # If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
# [Key Type Name] = 'Ana3' # [Key Type Name] = 'Ana3'
PythonAnaconda3 = { 'exe': '/Applications/anaconda3/bin/python3.9', PythonAnaconda3 = { 'exe': '/Applications/anaconda3/bin/python3.11',
'inc': '/Applications/anaconda3/include/python3.9', 'inc': '/Applications/anaconda3/include/python3.11',
'lib': '/Applications/anaconda3/lib/libpython3.9.dylib' 'lib': '/Applications/anaconda3/lib/libpython3.11.dylib'
} }
# Latest Python from Homebrew *+*+*+ EXPERIMENTAL *+*+*+ # Latest Python from Homebrew
# install with 'brew install python' # install with 'brew install python'
# There can be multiple candidates such as: (python, python3, python@3, python@3.8, python@3.9) # There can be multiple candidates such as: (python, python3, python@3, python@3.8, python@3.9,
# python@3.10, python@3.11, python@3.12, python@3.13 )
# Hard to tell which is going to be available to the user. Picking the last one. # Hard to tell which is going to be available to the user. Picking the last one.
# [Key Type Name] = 'HBAuto' # [Key Type Name] = 'HBAuto'
HBPythonAutoFrameworkPath = "" HBPythonAutoFrameworkPath = ""
HBPythonAutoVersion = "" HBPythonAutoVersion = ""
try: try:
HBPythonAutoFrameworkPath = glob.glob( "%s/opt/python*/Frameworks/Python.framework" % DefaultHomebrewRoot )[-1] patPF = r"(%s/opt/python)([@]?)(3[.]?)([0-9]*)(/Frameworks/Python[.]framework)" % DefaultHomebrewRoot
# expand 3* into HBPythonAutoVersion, there should be only one, but I am taking no chances. regPF = re.compile(patPF)
dicPy = dict()
for item in glob.glob( "%s/opt/python*/Frameworks/Python.framework" % DefaultHomebrewRoot ):
if regPF.match(item):
pyver = regPF.match(item).groups()[3] # ([0-9]*)
if pyver == "":
pyver = "0"
dicPy[ int(pyver) ] = ( item, "3."+pyver )
keys = sorted( dicPy.keys(), reverse=True )
HBPythonAutoFrameworkPath = dicPy[keys[0]][0]
HBPythonAutoVersion = dicPy[keys[0]][1]
HBAutoFrameworkVersionPath, HBPythonAutoVersion = os.path.split( glob.glob( "%s/Versions/3*" % HBPythonAutoFrameworkPath )[0] ) HBAutoFrameworkVersionPath, HBPythonAutoVersion = os.path.split( glob.glob( "%s/Versions/3*" % HBPythonAutoFrameworkPath )[0] )
PythonAutoBrew = { 'exe': '%s/%s/bin/python%s' % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion, HBPythonAutoVersion ), PythonAutoBrew = { 'exe': '%s/%s/bin/python%s' % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion, HBPythonAutoVersion ),
'inc': '%s/%s/include/python%s' % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion, HBPythonAutoVersion ), 'inc': '%s/%s/include/python%s' % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion, HBPythonAutoVersion ),
'lib': glob.glob( "%s/%s/lib/*.dylib" % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion ) )[0] 'lib': glob.glob( "%s/%s/lib/*.dylib" % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion ) )[0]
} }
"""
# when I have [python3, python@3, python@3.8, python@3.9, python@3.10, python@3.11]
print(HBPythonAutoFrameworkPath)
print(HBAutoFrameworkVersionPath)
print(HBPythonAutoVersion)
print(PythonAutoBrew)
quit()
/usr/local/opt/python@3.11/Frameworks/Python.framework
/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions
3.11
{ 'exe': '/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/bin/python3.11',
'inc': '/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11',
'lib': '/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib'
}
"""
except Exception as e: except Exception as e:
_have_Homebrew_Python = False _have_Homebrew_Python = False
print( " WARNING!!! Since you don't have the Homebrew Python Frameworks, you cannot use the '-p HBAuto' option. " ) print( " WARNING!!! Since you don't have the Homebrew Python Frameworks, you cannot use the '-p HBAuto' option. " )
@ -409,19 +298,12 @@ else:
_have_Homebrew_Python = True _have_Homebrew_Python = True
# Consolidated dictionary kit for Python # Consolidated dictionary kit for Python
PythonDictionary = { 'nil' : None, PythonDictionary = { 'nil' : None,
'PythonElCapitan' : PythonElCapitan, 'Python39MacPorts' : Python39MacPorts,
'PythonSierra' : PythonSierra, 'Python311MacPorts': Python311MacPorts,
'PythonHighSierra': PythonHighSierra, 'Python39Brew' : Python39Brew,
'PythonMojave' : PythonMojave, 'Python311Brew' : Python311Brew,
'PythonCatalina' : PythonCatalina, 'PythonAnaconda3' : PythonAnaconda3
'PythonBigSur' : PythonBigSur,
'PythonMonterey' : PythonMonterey,
'Python38MacPorts': Python38MacPorts,
'Python39MacPorts': Python39MacPorts,
'Python38Brew' : Python38Brew,
'Python39Brew' : Python39Brew,
'PythonAnaconda3' : PythonAnaconda3
} }
if _have_Homebrew_Python: if _have_Homebrew_Python:
PythonDictionary['PythonAutoBrew'] = PythonAutoBrew PythonDictionary['PythonAutoBrew'] = PythonAutoBrew

View File

@ -623,18 +623,24 @@ def Patch_Python_In_PythonFramework( pythonFrameworkPath,
#---------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------
## To change the Python's relative library paths to the absolute paths ## To change the Python's relative library paths to the absolute paths
# #
# 1: absolute path as in ~python@3.9.17 # 1: absolute path as seen in ~python@3.9.17
# BigSur{kazzz-s} lib-dynload (1)% otool -L _sqlite3.cpython-39-darwin.so # BigSur{kazzz-s} lib-dynload (1)% otool -L _sqlite3.cpython-39-darwin.so
# _sqlite3.cpython-39-darwin.so: # _sqlite3.cpython-39-darwin.so:
# ===> /usr/local/opt/sqlite/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0) # ===> /usr/local/opt/sqlite/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)
# /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5) # /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)
# #
# 2: relative path as in python@3.9.18~ # 2: relative path as seen in python@3.9.18
# Monterey{kazzz-s} lib-dynload (1)% otool -L _sqlite3.cpython-39-darwin.so # Monterey{kazzz-s} lib-dynload (1)% otool -L _sqlite3.cpython-39-darwin.so
# _sqlite3.cpython-39-darwin.so: # _sqlite3.cpython-39-darwin.so:
# ===> @loader_path/../../../../../../../../../../opt/sqlite/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0) # ===> @loader_path/../../../../../../../../../../opt/sqlite/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)
# /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3) # /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
# #
# 3. absolute path again as seen in python@3.11
# Monterey{kazzz-s} lib-dynload (1)% otool -L _sqlite3.cpython-311-darwin.so
# _sqlite3.cpython-311-darwin.so:
# ===> /usr/local/opt/sqlite/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)
# /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
#
# @param[in] frameworkPath: Python Framework path # @param[in] frameworkPath: Python Framework path
# @param[in] debug_level: debug level # @param[in] debug_level: debug level
# #
@ -650,10 +656,10 @@ def Change_Python_LibPath_RelativeToAbsolute( frameworkPath, debug_level=0 ):
patRel3 = r'(%s)(.+)' % HomebrewSearchPathFilter3 # = '@loader_path/../../../../../../../../../../opt' patRel3 = r'(%s)(.+)' % HomebrewSearchPathFilter3 # = '@loader_path/../../../../../../../../../../opt'
regRel3 = re.compile(patRel3) regRel3 = re.compile(patRel3)
#---------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# (A) Collect *.[so|dylib] that the Python Frameworks depends on # (A) Collect *.[so|dylib] that the Python Frameworks depends on
#---------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Ref. https://formulae.brew.sh/formula/python@3.9#default # Ref. https://formulae.brew.sh/formula/python@3.9
# as of 2023-09-22, python@3.9 depends on: # as of 2023-09-22, python@3.9 depends on:
# gdbm 1.23 GNU database manager # gdbm 1.23 GNU database manager
# mpdecimal 2.5.1 Library for decimal floating point arithmetic # mpdecimal 2.5.1 Library for decimal floating point arithmetic
@ -661,6 +667,14 @@ def Change_Python_LibPath_RelativeToAbsolute( frameworkPath, debug_level=0 ):
# readline 8.2.1 Library for command-line editing # readline 8.2.1 Library for command-line editing
# sqlite 3.43.1 Command-line interface for SQLite # sqlite 3.43.1 Command-line interface for SQLite
# xz 5.4.4 General-purpose data compression with high compression ratio # xz 5.4.4 General-purpose data compression with high compression ratio
#---------------------------------------------------------------------------------------------------
# https://formulae.brew.sh/formula/python@3.11
# as of 2023-10-24, python@3.11 depends on:
# mpdecimal 2.5.1 Library for decimal floating point arithmetic
# openssl@3 3.1.3 Cryptography and SSL/TLS Toolkit
# sqlite 3.43.2 Command-line interface for SQLite
# xz 5.4.4 General-purpose data compression with high compression ratio
#---------------------------------------------------------------------------------------------------
find_grep_results = os.popen( 'find %s -type f | grep -E "%s"' % (frameworkPath, filter_regex) ).read().split('\n') find_grep_results = os.popen( 'find %s -type f | grep -E "%s"' % (frameworkPath, filter_regex) ).read().split('\n')
framework_files = filter( lambda x: x != '', map(lambda x: x.strip(), find_grep_results) ) framework_files = filter( lambda x: x != '', map(lambda x: x.strip(), find_grep_results) )
@ -745,6 +759,37 @@ def Change_Python_LibPath_RelativeToAbsolute( frameworkPath, debug_level=0 ):
print( " ---> Change_Python_LibPath_RelativeToAbsolute(): Changed the library paths." ) print( " ---> Change_Python_LibPath_RelativeToAbsolute(): Changed the library paths." )
return 0 return 0
#----------------------------------------------------------------------------------------
## To generate the 'start-console.py' file from the template file
#
# @param[in] template: input template file (template-start-console.py)
# @param[in] pythonver: Python version string such as "3.11"
# @param[in] target: output target file (start-console.py)
#
# @return True on success, False on failure
#----------------------------------------------------------------------------------------
def Generate_Start_Console_Py( template, pythonver, target ):
try:
fd = open( template, "r" )
tmpl = fd.read()
fd.close()
except Exception as e:
print( "! Failed to read <%s>" % template, file=sys.stderr )
return False
else:
t = string.Template(tmpl)
startpy = t.safe_substitute( PYTHON_VER=pythonver )
try:
fd = open( target, "w" )
fd.write(startpy)
fd.close()
except Exception as e:
print( "! Failed to write <%s>" % target, file=sys.stderr )
return False
else:
return True
#---------------- #----------------
# End of File # End of File
#---------------- #----------------

View File

@ -34,6 +34,7 @@ def SetGlobals():
global WorkDir # work directory name global WorkDir # work directory name
global LogFile # log file name global LogFile # log file name
global Usage # string on usage global Usage # string on usage
global DryRun # dry-run mode; print the command line and exit
# auxiliary variables on platform # auxiliary variables on platform
global System # 6-tuple from platform.uname() global System # 6-tuple from platform.uname()
global Node # - do - global Node # - do -
@ -48,16 +49,19 @@ def SetGlobals():
Usage += "<< Usage of 'macQAT.py' >>\n" Usage += "<< Usage of 'macQAT.py' >>\n"
Usage += " for running 'ut_runner' after building KLayout.\n" Usage += " for running 'ut_runner' after building KLayout.\n"
Usage += "\n" Usage += "\n"
Usage += "$ [python] ./macQAT.py \n" Usage += "$ [python] ./macQAT.py\n"
Usage += " option & argument : descriptions | default value\n" Usage += " option & argument : descriptions | default value\n"
Usage += " -----------------------------------------------------------------+---------------\n" Usage += " -----------------------------------------------------------------+---------------\n"
Usage += " [-u|--usage] : print usage of 'ut_runner'and exit | disabled \n" Usage += " [-u|--usage] : print usage of 'ut_runner'and exit | disabled\n"
Usage += " | \n" Usage += " |\n"
Usage += " <-r|--run> : run this script | disabled \n" Usage += " <-r|--run> : run this script | disabled\n"
Usage += " [-s|--stop] : stop on error | disabled \n" Usage += " [-s|--stop] : stop on error | disabled\n"
Usage += " [-x|--exclude <tests>] : exclude test(s) such as 'pymod,pya' | '' \n" Usage += " [-x|--exclude <tests>] : exclude test(s) such as 'pymod,pya' | ''\n"
Usage += " [-a|--args <string>] : arguments other than '-x' and '-c' | '' \n" Usage += " : you can use this option multiple times |\n"
Usage += " [-?|--?] : print this usage and exit | disabled \n" Usage += " [-a|--args <string>] : arguments other than '-x' and '-c' | ''\n"
Usage += " : you can use this option multiple times |\n"
Usage += " [--dryrun] : print the command line and exit | disabled\n"
Usage += " [-?|--?] : print this usage and exit | disabled\n"
Usage += "--------------------------------------------------------------------+-------------------\n" Usage += "--------------------------------------------------------------------+-------------------\n"
ProjectDir = os.getcwd() ProjectDir = os.getcwd()
@ -65,11 +69,12 @@ def SetGlobals():
Run = False Run = False
ContinueOnError = True ContinueOnError = True
TestsExcluded = list() TestsExcluded = list()
Arguments = "" Arguments = list()
GitSHA1 = GetGitShortSHA1() GitSHA1 = GetGitShortSHA1()
TimeStamp = GetTimeStamp() TimeStamp = GetTimeStamp()
WorkDir = "QATest_%s_%s__%s" % (GitSHA1, TimeStamp, os.path.basename(ProjectDir) ) WorkDir = "QATest_%s_%s__%s" % (GitSHA1, TimeStamp, os.path.basename(ProjectDir) )
LogFile = WorkDir + ".log" LogFile = WorkDir + ".log"
DryRun = False
(System, Node, Release, Version, Machine, Processor) = platform.uname() (System, Node, Release, Version, Machine, Processor) = platform.uname()
@ -103,6 +108,7 @@ def ParseCommandLineArguments():
global ContinueOnError global ContinueOnError
global TestsExcluded global TestsExcluded
global Arguments global Arguments
global DryRun
p = optparse.OptionParser( usage=Usage ) p = optparse.OptionParser( usage=Usage )
p.add_option( '-u', '--usage', p.add_option( '-u', '--usage',
@ -124,13 +130,21 @@ def ParseCommandLineArguments():
help='stop on error (false)' ) help='stop on error (false)' )
p.add_option( '-x', '--exclude', p.add_option( '-x', '--exclude',
action='append',
dest='exclude_tests', dest='exclude_tests',
help="exclude test(s) such as 'pymod,pya' ('')" ) help="exclude test(s) such as 'pymod,pya' ('')" )
p.add_option( '-a', '--args', p.add_option( '-a', '--args',
action='append',
dest='arguments', dest='arguments',
help="arguments other than '-x' and '-c' ('')" ) help="arguments other than '-x' and '-c' ('')" )
p.add_option( '--dryrun',
action='store_true',
dest='dryrun',
default=False,
help='print the command line and exit (false)' )
p.add_option( '-?', '--??', p.add_option( '-?', '--??',
action='store_true', action='store_true',
dest='checkusage', dest='checkusage',
@ -140,8 +154,9 @@ def ParseCommandLineArguments():
p.set_defaults( runner_usage = False, p.set_defaults( runner_usage = False,
runme = False, runme = False,
stop_on_error = False, stop_on_error = False,
exclude_tests = "", exclude_tests = list(),
arguments = "", arguments = list(),
dryrun = False,
checkusage = False ) checkusage = False )
opt, args = p.parse_args() opt, args = p.parse_args()
@ -152,11 +167,15 @@ def ParseCommandLineArguments():
RunnerUsage = opt.runner_usage RunnerUsage = opt.runner_usage
Run = opt.runme Run = opt.runme
ContinueOnError = not opt.stop_on_error ContinueOnError = not opt.stop_on_error
if not opt.exclude_tests == "": if not len(opt.exclude_tests) == 0:
TestsExcluded = [ item.strip() for item in opt.exclude_tests.split(',') ] excluded_tests = list()
for item in opt.exclude_tests:
excluded_tests += [ subitem.strip() for subitem in item.split(',') ]
TestsExcluded = sorted(list(set(excluded_tests)))
else: else:
TestsExcluded = [] TestsExcluded = []
Arguments = opt.arguments Arguments = opt.arguments
DryRun = opt.dryrun
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
## Hide/Show the private directory ## Hide/Show the private directory
@ -248,16 +267,20 @@ def Main():
command += " -c" command += " -c"
for item in TestsExcluded: for item in TestsExcluded:
command += ' -x %s' % item command += ' -x %s' % item
if not Arguments == "": if not len(Arguments) == 0:
command += " %s" % Arguments for arg in Arguments:
command += " %s" % arg
print( "" ) print( "" )
print( "### Dumping the log to <%s>" % LogFile ) print( "### Dumping the log to <%s>" % LogFile )
print( "------------------------------------------------------------" ) print( "------------------------------------------------------------------------" )
print( " Git SHA1 = %s" % GitSHA1 ) print( " Git SHA1 = %s" % GitSHA1 )
print( " Time stamp = %s" % TimeStamp ) print( " Time stamp = %s" % TimeStamp )
print( "------------------------------------------------------------" ) print( " Command line = %s" % command )
sleep( 1.0 ) print( "------------------------------------------------------------------------" )
if DryRun:
quit()
sleep(1.0)
HidePrivateDir() HidePrivateDir()
RunTester( command, logfile=LogFile ) RunTester( command, logfile=LogFile )
ShowPrivateDir() ShowPrivateDir()

View File

@ -5,7 +5,7 @@
# #
# The top Bash script to run "ut_runner" after building KLayout # The top Bash script to run "ut_runner" after building KLayout
# (http://www.klayout.de/index.php) version 0.26.1 or later on different Apple # (http://www.klayout.de/index.php) version 0.26.1 or later on different Apple
# ßMac OSX platforms. # Mac OSX platforms.
# #
# This script must be copied to a "*.macQAT/" directory to run. # This script must be copied to a "*.macQAT/" directory to run.
#=============================================================================== #===============================================================================
@ -68,8 +68,8 @@ if [ $# -eq 1 ]; then
echo " Time stamp = ${timestamp}" echo " Time stamp = ${timestamp}"
echo " Log file = ${logfile}" echo " Log file = ${logfile}"
echo " Usage:" echo " Usage:"
echo " ./QATest.sh -h: to get the help of 'ut_runner'" echo " ./macQAT.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 " ./macQAT.sh -r: to run the tests with '-c' option: continues after an error"
echo "" echo ""
exit 0 exit 0
fi fi
@ -79,8 +79,8 @@ else
echo " Time stamp = ${timestamp}" echo " Time stamp = ${timestamp}"
echo " Log file = ${logfile}" echo " Log file = ${logfile}"
echo " Usage:" echo " Usage:"
echo " ./QATest.sh -h: to get the help of 'ut_runner'" echo " ./macQAT.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 " ./macQAT.sh -r: to run the tests with '-c' option: continues after an error"
echo "" echo ""
exit 0 exit 0
fi fi

40
macbuild/macQAT2.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
#===============================================================================
# File: "macbuild/macQAT2.sh"
#
# The top Bash script to run "ut_runner" after building KLayout
# (http://www.klayout.de/index.php) version 0.26.1 or later on different Apple
# Mac OSX platforms.
#
# This script must be copied to a directory that can be found in $PATH.
#===============================================================================
prjdir=`pwd`
if [ $# -ge 2 ]; then
first_arg=$1
shift
remaining_args=("$@")
echo "#########################"
echo "# Starging macQAT2.sh #"
echo "#########################"
echo " Current Dir: $prjdir"
echo " First Arg: $first_arg"
echo "Remaining Args: ${remaining_args[@]}"
echo ""
export TESTSRC=../
export TESTTMP=$first_arg
export DYLD_LIBRARY_PATH=$prjdir:$prjdir/db_plugins:$prjdir/lay_plugins
./ut_runner ${remaining_args[@]}
else
echo "Usage: -------------------------------------------------"
echo " $ macQAT2.sh <test_dir> <args to ./ut_runner>"
echo " ex. $ change directory to a *.macQAT/"
echo " $ macQAT2.sh __Homebrew tlGitTests"
echo "--------------------------------------------------------"
fi
#--------------
# End of File
#--------------

View File

@ -47,7 +47,7 @@ def SetGlobals():
global DefaultBundleName # the default bundle name 'klayout.app' global DefaultBundleName # the default bundle name 'klayout.app'
global BundleName # application bundle name in the DMG global BundleName # application bundle name in the DMG
global DMGSerialNum # the DMG serial number global DMGSerialNum # the DMG serial number
global PackagePrefix # the package prefix: 'ST-', 'LW-', 'HW-', or 'EX-' global PackagePrefix # the package prefix: LW-', 'HW-', or 'EX-'
global QtIdentification # Qt identification global QtIdentification # Qt identification
global RubyPythonID # Ruby- and Python-identification global RubyPythonID # Ruby- and Python-identification
global KLVersion # KLayout's version global KLVersion # KLayout's version
@ -77,13 +77,13 @@ def SetGlobals():
Usage = "\n" Usage = "\n"
Usage += "---------------------------------------------------------------------------------------------------------\n" Usage += "---------------------------------------------------------------------------------------------------------\n"
Usage += "<< Usage of 'makeDMG4mac.py' >>\n" Usage += "<< Usage of 'makeDMG4mac.py' >>\n"
Usage += " for making a DMG file of KLayout 0.28.4 or later on different Apple macOS / Mac OSX platforms.\n" Usage += " for making a DMG file of KLayout 0.28.13 or later on different Apple macOS platforms.\n"
Usage += "\n" Usage += "\n"
Usage += "$ [python] ./makeDMG4mac.py\n" Usage += "$ [python] ./makeDMG4mac.py\n"
Usage += " option & argument : descriptions | default value\n" Usage += " option & argument : descriptions | default value\n"
Usage += " ----------------------------------------------------------------------------------+-----------------\n" Usage += " ----------------------------------------------------------------------------------+-----------------\n"
Usage += " <-p|--pkg <dir>> : package directory created by `build4mac.py` with [-y|-Y] | ``\n" Usage += " <-p|--pkg <dir>> : package directory created by `build4mac.py` with [-y|-Y] | ``\n"
Usage += " : like 'LW-qt5MP.pkg.macos-Catalina-release-Rmp32Pmp39' | \n" Usage += " : like 'LW-qt5MP.pkg.macos-Monterey-release-Rmp32Pmp311' | \n"
Usage += " <-c|--clean> : clean the work directory | disabled\n" Usage += " <-c|--clean> : clean the work directory | disabled\n"
Usage += " <-m|--make> : make a compressed DMG file | disabled\n" Usage += " <-m|--make> : make a compressed DMG file | disabled\n"
Usage += " : <-c|--clean> and <-m|--make> are mutually exclusive | \n" Usage += " : <-c|--clean> and <-m|--make> are mutually exclusive | \n"
@ -103,9 +103,13 @@ def SetGlobals():
print(Usage) print(Usage)
quit() quit()
release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0'] release = int( Release.split(".")[0] ) # take the first of ['21', '0', '0']
LatestOS = "" LatestOS = ""
if release == 22: if release == 23:
GenOSName = "macOS"
Platform = "Sonoma"
LatestOS = Platform
elif release == 22:
GenOSName = "macOS" GenOSName = "macOS"
Platform = "Ventura" Platform = "Ventura"
LatestOS = Platform LatestOS = Platform
@ -113,26 +117,6 @@ def SetGlobals():
GenOSName = "macOS" GenOSName = "macOS"
Platform = "Monterey" Platform = "Monterey"
LatestOS = Platform LatestOS = Platform
elif release == 20:
GenOSName = "macOS"
Platform = "BigSur"
LatestOS = Platform
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: else:
Platform = "" Platform = ""
print("") print("")
@ -141,7 +125,7 @@ def SetGlobals():
sys.exit(1) sys.exit(1)
if not Machine == "x86_64": if not Machine == "x86_64":
if Machine == "arm64" and Platform in ["Ventura", "Monterey", "BigSur"]: # with an Apple Silicon Chip if Machine == "arm64" and Platform in ["Sonoma", "Ventura", "Monterey"]: # with an Apple Silicon Chip
print("") print("")
print( "### Your Mac equips an Apple Silicon Chip ###" ) print( "### Your Mac equips an Apple Silicon Chip ###" )
print("") print("")
@ -207,18 +191,18 @@ def SetGlobals():
## To check the contents of the package directory ## To check the contents of the package directory
# #
# The package directory name should look like: # The package directory name should look like:
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3 # * LW-qt5Ana3.pkg.macos-Monterey-release-Rana3Pana3
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb32Phb39 --- (1) # * LW-qt5Brew.pkg.macos-Monterey-release-Rhb32Phb311 --- (1)
# * LW-qt5MP.pkg.macos-Catalina-release-Rmp32Pmp39 # * LW-qt5MP.pkg.macos-Monterey-release-Rmp32Pmp311
# * HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb39 # * HW-qt5Brew.pkg.macos-Monterey-release-RsysPhb311
# #
# * LW-qt6Ana3.pkg.macos-Catalina-release-Rana3Pana3 # * LW-qt6Ana3.pkg.macos-Monterey-release-Rana3Pana3
# * LW-qt6Brew.pkg.macos-Catalina-release-Rhb32Phb39 # * LW-qt6Brew.pkg.macos-Monterey-release-Rhb32Phb311
# * LW-qt6MP.pkg.macos-Catalina-release-Rmp32Pmp39 # * LW-qt6MP.pkg.macos-Monterey-release-Rmp32Pmp311
# * HW-qt6Brew.pkg.macos-Catalina-release-RsysPhb39 # * HW-qt6Brew.pkg.macos-Monterey-release-RsysPhb311
# #
# Generated DMG will be, for example, # Generated DMG will be, for example,
# (1) ---> LW-klayout-0.28.4-macOS-Catalina-1-qt5Brew-Rhb32Phb39.dmg # (1) ---> LW-klayout-0.28.13-macOS-Monterey-1-qt5Brew-Rhb32Phb311.dmg
# #
# @return on success, positive integer in [MB] that tells approx. occupied disc space; # @return on success, positive integer in [MB] that tells approx. occupied disc space;
# on failure, -1 # on failure, -1
@ -257,19 +241,18 @@ def CheckPkgDirectory():
#----------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------
# [2] Identify (Qt, Ruby, Python) from PkgDir # [2] Identify (Qt, Ruby, Python) from PkgDir
# * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys # 'ST' has been restored in 0.28.3 # * LW-qt5Ana3.pkg.macos-Monterey-release-Rana3Pana3
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3 # * LW-qt5Brew.pkg.macos-Monterey-release-Rhb32Phb311
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb32Phb39 # * LW-qt5MP.pkg.macos-Monterey-release-Rmp32Pmp311
# * LW-qt5MP.pkg.macos-Catalina-release-Rmp32Pmp39 # * HW-qt5Brew.pkg.macos-Monterey-release-RsysPhb311
# * HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb39 # * EX-qt5MP.pkg.macos-Monterey-release-Rhb32Pmp311
# * EX-qt5MP.pkg.macos-Catalina-release-Rhb32Pmp39
# #
# * LW-qt6Ana3.pkg.macos-Catalina-release-Rana3Pana3 # * LW-qt6Ana3.pkg.macos-Monterey-release-Rana3Pana3
# * LW-qt6Brew.pkg.macos-Catalina-release-Rhb32Phb39 # * LW-qt6Brew.pkg.macos-Monterey-release-Rhb32Phb311
# * LW-qt6MP.pkg.macos-Catalina-release-Rmp32Pmp39 # * LW-qt6MP.pkg.macos-Monterey-release-Rmp32Pmp311
# * HW-qt6Brew.pkg.macos-Catalina-release-RsysPhb39 # * HW-qt6Brew.pkg.macos-Monterey-release-RsysPhb311
#----------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------
patQRP = u'(ST|LW|HW|EX)([-])([qt5|qt6][0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-]release[-])([0-9A-Za-z]+)' patQRP = u'(LW|HW|EX)([-])([qt5|qt6][0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-]release[-])([0-9A-Za-z]+)'
regQRP = re.compile(patQRP) regQRP = re.compile(patQRP)
if not regQRP.match(PkgDir): if not regQRP.match(PkgDir):
print( "! Cannot identify (Qt, Ruby, Python) from the package directory name" ) print( "! Cannot identify (Qt, Ruby, Python) from the package directory name" )
@ -297,14 +280,12 @@ def CheckPkgDirectory():
LatestOSMacPorts = Platform == LatestOS LatestOSMacPorts = Platform == LatestOS
LatestOSMacPorts &= PackagePrefix == "LW" LatestOSMacPorts &= PackagePrefix == "LW"
LatestOSMacPorts &= QtIdentification in [ "qt5MP", "qt6MP" ] LatestOSMacPorts &= QtIdentification in [ "qt5MP", "qt6MP" ]
LatestOSMacPorts &= RubyPythonID in [ "Rmp31Pmp38", "Rmp31Pmp39", \ LatestOSMacPorts &= RubyPythonID in [ "Rmp32Pmp311", "Rmp32Pmp39" ]
"Rmp32Pmp38", "Rmp32Pmp39" ]
LatestOSHomebrew = Platform == LatestOS LatestOSHomebrew = Platform == LatestOS
LatestOSHomebrew &= PackagePrefix == "LW" LatestOSHomebrew &= PackagePrefix == "LW"
LatestOSHomebrew &= QtIdentification in [ "qt5Brew", "qt6Brew" ] LatestOSHomebrew &= QtIdentification in [ "qt5Brew", "qt6Brew" ]
LatestOSHomebrew &= RubyPythonID in [ "Rhb31Phb38", "Rhb31Phb39", "Rhb31Phbauto", \ LatestOSHomebrew &= RubyPythonID in [ "Rhb32Phb311", "Rhb32Phb39", "Rhb32Phbauto" ]
"Rhb32Phb38", "Rhb32Phb39", "Rhb32Phbauto" ]
LatestOSAnaconda3 = Platform == LatestOS LatestOSAnaconda3 = Platform == LatestOS
LatestOSAnaconda3 &= PackagePrefix == "LW" LatestOSAnaconda3 &= PackagePrefix == "LW"
@ -314,7 +295,7 @@ def CheckPkgDirectory():
LatestOSHomebrewH = Platform == LatestOS LatestOSHomebrewH = Platform == LatestOS
LatestOSHomebrewH &= PackagePrefix == "HW" LatestOSHomebrewH &= PackagePrefix == "HW"
LatestOSHomebrewH &= QtIdentification in [ "qt5Brew", "qt6Brew" ] LatestOSHomebrewH &= QtIdentification in [ "qt5Brew", "qt6Brew" ]
LatestOSHomebrewH &= RubyPythonID in [ "RsysPhb39", "RsysPhb39", "RsysPhbauto" ] # Sys-Homebre hybrid LatestOSHomebrewH &= RubyPythonID in [ "RsysPhb311", "RsysPhb39", "RsysPhbauto" ] # Sys-Homebre hybrid
if LatestOSMacPorts: if LatestOSMacPorts:
mydic = DicLightHeavyW["ports"] mydic = DicLightHeavyW["ports"]

View File

@ -16,29 +16,19 @@ import subprocess
# #
# @return matching platform name on success; "" on failure # @return matching platform name on success; "" on failure
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
def Test_My_Platform( platforms=[ 'Catalina', 'BigSur', 'Monterey', 'Ventura' ] ): def Test_My_Platform( platforms=[ 'Monterey', 'Ventura', 'Sonoma' ] ):
(System, Node, Release, MacVersion, Machine, Processor) = platform.uname() (System, Node, Release, MacVersion, Machine, Processor) = platform.uname()
if not System == "Darwin": if not System == "Darwin":
return "" return ""
release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0'] release = int( Release.split(".")[0] ) # take the first of ['21', '0', '0']
if release == 22: if release == 23:
Platform = "Sonoma"
elif release == 22:
Platform = "Ventura" Platform = "Ventura"
elif release == 21: elif release == 21:
Platform = "Monterey" Platform = "Monterey"
elif release == 20:
Platform = "BigSur"
elif release == 19:
Platform = "Catalina"
elif release == 18:
Platform = "Mojave"
elif release == 17:
Platform = "HighSierra"
elif release == 16:
Platform = "Sierra"
elif release == 15:
Platform = "ElCapitan"
else: else:
Platform = "" Platform = ""
@ -54,7 +44,7 @@ def Test_My_Platform( platforms=[ 'Catalina', 'BigSur', 'Monterey', 'Ventura' ]
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
def Get_Build_Target_Dict(): def Get_Build_Target_Dict():
buildTargetDic = dict() buildTargetDic = dict()
buildTargetDic[0] = 'std' # has been restored in 0.28.3 # buildTargetDic[0] = 'std'
buildTargetDic[1] = 'ports' buildTargetDic[1] = 'ports'
buildTargetDic[2] = 'brew' buildTargetDic[2] = 'brew'
buildTargetDic[3] = 'brewHW' buildTargetDic[3] = 'brewHW'
@ -88,14 +78,14 @@ def Get_Build_Options( targetDic, platform ):
buildOp["std"] = [ '-q', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'sys' ] buildOp["std"] = [ '-q', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'sys' ]
logfile["std"] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPsys") logfile["std"] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPsys")
elif target == "ports": elif target == "ports":
buildOp["ports"] = [ '-q', '%sMacPorts' % qtType, '-r', 'MP32', '-p', 'MP39' ] buildOp["ports"] = [ '-q', '%sMacPorts' % qtType, '-r', 'MP32', '-p', 'MP311' ]
logfile["ports"] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rmp32Pmp39") logfile["ports"] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rmp32Pmp311")
elif target == "brew": elif target == "brew":
buildOp["brew"] = [ '-q', '%sBrew' % qtType, '-r', 'HB32', '-p', 'HB39' ] buildOp["brew"] = [ '-q', '%sBrew' % qtType, '-r', 'HB32', '-p', 'HB311' ]
logfile["brew"] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rhb32Phb39") logfile["brew"] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rhb32Phb311")
elif target == "brewHW": elif target == "brewHW":
buildOp["brewHW"] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HB39' ] buildOp["brewHW"] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HB311' ]
logfile["brewHW"] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPhb39") logfile["brewHW"] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPhb311")
elif target == "ana3": elif target == "ana3":
buildOp["ana3"] = [ '-q', '%sAna3' % qtType, '-r', 'Ana3', '-p', 'Ana3' ] buildOp["ana3"] = [ '-q', '%sAna3' % qtType, '-r', 'Ana3', '-p', 'Ana3' ]
logfile["ana3"] = "%sAna3.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rana3Pana3") logfile["ana3"] = "%sAna3.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rana3Pana3")
@ -130,14 +120,12 @@ def Get_QAT_Directory( targetDic, platform ):
dirQAT = dict() dirQAT = dict()
for key in targetDic.keys(): for key in targetDic.keys():
target = targetDic[key] target = targetDic[key]
if target == "std": if target == "ports":
dirQAT["std"] = '%sMP.build.macos-%s-release-RsysPsys.macQAT' % (qtType, platform) dirQAT["ports"] = '%sMP.build.macos-%s-release-Rmp32Pmp311.macQAT' % (qtType, platform)
elif target == "ports":
dirQAT["ports"] = '%sMP.build.macos-%s-release-Rmp32Pmp39.macQAT' % (qtType, platform)
elif target == "brew": elif target == "brew":
dirQAT["brew"] = '%sBrew.build.macos-%s-release-Rhb32Phb39.macQAT' % (qtType, platform) dirQAT["brew"] = '%sBrew.build.macos-%s-release-Rhb32Phb311.macQAT' % (qtType, platform)
elif target == "brewHW": elif target == "brewHW":
dirQAT["brewHW"] = '%sBrew.build.macos-%s-release-RsysPhb39.macQAT' % (qtType, platform) dirQAT["brewHW"] = '%sBrew.build.macos-%s-release-RsysPhb311.macQAT' % (qtType, platform)
elif target == "ana3": elif target == "ana3":
dirQAT["ana3"] = '%sAna3.build.macos-%s-release-Rana3Pana3.macQAT' % (qtType, platform) dirQAT["ana3"] = '%sAna3.build.macos-%s-release-Rana3Pana3.macQAT' % (qtType, platform)
elif target == "brewA": elif target == "brewA":
@ -170,17 +158,14 @@ def Get_Package_Options( targetDic, platform, srlDMG, makeflag ):
packOp = dict() packOp = dict()
for key in targetDic.keys(): for key in targetDic.keys():
target = targetDic[key] target = targetDic[key]
if target == "std": if target == "ports":
packOp["std"] = [ '-p', 'ST-%sMP.pkg.macos-%s-release-RsysPsys' % (qtType, platform), packOp["ports"] = [ '-p', 'LW-%sMP.pkg.macos-%s-release-Rmp32Pmp311' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "ports":
packOp["ports"] = [ '-p', 'LW-%sMP.pkg.macos-%s-release-Rmp32Pmp39' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ] '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brew": elif target == "brew":
packOp["brew"] = [ '-p', 'LW-%sBrew.pkg.macos-%s-release-Rhb32Phb39' % (qtType, platform), packOp["brew"] = [ '-p', 'LW-%sBrew.pkg.macos-%s-release-Rhb32Phb311' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ] '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brewHW": elif target == "brewHW":
packOp["brewHW"] = [ '-p', 'HW-%sBrew.pkg.macos-%s-release-RsysPhb39' % (qtType, platform), packOp["brewHW"] = [ '-p', 'HW-%sBrew.pkg.macos-%s-release-RsysPhb311' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ] '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "ana3": elif target == "ana3":
packOp["ana3"] = [ '-p', 'LW-%sAna3.pkg.macos-%s-release-Rana3Pana3' % (qtType, platform), packOp["ana3"] = [ '-p', 'LW-%sAna3.pkg.macos-%s-release-Rana3Pana3' % (qtType, platform),
@ -212,23 +197,24 @@ def Parse_CommandLine_Arguments():
global DryRun # True for dry-run global DryRun # True for dry-run
platform = Test_My_Platform() platform = Test_My_Platform()
if platform in [ "Ventura", "Monterey", "BigSur" ]: if platform in [ "Sonoma", "Ventura", "Monterey" ]:
targetopt = "1,2,3,4" targetopt = "1,2,3,4"
else: else:
targetopt = "0,1,2,3,4" targetopt = "0"
Usage = "\n" Usage = "\n"
Usage += "----------------------------------------------------------------------------------------------------------\n" Usage += "----------------------------------------------------------------------------------------------------------\n"
Usage += " nightlyBuild.py [EXPERIMENTAL] \n" Usage += " nightlyBuild.py [EXPERIMENTAL]\n"
Usage += " << To execute the jobs for making KLayout's DMGs for macOS Catalina, Big Sur, Monterey, or Ventura >>\n" Usage += " << To execute the jobs for making KLayout's DMGs for\n"
Usage += " macOS Monterey, Ventura, or Sonoma >>\n"
Usage += "\n" Usage += "\n"
Usage += "$ [python] nightlyBuild.py\n" Usage += "$ [python] nightlyBuild.py\n"
Usage += " option & argument : comment on option if any | default value\n" Usage += " option & argument : comment on option if any | default value\n"
Usage += " ------------------------------------------------------------------------+--------------\n" Usage += " ------------------------------------------------------------------------+--------------\n"
Usage += " [--qt <type>] : 5='qt5', 6='qt6' (migration to Qt6 is ongoing) | 5\n" Usage += " [--qt <type>] : 5='qt5', 6='qt6' (migration to Qt6 is ongoing) | 5\n"
Usage += " [--target <list>] : 0='std' 1='ports', 2='brew', 3='brewHW', 4='ana3', | '%s'\n" % targetopt Usage += " [--target <list>] : 1='ports', 2='brew', 3='brewHW', 4='ana3', | '%s'\n" % targetopt
Usage += " 5='brewA', 6='brewAHW' | \n" Usage += " 5='brewA', 6='brewAHW' |\n"
Usage += " * with --qt=6, use --target='2,3' (4 is ignored) | \n" Usage += " * with --qt=6, use --target='2,3' (4 is ignored) |\n"
Usage += " [--build] : build and deploy | disabled\n" Usage += " [--build] : build and deploy | disabled\n"
Usage += " [--pymod] : build and deploy Pymod, too | disabled\n" Usage += " [--pymod] : build and deploy Pymod, too | disabled\n"
Usage += " [--test] : run the QA Test | disabled\n" Usage += " [--test] : run the QA Test | disabled\n"
@ -237,18 +223,18 @@ def Parse_CommandLine_Arguments():
Usage += " [--upload <dropbox>] : upload DMGs to $HOME/Dropbox/klayout/<dropbox> | disabled\n" Usage += " [--upload <dropbox>] : upload DMGs to $HOME/Dropbox/klayout/<dropbox> | disabled\n"
Usage += " [--dryrun] : dry-run for --build option | disabled\n" Usage += " [--dryrun] : dry-run for --build option | disabled\n"
Usage += " [-?|--?] : print this usage and exit | disabled\n" Usage += " [-?|--?] : print this usage and exit | disabled\n"
Usage += " | \n" Usage += " |\n"
Usage += " To use this script, make a symbolic link in the project root by: | \n" Usage += " To use this script, make a symbolic link in the project root by: |\n"
Usage += " $ ln -s ./macbuild/nightlyBuild.py . | \n" Usage += " $ ln -s ./macbuild/nightlyBuild.py . |\n"
Usage += " | \n" Usage += " |\n"
Usage += " Regular sequence for using this script: | \n" Usage += " Regular sequence for using this script: |\n"
Usage += " (1) $ ./nightlyBuild.py --build --pymod | \n" Usage += " (1) $ ./nightlyBuild.py --build --pymod |\n"
Usage += " (2) (confirm the build results) | \n" Usage += " (2) (confirm the build results) |\n"
Usage += " (3) $ ./nightlyBuild.py --test | \n" Usage += " (3) $ ./nightlyBuild.py --test |\n"
Usage += " (4) $ ./nightlyBuild.py --check (confirm the QA Test results) | \n" Usage += " (4) $ ./nightlyBuild.py --check (confirm the QA Test results) |\n"
Usage += " (5) $ ./nightlyBuild.py --makedmg 1 | \n" Usage += " (5) $ ./nightlyBuild.py --makedmg 1 |\n"
Usage += " (6) $ ./nightlyBuild.py --upload '0.28.4' | \n" Usage += " (6) $ ./nightlyBuild.py --upload '0.28.12' |\n"
Usage += " (7) $ ./nightlyBuild.py --cleandmg 1 | \n" Usage += " (7) $ ./nightlyBuild.py --cleandmg 1 |\n"
Usage += "---------------------------------------------------------------------------+------------------------------\n" Usage += "---------------------------------------------------------------------------+------------------------------\n"
p = optparse.OptionParser( usage=Usage ) p = optparse.OptionParser( usage=Usage )
@ -325,9 +311,9 @@ def Parse_CommandLine_Arguments():
print(Usage) print(Usage)
quit() quit()
myPlatform = Test_My_Platform( [ 'Catalina', 'BigSur', 'Monterey', 'Ventura' ] ) myPlatform = Test_My_Platform( [ 'Monterey', 'Ventura', 'Sonoma' ] )
if myPlatform == "": if myPlatform == "":
print( "! Current platform is not [ 'Catalina', 'BigSur', 'Monterey', 'Ventura' ]" ) print( "! Current platform is not [ 'Monterey', 'Ventura', 'Sonoma' ]" )
print(Usage) print(Usage)
quit() quit()
@ -345,7 +331,7 @@ def Parse_CommandLine_Arguments():
targetDic = Get_Build_Target_Dict() targetDic = Get_Build_Target_Dict()
Target = list() Target = list()
for idx in targetIdx: for idx in targetIdx:
if idx in range(0, 7): # '0' has been restored in 0.28.3 if idx in range(1, 7):
Target.append( targetDic[idx] ) Target.append( targetDic[idx] )
Build = opt.build Build = opt.build
@ -394,7 +380,7 @@ def Build_Deploy():
command1 = [ pyBuilder ] + buildOp[key] command1 = [ pyBuilder ] + buildOp[key]
if key in [ "std", "brewHW", "brewAHW" ] : if key in [ "brewHW", "brewAHW" ] :
command2 = "time" command2 = "time"
command2 += " \\\n %s" % pyBuilder command2 += " \\\n %s" % pyBuilder
for option in buildOp[key]: for option in buildOp[key]:

View File

@ -31,12 +31,13 @@ def SetGlobals():
Usage += "<< Usage of 'python3HB.py' >>\n" Usage += "<< Usage of 'python3HB.py' >>\n"
Usage += " to setup the standardized directory structures for Homebrew's Python 3.x on Mac\n" Usage += " to setup the standardized directory structures for Homebrew's Python 3.x on Mac\n"
Usage += "\n" Usage += "\n"
Usage += " option & argument : descriptions | default value\n" Usage += " option & argument : descriptions | default value\n"
Usage += " -----------------------------------------------------------+---------------\n" Usage += " -------------------------------------------------------------------+----------\n"
Usage += " <-v|--version <number>>: in ['3.8', '3.9', '3.10', '3.11'] | ''\n" Usage += " <-v|--version <number>>: in ['3.8', '3.9', '3.10', '3.11', '3.12', | ''\n"
Usage += " [-u|-unlink] : unlink only | disabled\n" Usage += " '3.13'] | ''\n"
Usage += " [-?|--?] : print this usage and exit | disabled\n" Usage += " [-u|-unlink] : unlink only | disabled\n"
Usage += "--------------------------------------------------------------+----------------------\n" Usage += " [-?|--?] : print this usage and exit | disabled\n"
Usage += "----------------------------------------------------------------------+--------------\n"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Parse the command line arguments # Parse the command line arguments
@ -49,7 +50,7 @@ def Parse_CLI_Args():
p.add_option( '-v', '--version', p.add_option( '-v', '--version',
dest='version', dest='version',
help="python3 version=['3.8', '3.9', '3.10', '3.11']" ) help="python3 version=['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']" )
p.add_option( '-u', '--unlink', p.add_option( '-u', '--unlink',
action='store_true', action='store_true',
@ -74,7 +75,7 @@ def Parse_CLI_Args():
Version = opt.version Version = opt.version
UnlinkOnly = opt.unlink UnlinkOnly = opt.unlink
if not Version in [ '3.8', '3.9', '3.10', '3.11' ]: if not Version in [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]:
print( "! Unsupported Python 3 version <%s>" % Version ) print( "! Unsupported Python 3 version <%s>" % Version )
print(Usage) print(Usage)
sys.exit(0) sys.exit(0)

View File

@ -104,9 +104,15 @@ equals(HAVE_PTHREADS, "1") {
} }
equals(HAVE_GIT2, "1") { equals(HAVE_GIT2, "1") {
!isEmpty(BITS_PATH) { !mac {
include($$BITS_PATH/git2/git2.pri) !isEmpty(BITS_PATH) {
include($$BITS_PATH/git2/git2.pri)
} else {
LIBS += -lgit2
}
} else { } else {
QMAKE_INCDIR += $$(MAC_LIBGIT2_INC)
QMAKE_LFLAGS += -L$$(MAC_LIBGIT2_LIB)
LIBS += -lgit2 LIBS += -lgit2
} }
DEFINES += HAVE_GIT2 DEFINES += HAVE_GIT2