@@ -797,23 +797,41 @@ def DeployBinariesForBundle():
797
797
os .chmod ( targetDirM + "/klayout_console" , 0o0755 )
798
798
799
799
print (" [2] Relinking dylib dependencies inside Python.framework" )
800
+ print (" [2.1] Patching Python Framework" )
800
801
depdict = WalkFrameworkPaths (pythonFrameworkPath )
801
802
appPythonFrameworkPath = '@executable_path/../Frameworks/Python.framework/'
802
- PerformChanges (depdict , [(pythonOriginalFrameworkPath , appPythonFrameworkPath )], bundleExecPathAbs )
803
+ PerformChanges (depdict , [(pythonOriginalFrameworkPath , appPythonFrameworkPath , False )], bundleExecPathAbs )
803
804
805
+ print (" [2.2] Patching /usr/local/opt/ libs" )
804
806
usrLocalPath = '/usr/local/opt/'
805
807
appUsrLocalPath = '@executable_path/../Frameworks/'
806
- depdict = WalkFrameworkPaths (pythonFrameworkPath )
807
- PerformChanges (depdict , [(usrLocalPath , appUsrLocalPath )], bundleExecPathAbs , libdir = True )
808
+ replacePairs = [(usrLocalPath , appUsrLocalPath , True )]
809
+ depdict = WalkFrameworkPaths (pythonFrameworkPath , search_path_filter = r'\t+/usr/local/(opt|Cellar)' )
810
+ PerformChanges (depdict , replacePairs , bundleExecPathAbs )
811
+
812
+ print (" [2.3] Patching openssl, gdbm, readline, sqlite, tcl-tk, xz" )
813
+ usrLocalPath = '/usr/local/opt'
814
+ appUsrLocalPath = '@executable_path/../Frameworks/'
815
+ replacePairs = [(usrLocalPath , appUsrLocalPath , True )]
816
+ replacePairs .extend ([(openssl_version , '@executable_path/../Frameworks/openssl' , True )
817
+ for openssl_version in list (Path ('/usr/local/Cellar/openssl' ).glob ('*' ))])
818
+ depdict = WalkFrameworkPaths ([pythonFrameworkPath + '/../openssl' ,
819
+ pythonFrameworkPath + '/../gdbm' ,
820
+ pythonFrameworkPath + '/../readline' ,
821
+ pythonFrameworkPath + '/../sqlite' ,
822
+ pythonFrameworkPath + '/../tcl-tk' ,
823
+ pythonFrameworkPath + '/../xz' ], search_path_filter = r'\t+/usr/local/(opt|Cellar)' )
824
+
825
+ PerformChanges (depdict , replacePairs , bundleExecPathAbs )
808
826
809
827
print (" [3] Relinking dylib dependencies for klayout" )
810
828
klayoutPath = bundleExecPathAbs
811
829
depdict = WalkFrameworkPaths (klayoutPath , filter_regex = r'klayout$' )
812
- PerformChanges (depdict , [(pythonOriginalFrameworkPath , appPythonFrameworkPath )], bundleExecPathAbs )
830
+ PerformChanges (depdict , [(pythonOriginalFrameworkPath , appPythonFrameworkPath , False )], bundleExecPathAbs )
813
831
814
832
libKlayoutPath = bundleExecPathAbs + '../Frameworks'
815
833
depdict = WalkFrameworkPaths (libKlayoutPath , filter_regex = r'libklayout' )
816
- PerformChanges (depdict , [(pythonOriginalFrameworkPath , appPythonFrameworkPath )], bundleExecPathAbs )
834
+ PerformChanges (depdict , [(pythonOriginalFrameworkPath , appPythonFrameworkPath , False )], bundleExecPathAbs )
817
835
818
836
print (" [4] Patching site.py, pip/, and distutils/" )
819
837
site_module = f"{ pythonFrameworkPath } /Versions/3.6/lib/python3.6/site.py"
0 commit comments