Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09dcff7

Browse files
committed
Put all prints inside "if verbose:"
1 parent ebacc2e commit 09dcff7

1 file changed

Lines changed: 23 additions & 20 deletions

File tree

Mac/scripts/ConfigurePython.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import sys
1111
import os
1212
import macfs
13+
verbose=0
1314

1415
ppc_goals = [
1516
("AE.ppc.slb", "toolboxmodules.ppc.slb"),
@@ -78,7 +79,7 @@ def gotopluginfolder():
7879
while not os.path.isdir(":Plugins"):
7980
os.chdir("::")
8081
os.chdir(":Plugins")
81-
print "current directory is", os.getcwd()
82+
if verbose: print "current directory is", os.getcwd()
8283

8384
def loadtoolboxmodules():
8485
"""Attempt to load the Res module"""
@@ -88,7 +89,7 @@ def loadtoolboxmodules():
8889
err1 = arg
8990
pass
9091
else:
91-
print 'imported Res the standard way.'
92+
if verbose: print 'imported Res the standard way.'
9293
return
9394

9495
# We cannot import it. First attempt to load the cfm68k version
@@ -99,7 +100,7 @@ def loadtoolboxmodules():
99100
err2 = arg
100101
pass
101102
else:
102-
print 'Loaded Res from toolboxmodules.CFM68K.slb.'
103+
if verbose: print 'Loaded Res from toolboxmodules.CFM68K.slb.'
103104
return
104105

105106
# Ok, try the ppc version
@@ -109,7 +110,7 @@ def loadtoolboxmodules():
109110
err3 = arg
110111
pass
111112
else:
112-
print 'Loaded Res from toolboxmodules.ppc.slb.'
113+
if verbose: print 'Loaded Res from toolboxmodules.ppc.slb.'
113114
return
114115

115116
# Tough luck....
@@ -134,15 +135,15 @@ def mkcorealias(src, altsrc):
134135
dst = getextensiondirfile(src+ ' ' + version)
135136
if not os.path.exists(src):
136137
if not os.path.exists(altsrc):
137-
print '*', src, 'not found'
138+
if verbose: print '*', src, 'not found'
138139
return 0
139140
src = altsrc
140141
try:
141142
os.unlink(dst)
142143
except os.error:
143144
pass
144145
macostools.mkalias(src, dst)
145-
print ' ', dst, '->', src
146+
if verbose: print ' ', dst, '->', src
146147
return 1
147148

148149

@@ -156,47 +157,49 @@ def main():
156157
# Remove old .slb aliases and collect a list of .slb files
157158
LibFiles = []
158159
allfiles = os.listdir(':')
159-
print 'Removing old aliases...'
160+
if verbose: print 'Removing old aliases...'
160161
for f in allfiles:
161162
if f[-4:] == '.slb':
162163
finfo = macfs.FSSpec(f).GetFInfo()
163164
if finfo.Flags & 0x8000:
164-
print ' Removing', f
165+
if verbose: print ' Removing', f
165166
os.unlink(f)
166167
else:
167168
LibFiles.append(f)
168-
print ' Found', f
169-
print
169+
if verbose: print ' Found', f
170+
if verbose: print
170171

171172
# Create the new PPC aliases.
172-
print 'Creating PPC aliases...'
173+
if verbose: print 'Creating PPC aliases...'
173174
for dst, src in ppc_goals:
174175
if src in LibFiles:
175176
macostools.mkalias(src, dst)
176-
print ' ', dst, '->', src
177+
if verbose: print ' ', dst, '->', src
177178
else:
178-
print '*', dst, 'not created:', src, 'not found'
179-
print
179+
if verbose: print '*', dst, 'not created:', src, 'not found'
180+
if verbose: print
180181

181182
# Create the CFM68K aliases.
182-
print 'Creating CFM68K aliases...'
183+
if verbose: print 'Creating CFM68K aliases...'
183184
for dst, src in cfm68k_goals:
184185
if src in LibFiles:
185186
macostools.mkalias(src, dst)
186-
print ' ', dst, '->', src
187+
if verbose: print ' ', dst, '->', src
187188
else:
188-
print '*', dst, 'not created:', src, 'not found'
189-
print
189+
if verbose: print '*', dst, 'not created:', src, 'not found'
190+
if verbose: print
190191

191192
# Create the PythonCore alias(es)
192-
print 'Creating PythonCore aliases in Extensions folder...'
193+
if verbose: print 'Creating PythonCore aliases in Extensions folder...'
193194
os.chdir('::')
194195
n = 0
195196
n = n + mkcorealias('PythonCore', 'PythonCore')
196197
n = n + mkcorealias('PythonCorePPC', ':build.macppc.shared:PythonCorePPC')
197198
n = n + mkcorealias('PythonCoreCFM68K', ':build.mac68k.shared:PythonCoreCFM68K')
198-
if n == 0:
199+
if verbose and n == 0:
199200
sys.exit(1)
200201

201202
if __name__ == '__main__':
203+
if len(sys.argv) > 1 and sys.argv[1] == '-v':
204+
verbose = 1
202205
main()

0 commit comments

Comments
 (0)