Mercurial > cpython-lru_cache-weakref
comparison Mac/scripts/ConfigurePython.py @ 6175:19fe880ca919 legacy-trunk
Put all prints inside "if verbose:"
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Wed, 27 Aug 1997 14:11:15 +0000 |
| parents | 8cb2afd10119 |
| children | 7a3808edc539 |
comparison
equal
deleted
inserted
replaced
| 6174:77135da9f36c | 6175:19fe880ca919 |
|---|---|
| 8 # Jack Jansen, CWI, August 1996 | 8 # Jack Jansen, CWI, August 1996 |
| 9 | 9 |
| 10 import sys | 10 import sys |
| 11 import os | 11 import os |
| 12 import macfs | 12 import macfs |
| 13 verbose=0 | |
| 13 | 14 |
| 14 ppc_goals = [ | 15 ppc_goals = [ |
| 15 ("AE.ppc.slb", "toolboxmodules.ppc.slb"), | 16 ("AE.ppc.slb", "toolboxmodules.ppc.slb"), |
| 16 ("Ctl.ppc.slb", "toolboxmodules.ppc.slb"), | 17 ("Ctl.ppc.slb", "toolboxmodules.ppc.slb"), |
| 17 ("Dlg.ppc.slb", "toolboxmodules.ppc.slb"), | 18 ("Dlg.ppc.slb", "toolboxmodules.ppc.slb"), |
| 76 import os | 77 import os |
| 77 | 78 |
| 78 while not os.path.isdir(":Plugins"): | 79 while not os.path.isdir(":Plugins"): |
| 79 os.chdir("::") | 80 os.chdir("::") |
| 80 os.chdir(":Plugins") | 81 os.chdir(":Plugins") |
| 81 print "current directory is", os.getcwd() | 82 if verbose: print "current directory is", os.getcwd() |
| 82 | 83 |
| 83 def loadtoolboxmodules(): | 84 def loadtoolboxmodules(): |
| 84 """Attempt to load the Res module""" | 85 """Attempt to load the Res module""" |
| 85 try: | 86 try: |
| 86 import Res | 87 import Res |
| 87 except ImportError, arg: | 88 except ImportError, arg: |
| 88 err1 = arg | 89 err1 = arg |
| 89 pass | 90 pass |
| 90 else: | 91 else: |
| 91 print 'imported Res the standard way.' | 92 if verbose: print 'imported Res the standard way.' |
| 92 return | 93 return |
| 93 | 94 |
| 94 # We cannot import it. First attempt to load the cfm68k version | 95 # We cannot import it. First attempt to load the cfm68k version |
| 95 import imp | 96 import imp |
| 96 try: | 97 try: |
| 97 dummy = imp.load_dynamic('Res', 'toolboxmodules.CFM68K.slb') | 98 dummy = imp.load_dynamic('Res', 'toolboxmodules.CFM68K.slb') |
| 98 except ImportError, arg: | 99 except ImportError, arg: |
| 99 err2 = arg | 100 err2 = arg |
| 100 pass | 101 pass |
| 101 else: | 102 else: |
| 102 print 'Loaded Res from toolboxmodules.CFM68K.slb.' | 103 if verbose: print 'Loaded Res from toolboxmodules.CFM68K.slb.' |
| 103 return | 104 return |
| 104 | 105 |
| 105 # Ok, try the ppc version | 106 # Ok, try the ppc version |
| 106 try: | 107 try: |
| 107 dummy = imp.load_dynamic('Res', 'toolboxmodules.ppc.slb') | 108 dummy = imp.load_dynamic('Res', 'toolboxmodules.ppc.slb') |
| 108 except ImportError, arg: | 109 except ImportError, arg: |
| 109 err3 = arg | 110 err3 = arg |
| 110 pass | 111 pass |
| 111 else: | 112 else: |
| 112 print 'Loaded Res from toolboxmodules.ppc.slb.' | 113 if verbose: print 'Loaded Res from toolboxmodules.ppc.slb.' |
| 113 return | 114 return |
| 114 | 115 |
| 115 # Tough luck.... | 116 # Tough luck.... |
| 116 print "I cannot import the Res module, nor load it from either of" | 117 print "I cannot import the Res module, nor load it from either of" |
| 117 print "toolboxmodules shared libraries. The errors encountered were:" | 118 print "toolboxmodules shared libraries. The errors encountered were:" |
| 132 import macostools | 133 import macostools |
| 133 version = string.split(sys.version)[0] | 134 version = string.split(sys.version)[0] |
| 134 dst = getextensiondirfile(src+ ' ' + version) | 135 dst = getextensiondirfile(src+ ' ' + version) |
| 135 if not os.path.exists(src): | 136 if not os.path.exists(src): |
| 136 if not os.path.exists(altsrc): | 137 if not os.path.exists(altsrc): |
| 137 print '*', src, 'not found' | 138 if verbose: print '*', src, 'not found' |
| 138 return 0 | 139 return 0 |
| 139 src = altsrc | 140 src = altsrc |
| 140 try: | 141 try: |
| 141 os.unlink(dst) | 142 os.unlink(dst) |
| 142 except os.error: | 143 except os.error: |
| 143 pass | 144 pass |
| 144 macostools.mkalias(src, dst) | 145 macostools.mkalias(src, dst) |
| 145 print ' ', dst, '->', src | 146 if verbose: print ' ', dst, '->', src |
| 146 return 1 | 147 return 1 |
| 147 | 148 |
| 148 | 149 |
| 149 def main(): | 150 def main(): |
| 150 gotopluginfolder() | 151 gotopluginfolder() |
| 154 import macostools | 155 import macostools |
| 155 | 156 |
| 156 # Remove old .slb aliases and collect a list of .slb files | 157 # Remove old .slb aliases and collect a list of .slb files |
| 157 LibFiles = [] | 158 LibFiles = [] |
| 158 allfiles = os.listdir(':') | 159 allfiles = os.listdir(':') |
| 159 print 'Removing old aliases...' | 160 if verbose: print 'Removing old aliases...' |
| 160 for f in allfiles: | 161 for f in allfiles: |
| 161 if f[-4:] == '.slb': | 162 if f[-4:] == '.slb': |
| 162 finfo = macfs.FSSpec(f).GetFInfo() | 163 finfo = macfs.FSSpec(f).GetFInfo() |
| 163 if finfo.Flags & 0x8000: | 164 if finfo.Flags & 0x8000: |
| 164 print ' Removing', f | 165 if verbose: print ' Removing', f |
| 165 os.unlink(f) | 166 os.unlink(f) |
| 166 else: | 167 else: |
| 167 LibFiles.append(f) | 168 LibFiles.append(f) |
| 168 print ' Found', f | 169 if verbose: print ' Found', f |
| 169 print | 170 if verbose: print |
| 170 | 171 |
| 171 # Create the new PPC aliases. | 172 # Create the new PPC aliases. |
| 172 print 'Creating PPC aliases...' | 173 if verbose: print 'Creating PPC aliases...' |
| 173 for dst, src in ppc_goals: | 174 for dst, src in ppc_goals: |
| 174 if src in LibFiles: | 175 if src in LibFiles: |
| 175 macostools.mkalias(src, dst) | 176 macostools.mkalias(src, dst) |
| 176 print ' ', dst, '->', src | 177 if verbose: print ' ', dst, '->', src |
| 177 else: | 178 else: |
| 178 print '*', dst, 'not created:', src, 'not found' | 179 if verbose: print '*', dst, 'not created:', src, 'not found' |
| 179 print | 180 if verbose: print |
| 180 | 181 |
| 181 # Create the CFM68K aliases. | 182 # Create the CFM68K aliases. |
| 182 print 'Creating CFM68K aliases...' | 183 if verbose: print 'Creating CFM68K aliases...' |
| 183 for dst, src in cfm68k_goals: | 184 for dst, src in cfm68k_goals: |
| 184 if src in LibFiles: | 185 if src in LibFiles: |
| 185 macostools.mkalias(src, dst) | 186 macostools.mkalias(src, dst) |
| 186 print ' ', dst, '->', src | 187 if verbose: print ' ', dst, '->', src |
| 187 else: | 188 else: |
| 188 print '*', dst, 'not created:', src, 'not found' | 189 if verbose: print '*', dst, 'not created:', src, 'not found' |
| 189 print | 190 if verbose: print |
| 190 | 191 |
| 191 # Create the PythonCore alias(es) | 192 # Create the PythonCore alias(es) |
| 192 print 'Creating PythonCore aliases in Extensions folder...' | 193 if verbose: print 'Creating PythonCore aliases in Extensions folder...' |
| 193 os.chdir('::') | 194 os.chdir('::') |
| 194 n = 0 | 195 n = 0 |
| 195 n = n + mkcorealias('PythonCore', 'PythonCore') | 196 n = n + mkcorealias('PythonCore', 'PythonCore') |
| 196 n = n + mkcorealias('PythonCorePPC', ':build.macppc.shared:PythonCorePPC') | 197 n = n + mkcorealias('PythonCorePPC', ':build.macppc.shared:PythonCorePPC') |
| 197 n = n + mkcorealias('PythonCoreCFM68K', ':build.mac68k.shared:PythonCoreCFM68K') | 198 n = n + mkcorealias('PythonCoreCFM68K', ':build.mac68k.shared:PythonCoreCFM68K') |
| 198 if n == 0: | 199 if verbose and n == 0: |
| 199 sys.exit(1) | 200 sys.exit(1) |
| 200 | 201 |
| 201 if __name__ == '__main__': | 202 if __name__ == '__main__': |
| 203 if len(sys.argv) > 1 and sys.argv[1] == '-v': | |
| 204 verbose = 1 | |
| 202 main() | 205 main() |
