Merge branch 'issue-1237' into network-drc

This commit is contained in:
Matthias Koefferlein 2023-01-17 20:45:00 +01:00
commit bd79467b4b
17 changed files with 331 additions and 196 deletions

View File

@ -1,13 +1,13 @@
Relevant KLayout version: 0.28.2<br> Relevant KLayout version: 0.28.3<br>
Author: Kazzz-S<br> Author: Kazzz-S<br>
Last modified: 2022-12-24<br> Last modified: 2023-01-13<br>
# 1. Introduction # 1. Introduction
This directory **`macbuild`** contains various files required for building KLayout (http://www.klayout.de/) version 0.28.2 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.3 or later for different 64-bit macOS, including:
* Catalina (10.15.7) : the primary development environment * Catalina (10.15.7) : the primary development environment
* Big Sur (11.x) : experimental; Apple M1 chip is not tested since the author does not own an M1 Mac * Big Sur (11.x) : experimental; Apple (M1|M2) chip is not tested since the author does not own an (M1|M2) Mac
* Monterey (12.x) : -- ditto -- * Monterey (12.x) : -- ditto --
* Ventura (13.x) : planning * 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 should still be possible. <br>
However, they are not actively supported, and DMG packages are not provided. However, they are not actively supported, and DMG packages are not provided.
@ -27,7 +27,7 @@ The default Qt framework is "Qt5" from MacPorts (https://www.macports.org/), whi
/opt/local/libexec/qt5/ /opt/local/libexec/qt5/
``` ```
**((Notes))** For **Big Sur** and **Monterey** **((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:
``` ```
@ -54,10 +54,9 @@ $ /usr/bin/ruby -v
$ /usr/bin/python --version $ /usr/bin/python --version
Python 2.7.16 Python 2.7.16
``` ```
This configuration WAS possible only for macOS Catalina (10.15.7).<br> Note that this configuration for backward compatibility is possible only for macOS Catalina (10.15.7).<br>
However, it is no longer supported since KLayout version 0.28.x~ uses some Python3-specific features. In contrast, Homebrew's Ruby 3.1 and Python 3.9 are the default environment for Big Sur, Monterey, and Ventura.<br>
Therefore, MacPorts' Ruby 3.1 and Python 3.8 are adopted as the default environment for Catalina. Since Python 2.7 is already deprecated, using MacPorts' or Homebrew's Ruby 3.1 and Python 3.9 are also recommended for Catalina.
In contrast, Homebrew's Ruby 3.1 and Python 3.8 are the default environment for Big Sur and Monterey.
The build script **`build4mac.py`** provides several possible combinations of Qt5, Ruy, and Python modules to accommodate such a slightly complex environment.<br> 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.
@ -74,7 +73,7 @@ You need to have the followings:
``` ```
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >> << Usage of 'build4mac.py' >>
for building KLayout 0.28 or later on different Apple macOS / Mac OSX platforms. for building KLayout 0.28.3 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
@ -87,18 +86,20 @@ $ [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'] | mp31 [-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP31', 'HB31', 'Ana3'] | sys
: nil: don't bind Ruby | : nil: don't bind Ruby |
: Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS | : Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS |
: MP31: use Ruby 3.1 from MacPorts | : MP31: use Ruby 3.1 from MacPorts |
: HB31: use Ruby 3.1 from Homebrew | : HB31: use Ruby 3.1 from Homebrew |
: Ana3: use Ruby 3.1 from Anaconda3 | : Ana3: use Ruby 3.1 from Anaconda3 |
[-p|--python <type>] : case-insensitive type=['nil', 'MP38', 'HB38', 'Ana3', | mp38 [-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | sys
: HB39', 'HBAuto'] | : 'MP39', HB39', 'HBAuto'] |
: nil: don't bind Python | : nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 up to Catalina |
: MP38: use Python 3.8 from MacPorts | : MP38: use Python 3.8 from MacPorts |
: HB38: use Python 3.8 from Homebrew | : HB38: use Python 3.8 from Homebrew |
: Ana3: use Python 3.8 from Anaconda3 | : Ana3: use Python 3.9 from Anaconda3 |
: MP39: use Python 3.9 from MacPorts |
: HB39: use Python 3.9 from Homebrew | : HB39: use Python 3.9 from Homebrew |
: 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 and *.egg) for LW-*.dmg | disabled
@ -122,11 +123,11 @@ $ [python] ./build4mac.py
-----------------------------------------------------------------------------------------+--------------- -----------------------------------------------------------------------------------------+---------------
``` ```
**((Notes))** For **Big Sur** and **Monterey** **((Notes))** For **Big Sur**, **Monterey**, and **Ventura**
``` ```
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >> << Usage of 'build4mac.py' >>
for building KLayout 0.28 or later on different Apple macOS / Mac OSX platforms. for building KLayout 0.28.3 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
@ -145,12 +146,14 @@ $ [python] ./build4mac.py
: MP31: use Ruby 3.1 from MacPorts | : MP31: use Ruby 3.1 from MacPorts |
: HB31: use Ruby 3.1 from Homebrew | : HB31: use Ruby 3.1 from Homebrew |
: Ana3: use Ruby 3.1 from Anaconda3 | : Ana3: use Ruby 3.1 from Anaconda3 |
[-p|--python <type>] : case-insensitive type=['nil', 'MP38', 'HB38', 'Ana3', | hb38 [-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | hb39
: HB39', 'HBAuto'] | : 'MP39', HB39', 'HBAuto'] |
: nil: don't bind Python | : nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 up to Catalina |
: MP38: use Python 3.8 from MacPorts | : MP38: use Python 3.8 from MacPorts |
: HB38: use Python 3.8 from Homebrew | : HB38: use Python 3.8 from Homebrew |
: Ana3: use Python 3.8 from Anaconda3 | : Ana3: use Python 3.9 from Anaconda3 |
: MP39: use Python 3.9 from MacPorts |
: HB39: use Python 3.9 from Homebrew | : HB39: use Python 3.9 from Homebrew |
: 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 and *.egg) for LW-*.dmg | disabled
@ -178,20 +181,51 @@ $ [python] ./build4mac.py
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 Catalina.<br>
On different OS, those names differ accordingly. On different OS, those names differ accordingly.
### 6A. Fully MacPorts-flavored build with MacPorts Ruby 3.1 and MacPorts Python 3.8 ### 6A. Standard build using the OS-bundled Ruby and Python **((Notes))** only for Catalina
0. Install MacPorts, then install Qt5, Ruby 3.1, and Python 3.8 by 0. Install MacPorts, then install Qt5 by
```
$ 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>
Then the directory name will be **`LW-qt5MP.pkg.macos-Catalina-release-RsysPsys`**, where
* "LW-" means that this is a lightweight package.
#### If you build KLayout from the source code AND run it on the same machine, the "-Y" option is highly recommended.
### 6B. Fully MacPorts-flavored build with MacPorts Ruby 3.1 and MacPorts Python 3.9
0. Install MacPorts, then install Qt5, Ruby 3.1, and Python 3.9 by
``` ```
$ sudo port install coreutils $ sudo port install coreutils
$ sudo port install findutils $ sudo port install findutils
$ sudo port install qt5 $ sudo port install qt5
$ sudo port install ruby31 $ sudo port install ruby31
$ sudo port install python38 $ sudo port install python39
$ sudo port install py38-pip $ sudo port install py39-pip
``` ```
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 qt5macports -r mp31 -p mp38 $ ./build4mac.py -q qt5macports -r mp31 -p mp39
``` ```
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>
@ -199,26 +233,26 @@ $ ./build4mac.py -q qt5macports -r mp31 -p mp38
If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl, \*.egg) 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, \*.egg) will be built and deployed under **klayout.app/Contents/pymod-dist/**.
``` ```
$ ./build4mac.py -q qt5macports -r mp31 -p mp38 -Y $ ./build4mac.py -q qt5macports -r mp31 -p mp39 -Y
``` ```
The application bundle **`klayout.app`** is located under:<br> The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp38`** directory, where **`LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp39`** directory, where
* "LW-" means this is a lightweight package. * "LW-" means this is a lightweight package.
* "qt5MP" means that Qt5 from MacPorts is used. * "qt5MP" means that Qt5 from MacPorts is used.
* "Rmp31Pmp38" means that Ruby is 3.1 from MacPorts; Python is 3.8 from MacPorts. * "Rmp31Pmp39" means that Ruby is 3.1 from MacPorts; Python is 3.9 from MacPorts.
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.
### 6B. Fully Homebrew-flavored build with Homebrew Ruby 3.1 and Homebrew Python 3.8 ### 6C. Fully Homebrew-flavored build with Homebrew Ruby 3.1 and Homebrew Python 3.9
0. Install Homebrew, then install Qt5, Ruby 3.1, and Python 3.8 by 0. Install Homebrew, then install Qt5, Ruby 3.1, and Python 3.9 by
``` ```
$ brew install qt@5 $ brew install qt@5
$ brew install ruby@3.1 $ brew install ruby@3.1
$ brew install python@3.8 $ brew install python@3.9
``` ```
1. Invoke **`build4mac.py`** with the following options: **((Notes))** These options are the default for Big Sur and Monterey. 1. Invoke **`build4mac.py`** with the following options: **((Notes))** These options are the default for Big Sur, Monterey, and Ventura.
``` ```
$ cd /where/'build.sh'/exists $ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5brew -r hb31 -p hb38 $ ./build4mac.py -q qt5brew -r hb31 -p hb39
``` ```
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>
@ -226,47 +260,47 @@ $ ./build4mac.py -q qt5brew -r hb31 -p hb38
If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl, \*.egg) 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, \*.egg) will be built and deployed under **klayout.app/Contents/pymod-dist/**.
``` ```
$ ./build4mac.py -q qt5brew -r hb31 -p hb38 -Y $ ./build4mac.py -q qt5brew -r hb31 -p hb39 -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-Rhb31Phb38`** directory, where **`LW-qt5Brew.pkg.macos-Catalina-release-Rhb31Phb39`** 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.
* "Rhb31Phb38" means that Ruby is 3.1 from Homebrew; Python is 3.8 from Homebrew. * "Rhb31Phb39" means that Ruby is 3.1 from Homebrew; Python is 3.9 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.
### 6C. Partially Homebrew-flavored build with System Ruby and Homebrew Python 3.8 ### 6D. Partially Homebrew-flavored build with System Ruby and Homebrew Python 3.9
0. Install Homebrew, then install Qt5 and Python 3.8 by 0. Install Homebrew, then install Qt5 and Python 3.9 by
``` ```
$ brew install qt@5 $ brew install qt@5
$ brew install python@3.8 $ brew install python@3.9
``` ```
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 hb38 $ ./build4mac.py -q qt5brew -r sys -p hb39
``` ```
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 hb38 -y $ ./build4mac.py -q qt5brew -r sys -p hb39 -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-RsysPhb38`** directory, where **`HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb39`** 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.
* "RsysPhb38" means that Ruby is OS-bundled; Python is 3.8 from Homebrew. * "RsysPhb39" means that Ruby is OS-bundled; Python is 3.9 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.
### 6D. Fully Anaconda3-flavored build with Anaconda3 Ruby 3.1 and Anaconda3 Python 3.8 ### 6E. Fully Anaconda3-flavored build with Anaconda3 Ruby 3.1 and Anaconda3 Python 3.9
0. Install Anaconda3, then install Ruby 3.1 by 0. Install Anaconda3, then install Ruby 3.1 by
``` ```
$ conda install ruby $ conda install ruby=3.1.2
``` ```
1. Invoke **`build4mac.py`** with the following options: 1. Invoke **`build4mac.py`** with the following options:
``` ```
@ -285,21 +319,21 @@ $ ./build4mac.py -q qt5ana3 -r ana3 -p ana3 -Y
**`LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3`** directory, where **`LW-qt5Ana3.pkg.macos-Catalina-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.8) is from Anaconda3. * "Rana3Pana3" means that Ruby (3.1) is from Anaconda3; Python (3.9) 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:
``` ```
export PYTHONHOME=$HOME/opt/anaconda3 export PYTHONHOME=$HOME/opt/anaconda3
``` ```
### 6E. Other combinations ### 6F. Other combinations
Logically, several module combinations other than 6A through 6D are possible, including `nil` choice.<br> Logically, several module combinations other than 6A 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`**. 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 6A through 6D).
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,
@ -309,11 +343,11 @@ 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-Rmp31Pmp38 -m $ ./makeDMG4mac.py -p LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp39 -m
``` ```
This command will generate the two files below:<br> This command will generate the two files below:<br>
* **`LW-klayout-0.28.2-macOS-Catalina-1-qt5MP-Rmp31Pmp38.dmg`** ---(1) the main DMG file * **`LW-klayout-0.28.3-macOS-Catalina-1-qt5MP-Rmp31Pmp39.dmg`** ---(1) the main DMG file
* **`LW-klayout-0.28.2-macOS-Catalina-1-qt5MP-Rmp31Pmp38.dmg.md5`** ---(2) MD5-value text file * **`LW-klayout-0.28.3-macOS-Catalina-1-qt5MP-Rmp31Pmp39.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 MacPorts, Homebrew, or Anaconda3 may cause build- and link errors.<br>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -33,21 +33,21 @@ from build4mac_util import *
# @return (usage, moduleset)-tuple # @return (usage, moduleset)-tuple
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
def GenerateUsage(platform): def GenerateUsage(platform):
if platform.upper() in [ "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ] if platform.upper() in [ "VENTURA", "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
myQt56 = "qt5brew" myQt56 = "qt5brew"
myRuby = "hb31" myRuby = "hb31"
myPython = "hb38" myPython = "hb39"
moduleset = ('qt5Brew', 'HB31', 'HB38') moduleset = ('qt5Brew', 'HB31', 'HB39')
else: # with Xcode [ .. 12.4]; 'sys' for Python has been abolished in 0.28 else: # with Xcode [ .. 12.4]; 'sys' for Python has been restored in 0.28.3
myQt56 = "qt5macports" myQt56 = "qt5macports"
myRuby = "mp31" myRuby = "sys"
myPython = "mp38" myPython = "sys"
moduleset = ('qt5MP', 'MP31', 'MP38') moduleset = ('qt5MP', 'Sys', 'Sys')
usage = "\n" usage = "\n"
usage += "---------------------------------------------------------------------------------------------------------\n" usage += "---------------------------------------------------------------------------------------------------------\n"
usage += "<< Usage of 'build4mac.py' >>\n" usage += "<< Usage of 'build4mac.py' >>\n"
usage += " for building KLayout 0.28 or later on different Apple macOS / Mac OSX platforms.\n" usage += " for building KLayout 0.28.3 or later on different Apple macOS / Mac OSX platforms.\n"
usage += "\n" usage += "\n"
usage += "$ [python] ./build4mac.py\n" usage += "$ [python] ./build4mac.py\n"
usage += " option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value\n" usage += " option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value\n"
@ -66,12 +66,14 @@ def GenerateUsage(platform):
usage += " : MP31: use Ruby 3.1 from MacPorts | \n" usage += " : MP31: use Ruby 3.1 from MacPorts | \n"
usage += " : HB31: use Ruby 3.1 from Homebrew | \n" usage += " : HB31: use Ruby 3.1 from Homebrew | \n"
usage += " : Ana3: use Ruby 3.1 from Anaconda3 | \n" usage += " : Ana3: use Ruby 3.1 from Anaconda3 | \n"
usage += " [-p|--python <type>] : case-insensitive type=['nil', 'MP38', 'HB38', 'Ana3', | %s \n" % myPython usage += " [-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | %s \n" % myPython
usage += " : HB39', 'HBAuto'] | \n" usage += " : 'MP39', HB39', 'HBAuto'] | \n"
usage += " : nil: don't bind Python | \n" usage += " : nil: don't bind Python | \n"
usage += " : Sys: use OS-bundled Python 2.7 up to Catalina | \n"
usage += " : MP38: use Python 3.8 from MacPorts | \n" usage += " : MP38: use Python 3.8 from MacPorts | \n"
usage += " : HB38: use Python 3.8 from Homebrew | \n" usage += " : HB38: use Python 3.8 from Homebrew | \n"
usage += " : Ana3: use Python 3.8 from Anaconda3 | \n" usage += " : Ana3: use Python 3.9 from Anaconda3 | \n"
usage += " : MP39: use Python 3.9 from MacPorts | \n"
usage += " : HB39: use Python 3.9 from Homebrew | \n" usage += " : HB39: use Python 3.9 from Homebrew | \n"
usage += " : HBAuto: use the latest Python 3.x auto-detected from Homebrew | \n" usage += " : HBAuto: use the latest Python 3.x auto-detected from Homebrew | \n"
usage += " [-P|--buildPymod] : build and deploy Pymod (*.whl and *.egg) for LW-*.dmg | disabled\n" usage += " [-P|--buildPymod] : build and deploy Pymod (*.whl and *.egg) for LW-*.dmg | disabled\n"
@ -112,7 +114,9 @@ def Get_Default_Config():
sys.exit(1) sys.exit(1)
release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0'] release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0']
if release == 21: if release == 22:
Platform = "Ventura"
elif release == 21:
Platform = "Monterey" Platform = "Monterey"
elif release == 20: elif release == 20:
Platform = "BigSur" Platform = "BigSur"
@ -134,7 +138,7 @@ def Get_Default_Config():
sys.exit(1) sys.exit(1)
if not Machine == "x86_64": if not Machine == "x86_64":
if Machine == "arm64" and Platform in ["Monterey", "BigSur"]: # with an Apple Silicon Chip if Machine == "arm64" and Platform in ["Ventura", "Monterey", "BigSur"]: # 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("")
@ -148,10 +152,14 @@ def Get_Default_Config():
Usage, ModuleSet = GenerateUsage(Platform) Usage, ModuleSet = GenerateUsage(Platform)
# Set the default modules # Set the default modules
if Platform == "Monterey": if Platform == "Ventura":
ModuleQt = "Qt5Brew" ModuleQt = "Qt5Brew"
ModuleRuby = "RubyMonterey" ModuleRuby = "Ruby31Brew"
ModulePython = "PythonMonterey" ModulePython = "Python38Brew"
elif Platform == "Monterey":
ModuleQt = "Qt5Brew"
ModuleRuby = "Ruby31Brew"
ModulePython = "Python38Brew"
elif Platform == "BigSur": elif Platform == "BigSur":
ModuleQt = "Qt5Brew" ModuleQt = "Qt5Brew"
ModuleRuby = "RubyBigSur" ModuleRuby = "RubyBigSur"
@ -302,7 +310,7 @@ def ApplyPatch2KLayoutQtPri4Ruby3(config):
# (A) Check Platform # (A) Check Platform
#---------------------------------------------------------------- #----------------------------------------------------------------
Platform = config['Platform'] Platform = config['Platform']
if Platform in [ "Monterey" ]: if Platform in [ "Ventura", "Monterey" ]:
return return
elif Platform in [ "BigSur", "Catalina" ]: # take care elif Platform in [ "BigSur", "Catalina" ]: # take care
pass pass
@ -386,7 +394,7 @@ def Parse_CLI_Args(config):
p.add_option( '-p', '--python', p.add_option( '-p', '--python',
dest='type_python', dest='type_python',
help="Python type=['nil', 'MP38', 'HB38', 'Ana3', 'HB39', 'HBAuto']" ) help="Python type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', 'MP39', 'HB39', 'HBAuto']" )
p.add_option( '-P', '--buildPymod', p.add_option( '-P', '--buildPymod',
action='store_true', action='store_true',
@ -444,10 +452,10 @@ def Parse_CLI_Args(config):
default=False, default=False,
help='check usage' ) help='check usage' )
if Platform.upper() in [ "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ] if Platform.upper() in [ "VENTURA", "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
p.set_defaults( type_qt = "qt5brew", p.set_defaults( type_qt = "qt5brew",
type_ruby = "hb31", type_ruby = "hb31",
type_python = "hb38", type_python = "hb39",
build_pymod = False, build_pymod = False,
no_qt_binding = False, no_qt_binding = False,
no_qt_uitools = False, no_qt_uitools = False,
@ -460,8 +468,8 @@ def Parse_CLI_Args(config):
checkusage = False ) checkusage = False )
else: # with Xcode [ .. 12.4] else: # with Xcode [ .. 12.4]
p.set_defaults( type_qt = "qt5macports", p.set_defaults( type_qt = "qt5macports",
type_ruby = "mp31", type_ruby = "sys",
type_python = "mp38", type_python = "sys",
build_pymod = False, build_pymod = False,
no_qt_binding = False, no_qt_binding = False,
no_qt_uitools = False, no_qt_uitools = False,
@ -528,7 +536,9 @@ def Parse_CLI_Args(config):
ModuleRuby = 'nil' ModuleRuby = 'nil'
elif choiceRuby == "Sys": elif choiceRuby == "Sys":
choiceRuby = "Sys" choiceRuby = "Sys"
if Platform == "Monterey": if Platform == "Ventura":
ModuleRuby = 'RubyVentura'
elif Platform == "Monterey":
ModuleRuby = 'RubyMonterey' ModuleRuby = 'RubyMonterey'
elif Platform == "BigSur": elif Platform == "BigSur":
ModuleRuby = 'RubyBigSur' ModuleRuby = 'RubyBigSur'
@ -561,10 +571,11 @@ def Parse_CLI_Args(config):
# (C) Determine the Python type # (C) Determine the Python type
candidates = dict() candidates = dict()
candidates['NIL'] = 'nil' candidates['NIL'] = 'nil'
# candidates['SYS'] = 'Sys' # has been abolished in 0.28 candidates['SYS'] = 'Sys' # has been restored in 0.28.3
candidates['MP38'] = 'MP38' candidates['MP38'] = 'MP38'
candidates['HB38'] = 'HB38' candidates['HB38'] = 'HB38'
candidates['ANA3'] = 'Ana3' candidates['ANA3'] = 'Ana3'
candidates['MP39'] = 'MP39'
candidates['HB39'] = 'HB39' candidates['HB39'] = 'HB39'
candidates['HBAUTO'] = 'HBAuto' candidates['HBAUTO'] = 'HBAuto'
try: try:
@ -577,10 +588,8 @@ def Parse_CLI_Args(config):
if choicePython == "nil": if choicePython == "nil":
ModulePython = 'nil' ModulePython = 'nil'
elif choicePython == "Sys": elif choicePython == "Sys":
if Platform == "Monterey": if Platform in [ "Ventura", "Monterey", "BigSur" ]:
ModulePython = 'PythonMonterey' raise Exception( "! Cannot choose the 'sys' Python on <%s>" % Platform )
elif Platform == "BigSur":
ModulePython = 'PythonBigSur'
elif Platform == "Catalina": elif Platform == "Catalina":
ModulePython = 'PythonCatalina' ModulePython = 'PythonCatalina'
elif Platform == "Mojave": elif Platform == "Mojave":
@ -600,6 +609,8 @@ def Parse_CLI_Args(config):
elif choicePython == "Ana3": elif choicePython == "Ana3":
ModulePython = 'PythonAnaconda3' ModulePython = 'PythonAnaconda3'
NonOSStdLang = True NonOSStdLang = True
elif choicePython == "MP39":
ModulePython = 'Python39MacPorts'
elif choicePython == "HB39": elif choicePython == "HB39":
ModulePython = 'Python39Brew' ModulePython = 'Python39Brew'
NonOSStdLang = True NonOSStdLang = True
@ -832,9 +843,9 @@ def Get_Build_Parameters(config):
parameters['ModulePython'] = ModulePython parameters['ModulePython'] = ModulePython
PymodDistDir = dict() PymodDistDir = dict()
if Platform in [ 'Monterey', 'BigSur', 'Catalina' ]: if Platform in [ 'Ventura', 'Monterey', 'BigSur', 'Catalina' ]:
if ModuleRuby in [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]: if ModuleRuby in [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]:
if ModulePython in ['Python38MacPorts']: if ModulePython in [ 'Python38MacPorts', 'Python39MacPorts' ]:
PymodDistDir[ModulePython] = 'dist-MP3' PymodDistDir[ModulePython] = 'dist-MP3'
elif ModulePython in [ 'Python38Brew', 'Python39Brew', 'PythonAutoBrew' ]: elif ModulePython in [ 'Python38Brew', 'Python39Brew', 'PythonAutoBrew' ]:
PymodDistDir[ModulePython] = 'dist-HB3' PymodDistDir[ModulePython] = 'dist-HB3'
@ -855,10 +866,10 @@ def Build_pymod(parameters):
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# [1] <pymod> will be built if: # [1] <pymod> will be built if:
# BuildPymod = True # BuildPymod = True
# Platform = [ 'Monterey', 'BigSur', 'Catalina' ] # Platform = [ 'Ventura', 'Monterey', 'BigSur', 'Catalina' ]
# ModuleRuby = [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ] # ModuleRuby = [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]
# ModulePython = [ 'Python38MacPorts', 'Python38Brew', # ModulePython = [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3',
# 'PythonAnaconda3', 'Python39Brew', 'PythonAutoBrew' ] # 'Python39MacPorts', 'Python39Brew', 'PythonAutoBrew' ]
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
BuildPymod = parameters['BuildPymod'] BuildPymod = parameters['BuildPymod']
Platform = parameters['Platform'] Platform = parameters['Platform']
@ -866,11 +877,12 @@ def Build_pymod(parameters):
ModulePython = parameters['ModulePython'] ModulePython = parameters['ModulePython']
if not BuildPymod: if not BuildPymod:
return 0 return 0
if not Platform in [ 'Monterey', 'BigSur', 'Catalina' ]: if not Platform in [ 'Ventura', 'Monterey', 'BigSur', 'Catalina' ]:
return 0 return 0
elif not ModuleRuby in [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]: elif not ModuleRuby in [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]:
return 0 return 0
elif not ModulePython in [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3', 'Python39Brew', 'PythonAutoBrew' ]: elif not ModulePython in [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3', \
'Python39MacPorts', 'Python39Brew', 'PythonAutoBrew' ]:
return 0 return 0
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -882,14 +894,18 @@ def Build_pymod(parameters):
# Using MacPorts # Using MacPorts
if PymodDistDir[ModulePython] == 'dist-MP3': if PymodDistDir[ModulePython] == 'dist-MP3':
addIncPath = "/opt/local/include" addIncPath = "/opt/local/include"
addLibPath = "/opt/local/lib"
# Using Homebrew # Using Homebrew
elif PymodDistDir[ModulePython] == 'dist-HB3': elif PymodDistDir[ModulePython] == 'dist-HB3':
addIncPath = "%s/include" % DefaultHomebrewRoot # defined in "build4mac_env.py" addIncPath = "%s/include" % DefaultHomebrewRoot # defined in "build4mac_env.py"
# Using Anaconda3 addLibPath = "%s/lib" % DefaultHomebrewRoot # defined in "build4mac_env.py"
elif PymodDistDir[ModulePython] == 'dist-ana3': elif PymodDistDir[ModulePython] == 'dist-ana3':
addIncPath = "/Applications/anaconda3/include" addIncPath = "/Applications/anaconda3/include"
addLibPath = "/Applications/anaconda3/lib"
else: else:
addIncPath = "" addIncPath = ""
addLibPath = ""
if not addIncPath == "": if not addIncPath == "":
try: try:
cpath = os.environ['CPATH'] cpath = os.environ['CPATH']
@ -898,6 +914,14 @@ def Build_pymod(parameters):
else: else:
os.environ['CPATH'] = "%s:%s" % (addIncPath, cpath) os.environ['CPATH'] = "%s:%s" % (addIncPath, cpath)
if not addLibPath == "":
try:
ldpath = os.environ['LDFLAGS']
except KeyError:
os.environ['LDFLAGS'] = '-L%s' % addLibPath
else:
os.environ['LDFLAGS'] = '-L%s %s' % (addLibPath, ldpath)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# [3] Set different command line parameters for building <pymod> # [3] Set different command line parameters for building <pymod>
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -1542,13 +1566,17 @@ def Deploy_Binaries_For_Bundle(config, parameters):
# drwxr-xr-x 4 kazzz-s admin 128 12 16 21:40 Versions # drwxr-xr-x 4 kazzz-s admin 128 12 16 21:40 Versions
#----------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------
deploymentPython38HB = (ModulePython == 'Python38Brew') deploymentPython38HB = (ModulePython == 'Python38Brew')
deploymentPython39HB = (ModulePython == 'Python39Brew')
deploymentPythonAutoHB = (ModulePython == 'PythonAutoBrew') deploymentPythonAutoHB = (ModulePython == 'PythonAutoBrew')
if (deploymentPython38HB or deploymentPythonAutoHB) and NonOSStdLang: if (deploymentPython38HB or deploymentPython39HB or deploymentPythonAutoHB) and NonOSStdLang:
from build4mac_util import WalkFrameworkPaths, PerformChanges from build4mac_util import WalkFrameworkPaths, PerformChanges
if deploymentPython38HB: if deploymentPython38HB:
HBPythonFrameworkPath = HBPython38FrameworkPath HBPythonFrameworkPath = HBPython38FrameworkPath
pythonHBVer = "3.8" # 'pinned' to this version as of KLayout version 0.26.7 (2020-09-13) pythonHBVer = "3.8" # 'pinned' to this version as of KLayout version 0.26.7 (2020-09-13)
elif deploymentPython39HB:
HBPythonFrameworkPath = HBPython39FrameworkPath
pythonHBVer = "3.9" # 'pinned' to this version as of KLayout version 0.28.2 (2023-01-02)
elif deploymentPythonAutoHB: elif deploymentPythonAutoHB:
HBPythonFrameworkPath = HBPythonAutoFrameworkPath HBPythonFrameworkPath = HBPythonAutoFrameworkPath
pythonHBVer = HBPythonAutoVersion pythonHBVer = HBPythonAutoVersion

View File

@ -84,7 +84,7 @@ Qt6Brew = { 'qmake' : '%s/opt/qt@6/bin/qmake' % DefaultHomebrewRoot,
#----------------------------------------------------- #-----------------------------------------------------
RubyNil = [ 'nil' ] RubyNil = [ 'nil' ]
RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave' ] RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave' ]
RubySys += [ 'RubyCatalina', 'RubyBigSur', 'RubyMonterey' ] RubySys += [ 'RubyCatalina', 'RubyBigSur', 'RubyMonterey', 'RubyVentura' ]
RubyExt = [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ] RubyExt = [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]
Rubies = RubyNil + RubySys + RubyExt Rubies = RubyNil + RubySys + RubyExt
@ -174,6 +174,16 @@ 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)
# Refer to the "Catalina" section above
# [Key Type Name] = 'Sys'
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',
'inc': '%s/System/Library/Frameworks/Ruby.framework/Headers' % VenturaSDK,
'inc2': '%s/System/Library/Frameworks/Ruby.framework/Headers/ruby' % 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 *+*+*+ # Ruby 3.1 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
# install with 'sudo port install ruby31' # install with 'sudo port install ruby31'
# [Key Type Name] = 'MP31' # [Key Type Name] = 'MP31'
@ -210,6 +220,7 @@ RubyDictionary = { 'nil' : None,
'RubyCatalina' : RubyCatalina, 'RubyCatalina' : RubyCatalina,
'RubyBigSur' : RubyBigSur, 'RubyBigSur' : RubyBigSur,
'RubyMonterey' : RubyMonterey, 'RubyMonterey' : RubyMonterey,
'RubyVentura' : RubyVentura,
'Ruby31MacPorts': Ruby31MacPorts, 'Ruby31MacPorts': Ruby31MacPorts,
'Ruby31Brew' : Ruby31Brew, 'Ruby31Brew' : Ruby31Brew,
'RubyAnaconda3' : RubyAnaconda3 'RubyAnaconda3' : RubyAnaconda3
@ -221,7 +232,8 @@ RubyDictionary = { 'nil' : None,
PythonNil = [ 'nil' ] PythonNil = [ 'nil' ]
PythonSys = [ 'PythonElCapitan', 'PythonSierra', 'PythonHighSierra', 'PythonMojave' ] PythonSys = [ 'PythonElCapitan', 'PythonSierra', 'PythonHighSierra', 'PythonMojave' ]
PythonSys += [ 'PythonCatalina', 'PythonBigSur', 'PythonMonterey' ] PythonSys += [ 'PythonCatalina', 'PythonBigSur', 'PythonMonterey' ]
PythonExt = [ 'Python38MacPorts', 'Python38Brew', 'Python39Brew', 'PythonAnaconda3', 'PythonAutoBrew' ] PythonExt = [ 'Python38MacPorts', 'Python39MacPorts', 'Python38Brew', 'Python39Brew' ]
PythonExt += [ 'PythonAnaconda3', 'PythonAutoBrew' ]
Pythons = PythonNil + PythonSys + PythonExt Pythons = PythonNil + PythonSys + PythonExt
#----------------------------------------------------- #-----------------------------------------------------
@ -299,6 +311,14 @@ Python38MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versi
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib' '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'
# [Key Type Name] = 'MP38'
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',
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib'
}
# Python 3.8 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+ # Python 3.8 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install python@3.8' # install with 'brew install python@3.8'
# [Key Type Name] = 'HB38' # [Key Type Name] = 'HB38'
@ -321,9 +341,9 @@ Python39Brew = { 'exe': '%s/Versions/3.9/bin/python3.9' % HBPython39Framework
# 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.8', PythonAnaconda3 = { 'exe': '/Applications/anaconda3/bin/python3.9',
'inc': '/Applications/anaconda3/include/python3.8', 'inc': '/Applications/anaconda3/include/python3.9',
'lib': '/Applications/anaconda3/lib/libpython3.8.dylib' 'lib': '/Applications/anaconda3/lib/libpython3.9.dylib'
} }
# Latest Python from Homebrew *+*+*+ EXPERIMENTAL *+*+*+ # Latest Python from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
@ -358,6 +378,7 @@ PythonDictionary = { 'nil' : None,
'PythonBigSur' : PythonBigSur, 'PythonBigSur' : PythonBigSur,
'PythonMonterey' : PythonMonterey, 'PythonMonterey' : PythonMonterey,
'Python38MacPorts': Python38MacPorts, 'Python38MacPorts': Python38MacPorts,
'Python39MacPorts': Python39MacPorts,
'Python38Brew' : Python38Brew, 'Python38Brew' : Python38Brew,
'Python39Brew' : Python39Brew, 'Python39Brew' : Python39Brew,
'PythonAnaconda3' : PythonAnaconda3 'PythonAnaconda3' : PythonAnaconda3

View File

@ -77,7 +77,7 @@ 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 or later on different Apple macOS / Mac OSX platforms.\n" Usage += " for making a DMG file of KLayout 0.28.3 or later on different Apple macOS / Mac OSX 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"
@ -105,7 +105,11 @@ def SetGlobals():
release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0'] release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0']
LatestOS = "" LatestOS = ""
if release == 21: if release == 22:
GenOSName = "macOS"
Platform = "Ventura"
LatestOS = Platform
elif release == 21:
GenOSName = "macOS" GenOSName = "macOS"
Platform = "Monterey" Platform = "Monterey"
LatestOS = Platform LatestOS = Platform
@ -137,7 +141,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 ["Monterey", "BigSur"]: # with an Apple Silicon Chip if Machine == "arm64" and Platform in ["Ventura", "Monterey", "BigSur"]: # 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("")
@ -251,8 +255,9 @@ def CheckPkgDirectory():
print( "" ) print( "" )
return -1 return -1
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------
# [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-Catalina-release-Rana3Pana3 # * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb31Phb38 # * LW-qt5Brew.pkg.macos-Catalina-release-Rhb31Phb38
# * LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp38 # * LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp38
@ -263,8 +268,8 @@ def CheckPkgDirectory():
# * LW-qt6Brew.pkg.macos-Catalina-release-Rhb31Phb38 # * LW-qt6Brew.pkg.macos-Catalina-release-Rhb31Phb38
# * LW-qt6MP.pkg.macos-Catalina-release-Rmp31Pmp38 # * LW-qt6MP.pkg.macos-Catalina-release-Rmp31Pmp38
# * HW-qt6Brew.pkg.macos-Catalina-release-RsysPhb38 # * HW-qt6Brew.pkg.macos-Catalina-release-RsysPhb38
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------
patQRP = u'(LW|HW|EX)([-])([qt5|qt6][0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-]release[-])([0-9A-Za-z]+)' patQRP = u'(ST|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" )
@ -292,7 +297,7 @@ 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"] LatestOSMacPorts &= RubyPythonID in ["Rmp31Pmp38", "Rmp31Pmp39"]
LatestOSHomebrew = Platform == LatestOS LatestOSHomebrew = Platform == LatestOS
LatestOSHomebrew &= PackagePrefix == "LW" LatestOSHomebrew &= PackagePrefix == "LW"

View File

@ -16,14 +16,16 @@ 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' ] ): def Test_My_Platform( platforms=[ 'Catalina', 'BigSur', 'Monterey', 'Ventura' ] ):
(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 ['19', '0', '0']
if release == 21: if release == 22:
Platform = "Ventura"
elif release == 21:
Platform = "Monterey" Platform = "Monterey"
elif release == 20: elif release == 20:
Platform = "BigSur" Platform = "BigSur"
@ -52,7 +54,7 @@ def Test_My_Platform( platforms=['Catalina', 'BigSur', 'Monterey' ] ):
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
def Get_Build_Target_Dict(): def Get_Build_Target_Dict():
buildTargetDic = dict() buildTargetDic = dict()
# buildTargetDic[0] = 'std' # has been abolished in 0.28 buildTargetDic[0] = 'std' # has been restored in 0.28.3
buildTargetDic[1] = 'ports' buildTargetDic[1] = 'ports'
buildTargetDic[2] = 'brew' buildTargetDic[2] = 'brew'
buildTargetDic[3] = 'brewHW' buildTargetDic[3] = 'brewHW'
@ -81,11 +83,11 @@ def Get_Build_Options( targetDic ):
if target == "std": # use 'Qt5MacPorts' that provides Qt 5.15.2~ to run on "Big Sur", too if target == "std": # use 'Qt5MacPorts' that provides Qt 5.15.2~ to run on "Big Sur", too
buildOp["std"] = [ '-q', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'sys' ] buildOp["std"] = [ '-q', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'sys' ]
elif target == "ports": elif target == "ports":
buildOp["ports"] = [ '-q', '%sMacPorts' % qtType, '-r', 'MP31', '-p', 'MP38' ] buildOp["ports"] = [ '-q', '%sMacPorts' % qtType, '-r', 'MP31', '-p', 'MP39' ]
elif target == "brew": elif target == "brew":
buildOp["brew"] = [ '-q', '%sBrew' % qtType, '-r', 'HB31', '-p', 'HB38' ] buildOp["brew"] = [ '-q', '%sBrew' % qtType, '-r', 'HB31', '-p', 'HB39' ]
elif target == "brewHW": elif target == "brewHW":
buildOp["brewHW"] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HB38' ] buildOp["brewHW"] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HB39' ]
elif target == "ana3": elif target == "ana3":
buildOp["ana3"] = [ '-q', '%sAna3' % qtType, '-r', 'Ana3', '-p', 'Ana3' ] buildOp["ana3"] = [ '-q', '%sAna3' % qtType, '-r', 'Ana3', '-p', 'Ana3' ]
elif target == "brewA": elif target == "brewA":
@ -119,11 +121,11 @@ def Get_QAT_Directory( targetDic, platform ):
if target == "std": if target == "std":
dirQAT["std"] = '%sMP.build.macos-%s-release-RsysPsys.macQAT' % (qtType, platform) dirQAT["std"] = '%sMP.build.macos-%s-release-RsysPsys.macQAT' % (qtType, platform)
elif target == "ports": elif target == "ports":
dirQAT["ports"] = '%sMP.build.macos-%s-release-Rmp31Pmp38.macQAT' % (qtType, platform) dirQAT["ports"] = '%sMP.build.macos-%s-release-Rmp31Pmp39.macQAT' % (qtType, platform)
elif target == "brew": elif target == "brew":
dirQAT["brew"] = '%sBrew.build.macos-%s-release-Rhb31Phb38.macQAT' % (qtType, platform) dirQAT["brew"] = '%sBrew.build.macos-%s-release-Rhb31Phb39.macQAT' % (qtType, platform)
elif target == "brewHW": elif target == "brewHW":
dirQAT["brewHW"] = '%sBrew.build.macos-%s-release-RsysPhb38.macQAT' % (qtType, platform) dirQAT["brewHW"] = '%sBrew.build.macos-%s-release-RsysPhb39.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":
@ -160,13 +162,13 @@ def Get_Package_Options( targetDic, platform, srlDMG, makeflag ):
packOp["std"] = [ '-p', 'ST-%sMP.pkg.macos-%s-release-RsysPsys' % (qtType, platform), packOp["std"] = [ '-p', 'ST-%sMP.pkg.macos-%s-release-RsysPsys' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ] '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "ports": elif target == "ports":
packOp["ports"] = [ '-p', 'LW-%sMP.pkg.macos-%s-release-Rmp31Pmp38' % (qtType, platform), packOp["ports"] = [ '-p', 'LW-%sMP.pkg.macos-%s-release-Rmp31Pmp39' % (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-Rhb31Phb38' % (qtType, platform), packOp["brew"] = [ '-p', 'LW-%sBrew.pkg.macos-%s-release-Rhb31Phb39' % (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-RsysPhb38' % (qtType, platform), packOp["brewHW"] = [ '-p', 'HW-%sBrew.pkg.macos-%s-release-RsysPhb39' % (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),
@ -195,25 +197,24 @@ def Parse_CommandLine_Arguments():
global Upload # operation flag global Upload # operation flag
global SrlDMG # DMG serial number global SrlDMG # DMG serial number
global Dropbox # Dropbox directory global Dropbox # Dropbox directory
global DryRun # True for dry-run
platform = Test_My_Platform() platform = Test_My_Platform()
if platform in [ "Monterey", "BigSur" ]: if platform in [ "Ventura", "Monterey", "BigSur" ]:
targetopt = "1,2,3,4"
elif platform in ["Catalina"]:
targetopt = "1,2,3,4" targetopt = "1,2,3,4"
else: else:
targetopt = "" targetopt = "0,1,2,3,4"
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, or Monterey >>\n" Usage += " << To execute the jobs for making KLayout's DMGs for macOS Catalina, Big Sur, Monterey, or Ventura >>\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>] : 1='ports', 2='brew', 3='brewHW', 4='ana3', | '%s'\n" % targetopt Usage += " [--target <list>] : 0='std' 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"
@ -222,6 +223,7 @@ def Parse_CommandLine_Arguments():
Usage += " [--check] : check the QA Test results | disabled\n" Usage += " [--check] : check the QA Test results | disabled\n"
Usage += " [--makedmg|--cleandmg <srlno>] : make or clean DMGs | disabled\n" Usage += " [--makedmg|--cleandmg <srlno>] : make or clean DMGs | disabled\n"
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 += " [-?|--?] : 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"
@ -235,7 +237,7 @@ def Parse_CommandLine_Arguments():
Usage += " (5) $ ./nightlyBuild.py --makedmg 1 | \n" Usage += " (5) $ ./nightlyBuild.py --makedmg 1 | \n"
Usage += " (6) $ ./nightlyBuild.py --upload '0.28.2' | \n" Usage += " (6) $ ./nightlyBuild.py --upload '0.28.2' | \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 )
p.add_option( '--qt', p.add_option( '--qt',
@ -282,6 +284,12 @@ def Parse_CommandLine_Arguments():
dest='upload', dest='upload',
help='upload to Dropbox' ) help='upload to Dropbox' )
p.add_option( '--dryrun',
action='store_true',
dest='dry_run',
default=False,
help='dry-run' )
p.add_option( '-?', '--??', p.add_option( '-?', '--??',
action='store_true', action='store_true',
dest='checkusage', dest='checkusage',
@ -297,6 +305,7 @@ def Parse_CommandLine_Arguments():
makedmg = "", makedmg = "",
cleandmg = "", cleandmg = "",
upload = "", upload = "",
dry_run = False,
checkusage = False ) checkusage = False )
opt, args = p.parse_args() opt, args = p.parse_args()
@ -304,9 +313,9 @@ def Parse_CommandLine_Arguments():
print(Usage) print(Usage)
quit() quit()
myPlatform = Test_My_Platform( ['Catalina', 'BigSur', 'Monterey' ] ) myPlatform = Test_My_Platform( [ 'Catalina', 'BigSur', 'Monterey', 'Ventura' ] )
if myPlatform == "": if myPlatform == "":
print( "! Current platform is not ['Catalina', 'BigSur', 'Monterey' ]" ) print( "! Current platform is not [ 'Catalina', 'BigSur', 'Monterey', 'Ventura' ]" )
print(Usage) print(Usage)
quit() quit()
@ -316,10 +325,15 @@ def Parse_CommandLine_Arguments():
print(Usage) print(Usage)
quit() quit()
targetIdx = list()
for target in [ int(item) for item in opt.targets.split(",") ]:
if not target in targetIdx:
targetIdx.append(target) # first appeared and non-duplicated index
targetDic = Get_Build_Target_Dict() targetDic = Get_Build_Target_Dict()
Target = list() Target = list()
for idx in sorted( list( set( [ int(item) for item in opt.targets.split(",") ] ) ) ): for idx in targetIdx:
if idx in range(1, 7): # '0' has been abolished in 0.28 if idx in range(0, 7): # '0' has been restored in 0.28.3
Target.append( targetDic[idx] ) Target.append( targetDic[idx] )
Build = opt.build Build = opt.build
@ -329,6 +343,7 @@ def Parse_CommandLine_Arguments():
MakeDMG = False MakeDMG = False
CleanDMG = False CleanDMG = False
Upload = False Upload = False
DryRun = opt.dry_run
if not opt.makedmg == "": if not opt.makedmg == "":
MakeDMG = True MakeDMG = True
@ -360,7 +375,7 @@ def Build_Deploy():
buildOp = Get_Build_Options( Get_Build_Target_Dict() ) buildOp = Get_Build_Options( Get_Build_Target_Dict() )
for key in Target: for key in Target:
if key == 4 and QtType == 6: # anaconda3 does not provide Qt6 so far if key == "ana3" and QtType == 6: # anaconda3 does not provide Qt6 so far
continue continue
command1 = [ pyBuilder ] + buildOp[key] command1 = [ pyBuilder ] + buildOp[key]
@ -368,9 +383,13 @@ def Build_Deploy():
command2 = [ pyBuilder ] + buildOp[key] + ['-y'] command2 = [ pyBuilder ] + buildOp[key] + ['-y']
else: else:
command2 = [ pyBuilder ] + buildOp[key] + ['-Y'] command2 = [ pyBuilder ] + buildOp[key] + ['-Y']
print(command1)
print(command2) if DryRun:
#continue print( "### Target = <%s> ###" % key )
print(command1)
print(command2)
print( "" )
continue
if subprocess.call( command1, shell=False ) != 0: if subprocess.call( command1, shell=False ) != 0:
print( "", file=sys.stderr ) print( "", file=sys.stderr )

View File

@ -85,6 +85,7 @@ static const char *cm_symbols[] = {
"cm_cancel", "cm_cancel",
"cm_redraw", "cm_redraw",
"cm_screenshot", "cm_screenshot",
"cm_screenshot_to_clipboard",
"cm_save_layer_props", "cm_save_layer_props",
"cm_load_layer_props", "cm_load_layer_props",
"cm_save_bookmarks", "cm_save_bookmarks",

View File

@ -36,6 +36,7 @@
#include <QDateTime> #include <QDateTime>
#include <QUrl> #include <QUrl>
#include <QMimeData> #include <QMimeData>
#include <QClipboard>
#if defined(__APPLE__) && (QT_VERSION < 0x050401) #if defined(__APPLE__) && (QT_VERSION < 0x050401)
// A workaround for the issue of Qt 4.8.x when handling "File Reference URL" in OSX // A workaround for the issue of Qt 4.8.x when handling "File Reference URL" in OSX
@ -2162,6 +2163,18 @@ MainWindow::cm_screenshot ()
} }
} }
void
MainWindow::cm_screenshot_to_clipboard ()
{
if (current_view ()) {
QImage screenshot = current_view ()->get_screenshot ();
QClipboard *clipboard = QGuiApplication::clipboard();
clipboard->setImage(screenshot);
} else {
throw tl::Exception (tl::to_string (QObject::tr ("No view open to create a screenshot from")));
}
}
void void
MainWindow::cm_save_current_cell_as () MainWindow::cm_save_current_cell_as ()
{ {
@ -3939,6 +3952,8 @@ MainWindow::menu_activated (const std::string &symbol)
cm_load_bookmarks (); cm_load_bookmarks ();
} else if (symbol == "cm_screenshot") { } else if (symbol == "cm_screenshot") {
cm_screenshot (); cm_screenshot ();
} else if (symbol == "cm_screenshot_to_clipboard") {
cm_screenshot_to_clipboard ();
} else if (symbol == "cm_save_current_cell_as") { } else if (symbol == "cm_save_current_cell_as") {
cm_save_current_cell_as (); cm_save_current_cell_as ();
} else if (symbol == "cm_save") { } else if (symbol == "cm_save") {
@ -4297,6 +4312,7 @@ public:
menu_entries.push_back (lay::menu_item ("cm_setup", "setup:edit", at, tl::to_string (QObject::tr ("Setup")))); menu_entries.push_back (lay::menu_item ("cm_setup", "setup:edit", at, tl::to_string (QObject::tr ("Setup"))));
menu_entries.push_back (lay::separator ("misc_group", at)); menu_entries.push_back (lay::separator ("misc_group", at));
menu_entries.push_back (lay::menu_item ("cm_screenshot", "screenshot:edit", at, tl::to_string (QObject::tr ("Screenshot(Print)")))); menu_entries.push_back (lay::menu_item ("cm_screenshot", "screenshot:edit", at, tl::to_string (QObject::tr ("Screenshot(Print)"))));
menu_entries.push_back (lay::menu_item ("cm_screenshot_to_clipboard", "screenshot_to_clipboard:edit", at, tl::to_string (QObject::tr ("Screenshot to clipboard"))));
menu_entries.push_back (lay::menu_item ("cm_layout_props", "layout_props:edit", at, tl::to_string (QObject::tr ("Layout Properties")))); menu_entries.push_back (lay::menu_item ("cm_layout_props", "layout_props:edit", at, tl::to_string (QObject::tr ("Layout Properties"))));
menu_entries.push_back (lay::menu_item ("cm_layout_stats", "layout_stats:edit", at, tl::to_string (QObject::tr ("Layout Statistics")))); menu_entries.push_back (lay::menu_item ("cm_layout_stats", "layout_stats:edit", at, tl::to_string (QObject::tr ("Layout Statistics"))));
menu_entries.push_back (lay::separator ("layer_group", at)); menu_entries.push_back (lay::separator ("layer_group", at));

View File

@ -780,6 +780,7 @@ private:
void cm_save_bookmarks (); void cm_save_bookmarks ();
void cm_load_bookmarks (); void cm_load_bookmarks ();
void cm_screenshot (); void cm_screenshot ();
void cm_screenshot_to_clipboard ();
void cm_save_current_cell_as (); void cm_save_current_cell_as ();
void cm_save (); void cm_save ();
void cm_save_as (); void cm_save_as ();

View File

@ -74,25 +74,35 @@ void check_error ()
if (PyErr_GivenExceptionMatches (exc_type.get (), PyExc_SyntaxError) && PyTuple_Check (exc_value.get ()) && PyTuple_Size (exc_value.get ()) >= 2) { if (PyErr_GivenExceptionMatches (exc_type.get (), PyExc_SyntaxError) && PyTuple_Check (exc_value.get ()) && PyTuple_Size (exc_value.get ()) >= 2) {
const char *sourcefile = 0; const char *sourcefile = 0;
std::string sourcefile_arg;
int line = 0; int line = 0;
std::string msg; std::string msg = "syntax error (could not parse exception)";
const char *msg_arg = 0, *sourcefile_arg = 0, *text_arg = 0; try {
int line_arg = 0, column_arg = 0;
if (exc_value && PyArg_ParseTuple (exc_value.get (), "s(siis)", &msg_arg, &sourcefile_arg, &line_arg, &column_arg, &text_arg)) {
// build a Ruby-like message if (exc_value && PyTuple_Check (exc_value.get ()) && PyTuple_Size (exc_value.get ()) >= 2) {
msg = sourcefile_arg;
msg += ":";
msg += tl::to_string (line_arg);
msg += ": ";
msg += msg_arg;
sourcefile = sourcefile_arg; std::string msg_arg = python2c<std::string> (PyTuple_GetItem (exc_value.get (), 0));
line = line_arg;
} else { PyObject *args = PyTuple_GetItem (exc_value.get (), 1);
msg = "syntax error"; if (PyTuple_Check (args) && PyTuple_Size (args) >= 3) {
sourcefile_arg = python2c<std::string> (PyTuple_GetItem (args, 0));
sourcefile = sourcefile_arg.c_str ();
line = python2c<int> (PyTuple_GetItem (args, 1));
// Not used: column_arg = python2c<int> (PyTuple_GetItem (args, 2);
}
// build a Ruby-like message
msg = sourcefile_arg;
msg += ":";
msg += tl::to_string (line);
msg += ": ";
msg += msg_arg;
}
} catch (...) {
// ignore exceptions here
} }
if (! backtrace.empty () && ! sourcefile) { if (! backtrace.empty () && ! sourcefile) {