#!/usr/bin/env python # -*- coding: utf-8 -*- #=============================================================================== # File: "macbuild/build4mac.py" # # The top Python script for building KLayout (http://www.klayout.de/index.php) # version 0.26.1 or later on different Apple Mac OSX platforms. #=============================================================================== from __future__ import print_function # to use print() of Python 3 in Python >= 2.7 import sys import os import shutil import glob import platform import optparse import subprocess import pprint #------------------------------------------------------------------------------- ## To import global dictionaries of different modules and utility functions #------------------------------------------------------------------------------- mydir = os.path.dirname(os.path.abspath(__file__)) sys.path.append( mydir + "/macbuild" ) from build4mac_env import * from build4mac_util import * #------------------------------------------------------------------------------- ## To get the default configurations # # @return a dictionary containing the default configuration for the macOS build #------------------------------------------------------------------------------- def Get_Default_Config(): Usage = "\n" Usage += "---------------------------------------------------------------------------------------------------------\n" Usage += "<< Usage of 'build4mac.py' >>\n" Usage += " for building KLayout 0.26.1 or later on different Apple Mac OSX platforms.\n" Usage += "\n" Usage += "$ [python] ./build4mac.py \n" Usage += " option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value\n" Usage += " --------------------------------------------------------------------------------------+---------------\n" Usage += " [-q|--qt ] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] | qt5macports \n" Usage += " : Qt5MacPorts: use Qt5 from MacPorts | \n" Usage += " : Qt5Brew: use Qt5 from Homebrew | \n" Usage += " : Qt5Ana3: use Qt5 from Anaconda3 | \n" Usage += " [-r|--ruby ] : case-insensitive type=['nil', 'Sys', 'MP27', 'HB27', 'Ana3'] | sys \n" Usage += " : nil: don't bind Ruby | \n" Usage += " : Sys: use OS-bundled Ruby [2.0 - 2.7] depending on OS | \n" Usage += " : MP27: use Ruby 2.7 from MacPorts | \n" Usage += " : HB27: use Ruby 2.7 from Homebrew | \n" Usage += " : Ana3: use Ruby 2.5 from Anaconda3 | \n" Usage += " [-p|--python ] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | sys \n" Usage += " : 'HBAuto'] | \n" Usage += " : nil: don't bind Python | \n" Usage += " : Sys: use OS-bundled Python 2.7 [ElCapitan -- BigSur] | \n" Usage += " : MP38: use Python 3.8 from MacPorts | \n" Usage += " : HB38: use Python 3.8 from Homebrew | \n" Usage += " : Ana3: use Python 3.7 from Anaconda3 | \n" Usage += " : HBAuto: use the latest Python 3.x auto-detected from Homebrew | \n" Usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled \n" Usage += " [-m|--make