From 8419ed0c6feaa95eb54e060af70054478601cc30 Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Thu, 15 Mar 2018 00:08:18 -0400 Subject: [PATCH 1/5] fixing the bug mentioned in PR #85 --- src/lay/lay/layMacroEditorSetupPage.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lay/lay/layMacroEditorSetupPage.cc b/src/lay/lay/layMacroEditorSetupPage.cc index 9dc60c5ae..1b2874bd4 100644 --- a/src/lay/lay/layMacroEditorSetupPage.cc +++ b/src/lay/lay/layMacroEditorSetupPage.cc @@ -56,7 +56,7 @@ struct MacroEditorSetupDialogData void setup (lay::PluginRoot *root) { - lay::MacroEditorHighlighters highlighters (0); + lay::MacroEditorHighlighters highlighters (lay::MacroEditorDialog::instance ()); std::string styles; root->config_get (cfg_macro_editor_styles, styles); highlighters.load (styles); @@ -91,7 +91,7 @@ struct MacroEditorSetupDialogData void commit (lay::PluginRoot *root) { - lay::MacroEditorHighlighters highlighters (0); + lay::MacroEditorHighlighters highlighters (lay::MacroEditorDialog::instance ()); if (highlighters.basic_attributes ()) { highlighters.basic_attributes ()->assign (basic_attributes); From e90edf4434d8ccb2babac524329cabb604742561 Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Tue, 13 Mar 2018 04:01:36 -0400 Subject: [PATCH 2/5] Compilation with brew dependencies successful! Using brew's qt and python3 formulae Bonus: I have also added a script that embeds python into bundle, recursively adding dependencies from inside /usr/local/opt. That means that /usr/local/lib folders are not going to be copied. I saw one dependency to /usr/local/lib/gcc from one of numpy's modules, instead of pointing towards /usr/local/opt/gcc/lib/gcc. Side effects: Renaming Qt5Custom to Qt5Brew --- macbuild/ReadMe.md | 16 +-- macbuild/build4mac.py | 116 +++++++++++++--------- macbuild/build4mac_env.py | 24 +++-- macbuild/build4mac_env.pyc | Bin 3944 -> 0 bytes macbuild/build4mac_util.py | 189 +++++++++++++++++++++++++++++++++++- macbuild/build4mac_util.pyc | Bin 4885 -> 0 bytes 6 files changed, 277 insertions(+), 68 deletions(-) delete mode 100644 macbuild/build4mac_env.pyc delete mode 100644 macbuild/build4mac_util.pyc diff --git a/macbuild/ReadMe.md b/macbuild/ReadMe.md index f27677548..5ce29188b 100644 --- a/macbuild/ReadMe.md +++ b/macbuild/ReadMe.md @@ -86,23 +86,25 @@ $ ./makeDMG4mac.py -p qt5.pkg.macos-HighSierra-release -m By: Kazzz (January 16, 2018) # 5. Alternative building options -### 5.1 Python 3.6 from brew, Qt 5.9.4 from offline installer +### 5.1 Python 3.6 from brew, Qt 5.10.1 from brew -Homebrew's installation of python3 places a `Python.framework` in `/usr/local/opt/python/Frameworks/Python.framework/`, which you can use to build KLayout from. Qt can be downloaded for [offline installation](https://www1.qt.io/offline-installers/). You can place it in your home folder: e.g. `/home/username/Qt5.9.4/`. Given these two dependencies, you can successfully compile KLayout with the following commands: +Homebrew's installation of python3 (`brew install python3`) places a `Python.framework` in `/usr/local/opt/python/Frameworks/Python.framework/`, which you can use to build KLayout from. Qt can also be downloaded from brew with `brew install qt`. ``` # Build step -./build4mac.py -p B36 -q Qt5Custom +./build4mac.py -p B36 -q Qt5Brew # Deploy step -./build4mac.py -p B36 -q Qt5Custom -y # normal deploy -./build4mac.py -p B36 -q Qt5Custom -y -v 3 2>&1 | tee qt5.pkg.macos-HighSierra-release.log # deploy with debug options +./build4mac.py -p B36 -q Qt5Brew -y # normal deploy +./build4mac.py -p B36 -q Qt5Brew -y -v 3 2>&1 | tee qt5.pkg.macos-HighSierra-release.log # deploy with debug options # Packaging step -./makeDMG4mac.py -p qt5.pkg.macos-HighSierra-release -m -q Qt594 +./makeDMG4mac.py -p qt5.pkg.macos-HighSierra-release -m -q Qt5101 ``` -PS: If you get a syntax error in one of ruby's libraries because it is not compatible with C++11, do not fret. You only have to change one offending file. +#### Known issues + +Because we link python to `/usr/local/opt/python/Frameworks/Python.framework/`, updating python from brew might break klayout if the new version is incompatible. To fix this, it is better to link python directly to `/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework`, but that might complicate release builds, because that assumes users have the exact version of python installed by brew. [End of File] diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py index c4ca6933f..2c7ed5667 100755 --- a/macbuild/build4mac.py +++ b/macbuild/build4mac.py @@ -65,7 +65,7 @@ def SetGlobals(): Usage += " : 'nil' = not to support the script language | \n" Usage += " : 'Sys' = using the OS standard script language | \n" Usage += " : Refer to 'macbuild/build4mac_env.py' for details | \n" - Usage += " [-q|--qt ] : type=['Qt4MacPorts', 'Qt5MacPorts', 'Qt5Custom'] | qt5macports \n" + Usage += " [-q|--qt ] : type=['Qt4MacPorts', 'Qt5MacPorts', 'Qt5Brew'] | qt5macports \n" Usage += " [-r|--ruby ] : type=['nil', 'Sys', 'Src24', 'MP24', 'B25'] | sys \n" Usage += " [-p|--python ] : type=['nil', 'Sys', 'Ana27', 'Ana36', 'MP36', 'B36'] | sys \n" Usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled \n" @@ -94,7 +94,7 @@ def SetGlobals(): print("") print( "!!! Sorry. Your system <%s> looks like non-Mac" % System, file=sys.stderr ) print(Usage) - quit() + exit() release = int( Release.split(".")[0] ) # take the first of ['14', '5', '0'] if release == 14: @@ -110,13 +110,13 @@ def SetGlobals(): print("") print( "!!! Sorry. Unsupported major OS release <%d>" % release, file=sys.stderr ) print(Usage) - quit() + exit() if not Machine == "x86_64": print("") print( "!!! Sorry. Only x86_64 architecture machine is supported but found <%s>" % Machine, file=sys.stderr ) print(Usage) - quit() + exit() # default modules ModuleQt = "Qt5MacPorts" @@ -236,30 +236,21 @@ def ParseCommandLineArguments(): opt, args = p.parse_args() if (opt.checkusage): print(Usage) - quit() + exit() # Determine Qt type - candidates = [ i.upper() for i in ['Qt4MacPorts', 'Qt5MacPorts', 'Qt5Custom'] ] + candidates = ['Qt4MacPorts', 'Qt5MacPorts', 'Qt5Brew'] + candidates_upper = [ i.upper() for i in candidates ] ModuleQt = "" index = 0 - for item in candidates: - if opt.type_qt.upper() == item: - if index == 0: - ModuleQt = 'Qt4MacPorts' - break - elif index == 1: - ModuleQt = 'Qt5MacPorts' - break - elif index == 2: - ModuleQt = 'Qt5Custom' - break - else: - index += 1 - if ModuleQt == "": + if opt.type_qt.upper() in candidates_upper: + idx = candidates_upper.index(opt.type_qt.upper()) + ModuleQt = candidates[idx] + else: print("") - print( "!!! Unknown Qt type", file=sys.stderr ) + print( "!!! Unknown Qt type %s. Candidates: %s" % (opt.type_qt, candidates), file=sys.stderr ) print(Usage) - quit() + exit(1) # By default, OS-standard script languages (Ruby and Python) are used NonOSStdLang = False @@ -300,7 +291,7 @@ def ParseCommandLineArguments(): print("") print( "!!! Unknown Ruby type", file=sys.stderr ) print(Usage) - quit() + exit() # Determine Python type candidates = [ i.upper() for i in ['nil', 'Sys', 'Ana27', 'Ana36', 'MP36', 'B36'] ] @@ -341,7 +332,7 @@ def ParseCommandLineArguments(): print("") print( "!!! Unknown Python type", file=sys.stderr ) print(Usage) - quit() + exit() NoQtBindings = opt.no_qt_binding MakeOptions = opt.make_option @@ -354,14 +345,14 @@ def ParseCommandLineArguments(): print("") print( "!!! Choose either [-y|--deploy] or [-Y|--DEPLOY]", file=sys.stderr ) print(Usage) - quit() + exit() DeployVerbose = int(opt.deploy_verbose) if not DeployVerbose in [0, 1, 2, 3]: print("") print( "!!! Unsupported verbose level passed to `macdeployqt` tool", file=sys.stderr ) print(Usage) - quit() + exit() if not DeploymentF and not DeploymentP: target = "%s %s %s" % (Platform, Release, Machine) @@ -436,9 +427,9 @@ def RunMainBuildBash(): AbsMacBuildLog = "%s/qt5.build.macos-%s-%s.log" % (ProjectDir, Platform, mode) parameters += " \\\n -bin %s" % MacBinDir parameters += " \\\n -build %s" % MacBuildDir - elif ModuleQt == 'Qt5Custom': + elif ModuleQt == 'Qt5Brew': parameters += " \\\n -qt5" - parameters += " \\\n -qmake %s" % Qt5Custom['qmake'] + parameters += " \\\n -qmake %s" % Qt5Brew['qmake'] MacPkgDir = "./qt5.pkg.macos-%s-%s" % (Platform, mode) MacBinDir = "./qt5.bin.macos-%s-%s" % (Platform, mode) MacBuildDir = "./qt5.build.macos-%s-%s" % (Platform, mode) @@ -486,7 +477,7 @@ def RunMainBuildBash(): command += " 2>&1 | tee %s" % MacBuildLog if CheckComOnly: print(command) - quit() + exit() #----------------------------------------------------- # [3] Invoke the main Bash script; takes time:-) @@ -662,7 +653,7 @@ def DeployBinariesForBundle(): depDicOrdinary.update(dependDic) ''' PrintLibraryDependencyDictionary( depDicOrdinary, "Style (3)" ) - quit() + exit() ''' print( " [5] Setting and changing the identification names among KLayout's libraries ..." ) @@ -699,13 +690,11 @@ def DeployBinariesForBundle(): shutil.copy2( sourceDir0 + "/PkgInfo", targetDir0 ) # this file is not mandatory shutil.copy2( sourceDir1 + "/klayout", targetDirM ) shutil.copy2( sourceDir2 + "/klayout.icns", targetDirR ) - shutil.copy2( sourceDir2 + "/qt.conf", targetDirM ) os.chmod( targetDir0 + "/PkgInfo", 0o0644 ) os.chmod( targetDir0 + "/Info.plist", 0o0644 ) os.chmod( targetDirM + "/klayout", 0o0755 ) - os.chmod( targetDirM + "/qt.conf", 0o0644 ) os.chmod( targetDirR + "/klayout.icns", 0o0644 ) buddies = glob.glob( sourceDir3 + "/strm*" ) @@ -733,7 +722,7 @@ def DeployBinariesForBundle(): buddies = glob.glob( "klayout.app/Contents/Buddy/strm*" ) macdepQtOpt = "" for buddy in buddies: - macdepQtOpt += "-executable=%s " % buddy + macdepQtOpt += " -executable=%s" % buddy ret = SetChangeLibIdentificationName( buddy, "../Frameworks" ) if not ret == 0: os.chdir(ProjectDir) @@ -755,11 +744,15 @@ def DeployBinariesForBundle(): deploytool = Qt5MacPorts['deploy'] app_bundle = "klayout.app" options = macdepQtOpt + verbose - elif ModuleQt == 'Qt5Custom': - deploytool = Qt5Custom['deploy'] + elif ModuleQt == 'Qt5Brew': + deploytool = Qt5Brew['deploy'] app_bundle = "klayout.app" options = macdepQtOpt + verbose + # Without the following, the plugin cocoa would not be found properly. + shutil.copy2( sourceDir2 + "/qt.conf", targetDirM ) + os.chmod( targetDirM + "/qt.conf", 0o0644 ) + os.chdir(ProjectDir) os.chdir(MacPkgDir) command = "%s %s %s" % ( deploytool, app_bundle, options ) @@ -770,18 +763,51 @@ def DeployBinariesForBundle(): print("") os.chdir(ProjectDir) return 1 - else: - print( "##### Finished deploying libraries and executables for #####" ) - print("") - os.chdir(ProjectDir) - return 0 + + deploymentPython = False + if deploymentPython: + # TODO Code incomplete! To be finished. + from macbuild.build4mac_util import WalkFrameworkPaths, PerformChanges, DetectChanges + + bundlePath = 'qt5.pkg.macos-HighSierra-release/klayout.app' + bundleExecPathAbs = os.getcwd() + '/%s/Contents/MacOS/' % bundlePath + + # rsync -a --safe-links /usr/local/opt/python/Frameworks/Python.framework/ qt5.pkg.macos-HighSierra-release/klayout.app/Contents/Frameworks/Python.framework + # cp -RL /usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages qt5.pkg.macos-HighSierra-release/klayout.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ + # rm -rf qt5.pkg.macos-HighSierra-release/klayout.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/test + + pythonFrameworkPath = '%s/Contents/Frameworks/Python.framework' % bundlePath + depdict = WalkFrameworkPaths(pythonFrameworkPath) + + pythonOriginalFrameworkPath = '/usr/local/opt/python/Frameworks/Python.framework' + appPythonFrameworkPath = '@executable_path/../Frameworks/Python.framework/' + PerformChanges(depdict, [(pythonOriginalFrameworkPath, appPythonFrameworkPath)], bundleExecPathAbs) + + klayoutPath = bundleExecPathAbs + depdict = WalkFrameworkPaths(klayoutPath, filter_regex=r'klayout$') + PerformChanges(depdict, [(pythonOriginalFrameworkPath, appPythonFrameworkPath)], bundleExecPathAbs) + + klayoutPath = bundleExecPathAbs + '../Frameworks' + depdict = WalkFrameworkPaths(klayoutPath, filter_regex=r'libklayout') + PerformChanges(depdict, [(pythonOriginalFrameworkPath, appPythonFrameworkPath)], bundleExecPathAbs) + + + usrLocalPath = '/usr/local/opt/' + appUsrLocalPath = '@executable_path/../Frameworks/' + depdict = WalkFrameworkPaths(pythonFrameworkPath) + PerformChanges(depdict, [(usrLocalPath, appUsrLocalPath)], bundleExecPathAbs) + + # usrLocalPath = '/usr/local/lib/' + # appUsrLocalPath = '@executable_path/../Frameworks/' + # depdict = WalkFrameworkPaths(pythonFrameworkPath) + # PerformChanges(depdict, [(usrLocalPath, appUsrLocalPath)], bundleExecPathAbs) + else: print( " [8] Skipped deploying Qt's Frameworks ..." ) - print( "##### Finished deploying libraries and executables for #####" ) - print("") - os.chdir(ProjectDir) - return 0 - + print( "##### Finished deploying libraries and executables for #####" ) + print("") + os.chdir(ProjectDir) + return 0 #------------------------------------------------------------------------------ ## To deploy script bundles that invoke the main bundle (klayout.app) in # editor mode or viewer mode diff --git a/macbuild/build4mac_env.py b/macbuild/build4mac_env.py index dfc2d9f68..9bbc36b43 100755 --- a/macbuild/build4mac_env.py +++ b/macbuild/build4mac_env.py @@ -21,7 +21,7 @@ XcodeToolChain = { 'nameID': '/usr/bin/install_name_tool -id ', #----------------------------------------------------- # [1] Qt #----------------------------------------------------- -Qts = [ 'Qt4MacPorts', 'Qt5MacPorts', 'Qt5Custom' ] +Qts = [ 'Qt4MacPorts', 'Qt5MacPorts', 'Qt5Brew' ] #----------------------------------------------------- # Whereabout of different components of Qt4 @@ -41,17 +41,15 @@ Qt5MacPorts = { 'qmake' : '/opt/local/libexec/qt5/bin/qmake', 'deploy': '/opt/local/libexec/qt5/bin/macdeployqt' } -# # Qt5 from Brew -# # [Key Type Name] = 'Qt5Brew' -# Qt5Brew = { 'qmake' : '/usr/local/Cellar/qt5/5.10.0_1/bin/qmake', -# 'deploy': '/usr/local/Cellar/qt5/5.10.0_1/bin/macdeployqt' -# } + +# Qt5 from Homebrew (https://brew.sh/) +# install with 'brew install qt' +# [Key Type Name] = 'Qt5Brew' +Qt5Brew = { 'qmake' : '/usr/local/opt/qt/bin/qmake', + 'deploy': '/usr/local/opt/qt/bin/macdeployqt' + } # Qt5 Custom (https://www1.qt.io/offline-installers/) -# [Key Type Name] = 'Qt5Custom' -Qt5Custom = { 'qmake' : '~/Qt5.9.4/5.9.4/clang_64/bin/qmake', - 'deploy': '~/Qt5.9.4/5.9.4/clang_64/bin/macdeployqt' - } #----------------------------------------------------- # [2] Ruby @@ -192,9 +190,9 @@ Python36MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versi # Python 3.6 from Brew *+*+*+ EXPERIMENTAL *+*+*+ # [Key Type Name] = 'pybrew' -Python36Brew= { 'exe': '/usr/local/opt/python3/Frameworks/Python.framework/Versions/Current/bin/python3.6m' , - 'inc': '/usr/local/opt/python3/Frameworks/Python.framework/Versions/Current/include/python3.6m', - 'lib': '/usr/local/opt/python3/Frameworks/Python.framework/Versions/Current/lib/libpython3.6m.dylib' +Python36Brew= { 'exe': '/usr/local/opt/python/libexec/bin/python' , + 'inc': '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/Headers', + 'lib': '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/Python' } # Consolidated dictionary kit for Python diff --git a/macbuild/build4mac_env.pyc b/macbuild/build4mac_env.pyc deleted file mode 100644 index 906f510e1be336afef6e2c376e2e682b9ba6fda4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3944 zcmb_e>vq#d5FV4e69~B{w3HMm4bVtIwqAW+0Gk9h z1+@X#832yt)4*nc&60^Siu^ucbHL`&#saWQIDG@`TQoJ;8ye~j4J+t!2jO>`a6~~@ zG_zy_`|?n&{1tZNXNA~hHC;RluzP>QJcak zPp7syhHVBX4BHZ(42VN1~3!Y3e@^BO5@6hJK6_J`%ut6 zT-mm>=D#*u(JRhGw3m} zRbUlhYrxhirsV{90_-WU4PeiJJ#PVMe0yn=O5zF*W<$hg)elWS6w(cX-O#P`T^U8e z;cCDjj!o~?;%pHcVr+_1*eEtL&9id){u;!D@tief2}b*a4`QFy7+5HhNZMKTZ_ zNHd5$H!uUg$`83`evn1w;fK1r&*cCrsV8yc)9Q8CWBee9njfS(gJX zt!MBC6N!?E95PrFpA<39Uw+I&$1%U$LCw?UpqR%KU*CBBa$SYm(wRgDu#BRr+YS(8 z6f_t&Nnsf^j1`rZ9XeSXq@n^LW+}31$yFgr^fLXrbvk{8C}#Z3qsMS z@+0)6~1d$hAj%c z&81s9y~J&GarY$qI^3jfNi@|9Piu3t`x@^3&XFb)XywZ*^d(d3r=~mRc-v>B>~->Y z#GBp?6&?g`j7daQT`=)9Mse55eveKSh(EtB`!R8;eq9Sa!X$^#Op>p17@viV>z3!g zPZ#Vkv#2rMfGIUv9LiKPaz(nxB3|GhC`+`>tEbO#BW%kLqxjX*C3HbuzkhfU_P%U!%54a{r`!Tox~8UcSWfzRS!9P+vR;P?=Z!}uGe)l6;**F(AdK-btU? 0: + for idx, lib in enumerate(deplibs): + lib = str(Path(lib)) + if lib != list(keys)[0]: + deplibs[idx] = WalkLibDependencyTree(lib, depth+1, filter_regex) + else: + return NOTHINGTODO + if depth == 0: + return deplibs + return exedepdic + else: + raise RuntimeError("Exceeded maximum recursion depth.") + + def WalkFrameworkPaths(frameworkPaths, filter_regex=r'\.(so|dylib)$'): + try: + frameworkPathsIter = iter(frameworkPaths) + except TypeError: + frameworkPathsIter = [frameworkPaths] + + dependency_dict = dict() + + for frameworkPath in frameworkPaths: + frameworkPath = str(Path(frameworkPath)) + 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)) + + dependency_dict[frameworkPath] = list() + for idx, file in enumerate(framework_files): + dict_file = {file: WalkLibDependencyTree(file)} + dependency_dict[frameworkPath].append(dict_file) + return dependency_dict + + def WalkDictTree(dependencyDict, visited_files): + libNameChanges = list() + for lib, dependencies in dependencyDict.items(): + if lib in visited_files: + continue + + dependency_list = list() + if isinstance(dependencies, list): + for deplib in dependencies: + if isinstance(deplib, str): + dependency_list.append(deplib) + if deplib not in visited_files: + visited_files.append(deplib) + elif isinstance(deplib, dict): + dependency_list.append(str(next(iter(deplib)))) + libNameChanges.extend(WalkDictTree(deplib, visited_files)) + else: + #raise RuntimeError("Unexpected value: %s" % deplib) + pass + else: + raise RuntimeError("Unexpected value: %s" % dependencies) + if len(dependency_list) > 0: + libNameChanges.append((lib, dependency_list)) + else: + libNameChanges.append((lib, )) + visited_files.append(lib) + return libNameChanges + + def FindFramework(path, root_path): + path = Path(path) + root_path = Path(root_path) + relPath = path.relative_to(root_path) + return str(root_path / relPath.parts[0]) + + def ReplaceExecutablePath(path, executable_path): + executable_path = str(executable_path) + p = Path(str(path).replace("@executable_path", "/%s/" % executable_path)) + return p + + def FileExists(file_path, executable_path): + p = ReplaceExecutablePath(file_path, executable_path) + return p.exists() + + def DetectChanges(frameworkDependencyDict): + visited_files = list() + libNameChanges = list() + for framework, libraries in frameworkDependencyDict.items(): + for libraryDict in libraries: + libNameChanges.extend(WalkDictTree(libraryDict, visited_files)) + # Changes are stored in libNameChanges in the form of ('lib.dylib', ['dep1.dylib', ...]) + + return libNameChanges + + def PerformChanges(frameworkDependencyDict, replaceFromToPairs=None, executable_path="/tmp/klayout", libdir=False): + libNameChanges = DetectChanges(frameworkDependencyDict) + cmdNameId = XcodeToolChain['nameID'] + cmdNameChg = XcodeToolChain['nameCH'] + + if replaceFromToPairs is not None: + for libNameChange in libNameChanges: + libNameChangeIterator = iter(libNameChange) + lib = next(libNameChangeIterator) + try: + dependencies = next(libNameChangeIterator) + except StopIteration: + dependencies = list() + for replaceFrom, replaceTo in replaceFromToPairs: + replaceFrom = str(Path(replaceFrom)) + replaceTo = str(Path(replaceTo)) + + if lib.find(replaceFrom) >= 0: + if libdir: + frameworkPath = FindFramework(lib, replaceFrom) + else: + frameworkPath = lib + destFrameworkPath = frameworkPath.replace(replaceFrom, replaceTo) + destFrameworkPath = ReplaceExecutablePath(destFrameworkPath, executable_path) + if not FileExists(lib.replace(replaceFrom, replaceTo), executable_path): + print (lib.replace(replaceFrom, replaceTo), "DOES NOT EXIST") + print ("COPY", frameworkPath, " -> ", destFrameworkPath) + shutil.copytree(frameworkPath, destFrameworkPath) + + fileName = ReplaceExecutablePath(lib.replace(replaceFrom, replaceTo), executable_path) + nameId = lib.replace(replaceFrom, replaceTo) + command = "%s %s %s" % ( cmdNameId, nameId, fileName ) + if not os.access(fileName, os.W_OK): + command = "chmod u+w %s; %s; chmod u-w %s" % (fileName, command, fileName) + print("\t%s" % command) + if subprocess.call( command, shell=True ) != 0: + msg = "!!! Failed to set the new identification name to <%s> !!!" + print( msg % fileName, file=sys.stderr ) + return 1 + + fileName = ReplaceExecutablePath(lib.replace(replaceFrom, replaceTo), executable_path) + for dependency in dependencies: + if dependency.find(replaceFrom) >= 0: + print("In:", fileName) + print("\tRENAME", dependency, " -> ", dependency.replace(replaceFrom, replaceTo)) + + # Try changing id first + nameId = dependency.replace(replaceFrom, replaceTo) + command = "%s %s %s" % ( cmdNameId, nameId, fileName ) + if not os.access(fileName, os.W_OK): + command = "chmod u+w %s; %s; chmod u-w %s" % (fileName, command, fileName) + print("\t%s" % command) + if subprocess.call( command, shell=True ) != 0: + msg = "!!! Failed to set the new identification name to <%s> !!!" + print( msg % fileName, file=sys.stderr ) + return 1 + + # Rename dependencies + nameOld = dependency + nameNew = dependency.replace(replaceFrom, replaceTo) + command = "%s %s %s %s" % ( cmdNameChg, nameOld, nameNew, fileName ) + if not os.access(fileName, os.W_OK): + command = "chmod u+w %s; %s; chmod u-w %s" % (fileName, command, fileName) + + print("\t%s" % command) + if subprocess.call( command, shell=True ) != 0: + msg = "!!! Failed to set the new identification name to <%s> !!!" + print( msg % fileName, file=sys.stderr ) + return 1 + + #------------------------------------------------------------------------------ ## To get KLayout's version from a file; most likely from 'version.sh' # diff --git a/macbuild/build4mac_util.pyc b/macbuild/build4mac_util.pyc deleted file mode 100644 index e1194a0e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zLnjJavVd3O~J($N5Q8cRh5nwdwP`v% z5SY=mY#+rm@0qSi@Ybu{-S|Ni+Vqd;v{i^9t(9{x2OmNYpORC%ggI)g zHvX?8?I)()cKKYED#(m3uSqUDHKnMhS+}cykS5gEG>x}owVzhOYCvzhoq-%CPh8qk zi_hm*Y}0*`C9Lmp_3IQrp;)D0HU8X&s{LQ@`8@W`P8{?j^BHSoh3zbo!QfMT- Date: Thu, 15 Mar 2018 01:29:01 -0400 Subject: [PATCH 3/5] Changing python path for brew installation - Assuming user installing with brew wants the library link to go to cellar rather than /usr/local/opt/. - Python gets updated often in brew, and an update could possibly break klayout. --- macbuild/build4mac.py | 2 +- macbuild/build4mac_env.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py index 2c7ed5667..f7d51ba85 100755 --- a/macbuild/build4mac.py +++ b/macbuild/build4mac.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # -*- coding: utf-8 -*- #=============================================================================== diff --git a/macbuild/build4mac_env.py b/macbuild/build4mac_env.py index 9bbc36b43..4d2b31f1e 100755 --- a/macbuild/build4mac_env.py +++ b/macbuild/build4mac_env.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # -*- coding: utf-8 -*- #=============================================================================== @@ -189,10 +189,10 @@ Python36MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versi } # Python 3.6 from Brew *+*+*+ EXPERIMENTAL *+*+*+ -# [Key Type Name] = 'pybrew' -Python36Brew= { 'exe': '/usr/local/opt/python/libexec/bin/python' , - 'inc': '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/Headers', - 'lib': '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/Python' +# [Key Type Name] = 'B36' +Python36Brew= { 'exe': '$(realpath /usr/local/opt/python/libexec/bin/python)' , + 'inc': '$(realpath /usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/Headers)', + 'lib': '$(realpath /usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/Python)' } # Consolidated dictionary kit for Python From b5b3144aba877555f625656cc96c099e3a36d93b Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Thu, 15 Mar 2018 01:32:44 -0400 Subject: [PATCH 4/5] Revert "Changing python path for brew installation" This reverts commit fa96f6d35232e81134de467bc04b96931ab644f6. Thinking about it, it would be horrible for deployment. Need to rethink this. Klayout will break once python goes to 3.7 and brew updates it. --- macbuild/build4mac.py | 2 +- macbuild/build4mac_env.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py index f7d51ba85..2c7ed5667 100755 --- a/macbuild/build4mac.py +++ b/macbuild/build4mac.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#! /usr/bin/env python # -*- coding: utf-8 -*- #=============================================================================== diff --git a/macbuild/build4mac_env.py b/macbuild/build4mac_env.py index 4d2b31f1e..9bbc36b43 100755 --- a/macbuild/build4mac_env.py +++ b/macbuild/build4mac_env.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#! /usr/bin/env python # -*- coding: utf-8 -*- #=============================================================================== @@ -189,10 +189,10 @@ Python36MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versi } # Python 3.6 from Brew *+*+*+ EXPERIMENTAL *+*+*+ -# [Key Type Name] = 'B36' -Python36Brew= { 'exe': '$(realpath /usr/local/opt/python/libexec/bin/python)' , - 'inc': '$(realpath /usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/Headers)', - 'lib': '$(realpath /usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/Python)' +# [Key Type Name] = 'pybrew' +Python36Brew= { 'exe': '/usr/local/opt/python/libexec/bin/python' , + 'inc': '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/Headers', + 'lib': '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/Python' } # Consolidated dictionary kit for Python From 945bf9ea2338f5441bf813a574b026b3138fe2c9 Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Thu, 15 Mar 2018 00:45:33 -0400 Subject: [PATCH 5/5] adding symlinks to build4mac scripts --- build4mac.py | 1 + makeDMG4mac.py | 1 + 2 files changed, 2 insertions(+) create mode 120000 build4mac.py create mode 120000 makeDMG4mac.py diff --git a/build4mac.py b/build4mac.py new file mode 120000 index 000000000..44ecee4cf --- /dev/null +++ b/build4mac.py @@ -0,0 +1 @@ +macbuild/build4mac.py \ No newline at end of file diff --git a/makeDMG4mac.py b/makeDMG4mac.py new file mode 120000 index 000000000..a1d9537b0 --- /dev/null +++ b/makeDMG4mac.py @@ -0,0 +1 @@ +macbuild/makeDMG4mac.py \ No newline at end of file