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

Skip to content

Commit cb1f4c4

Browse files
committed
Standardized whitespace around function calls.
1 parent 963cd2d commit cb1f4c4

14 files changed

Lines changed: 338 additions & 339 deletions

Lib/distutils/command/bdist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def run (self):
132132
# keep its temporary files around so subsequent runs go faster.
133133
if cmd_name in commands[i+1:]:
134134
sub_cmd.keep_temp = 1
135-
self.run_command (cmd_name)
135+
self.run_command(cmd_name)
136136

137137
# run()
138138

Lib/distutils/command/bdist_dumb.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,24 @@ def finalize_options (self):
7171

7272
def run (self):
7373

74-
self.run_command ('build')
74+
self.run_command('build')
7575

7676
install = self.reinitialize_command('install', reinit_subcommands=1)
7777
install.root = self.bdist_dir
7878

79-
self.announce ("installing to %s" % self.bdist_dir)
79+
self.announce("installing to %s" % self.bdist_dir)
8080
self.run_command('install')
8181

8282
# And make an archive relative to the root of the
8383
# pseudo-installation tree.
8484
archive_basename = "%s.%s" % (self.distribution.get_fullname(),
8585
self.plat_name)
86-
self.make_archive (os.path.join(self.dist_dir, archive_basename),
87-
self.format,
88-
root_dir=self.bdist_dir)
86+
self.make_archive(os.path.join(self.dist_dir, archive_basename),
87+
self.format,
88+
root_dir=self.bdist_dir)
8989

9090
if not self.keep_temp:
91-
remove_tree (self.bdist_dir, self.verbose, self.dry_run)
91+
remove_tree(self.bdist_dir, self.verbose, self.dry_run)
9292

9393
# run()
9494

Lib/distutils/command/bdist_rpm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def run (self):
258258

259259
# Make a source distribution and copy to SOURCES directory with
260260
# optional icon.
261-
sdist = self.reinitialize_command ('sdist')
261+
sdist = self.reinitialize_command('sdist')
262262
if self.use_bzip2:
263263
sdist.formats = ['bztar']
264264
else:

Lib/distutils/command/bdist_wininst.py

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def finalize_options (self):
5656
if self.distribution.has_ext_modules():
5757
short_version = sys.version[:3]
5858
if self.target_version and self.target_version != short_version:
59-
raise DistutilsOptionError ("target version can only be" +
60-
short_version)
59+
raise DistutilsOptionError, \
60+
"target version can only be" + short_version
6161
self.target_version = short_version
6262

6363
self.set_undefined_options('bdist', ('dist_dir', 'dist_dir'))
@@ -73,7 +73,7 @@ def run (self):
7373
("distribution contains extensions and/or C libraries; "
7474
"must be compiled on a Windows 32 platform")
7575

76-
self.run_command ('build')
76+
self.run_command('build')
7777

7878
install = self.reinitialize_command('install')
7979
install.root = self.bdist_dir
@@ -91,7 +91,7 @@ def run (self):
9191

9292
install_lib.ensure_finalized()
9393

94-
self.announce ("installing to %s" % self.bdist_dir)
94+
self.announce("installing to %s" % self.bdist_dir)
9595
install.ensure_finalized()
9696
install.run()
9797

@@ -103,24 +103,24 @@ def run (self):
103103

104104
# Our archive MUST be relative to sys.prefix, which is the
105105
# same as install_purelib in the 'nt' scheme.
106-
root_dir = os.path.normpath (install.install_purelib)
106+
root_dir = os.path.normpath(install.install_purelib)
107107

108108
# Sanity check: Make sure everything is included
109109
for key in ('purelib', 'platlib', 'headers', 'scripts', 'data'):
110110
attrname = 'install_' + key
111-
install_x = getattr (install, attrname)
111+
install_x = getattr(install, attrname)
112112
# (Use normpath so that we can string.find to look for
113113
# subdirectories)
114-
install_x = os.path.normpath (install_x)
115-
if string.find (install_x, root_dir) != 0:
114+
install_x = os.path.normpath(install_x)
115+
if string.find(install_x, root_dir) != 0:
116116
raise DistutilsInternalError \
117117
("'%s' not included in install_lib" % key)
118-
arcname = self.make_archive (archive_basename, "zip",
119-
root_dir=root_dir)
120-
self.create_exe (arcname, fullname)
118+
arcname = self.make_archive(archive_basename, "zip",
119+
root_dir=root_dir)
120+
self.create_exe(arcname, fullname)
121121

122122
if not self.keep_temp:
123-
remove_tree (self.bdist_dir, self.verbose, self.dry_run)
123+
remove_tree(self.bdist_dir, self.verbose, self.dry_run)
124124

125125
# run()
126126

@@ -133,37 +133,37 @@ def get_inidata (self):
133133
# Write the [metadata] section. Values are written with
134134
# repr()[1:-1], so they do not contain unprintable characters, and
135135
# are not surrounded by quote chars.
136-
lines.append ("[metadata]")
136+
lines.append("[metadata]")
137137

138138
# 'info' will be displayed in the installer's dialog box,
139139
# describing the items to be installed.
140140
info = (metadata.long_description or '') + '\n'
141141

142-
for name in dir (metadata):
142+
for name in dir(metadata):
143143
if (name != 'long_description'):
144-
data = getattr (metadata, name)
144+
data = getattr(metadata, name)
145145
if data:
146146
info = info + ("\n %s: %s" % \
147-
(string.capitalize (name), data))
148-
lines.append ("%s=%s" % (name, repr (data)[1:-1]))
147+
(string.capitalize(name), data))
148+
lines.append("%s=%s" % (name, repr(data)[1:-1]))
149149

150150
# The [setup] section contains entries controlling
151151
# the installer runtime.
152-
lines.append ("\n[Setup]")
153-
lines.append ("info=%s" % repr (info)[1:-1])
154-
lines.append ("target_compile=%d" % (not self.no_target_compile))
155-
lines.append ("target_optimize=%d" % (not self.no_target_optimize))
152+
lines.append("\n[Setup]")
153+
lines.append("info=%s" % repr(info)[1:-1])
154+
lines.append("target_compile=%d" % (not self.no_target_compile))
155+
lines.append("target_optimize=%d" % (not self.no_target_optimize))
156156
if self.target_version:
157-
lines.append ("target_version=%s" % self.target_version)
157+
lines.append("target_version=%s" % self.target_version)
158158

159159
title = self.distribution.get_fullname()
160-
lines.append ("title=%s" % repr (title)[1:-1])
160+
lines.append("title=%s" % repr(title)[1:-1])
161161
import time
162162
import distutils
163163
build_info = "Build %s with distutils-%s" % \
164-
(time.ctime (time.time()), distutils.__version__)
165-
lines.append ("build_info=%s" % build_info)
166-
return string.join (lines, "\n")
164+
(time.ctime(time.time()), distutils.__version__)
165+
lines.append("build_info=%s" % build_info)
166+
return string.join(lines, "\n")
167167

168168
# get_inidata()
169169

@@ -183,36 +183,36 @@ def create_exe (self, arcname, fullname):
183183
else:
184184
installer_name = os.path.join(self.dist_dir,
185185
"%s.win32.exe" % fullname)
186-
self.announce ("creating %s" % installer_name)
186+
self.announce("creating %s" % installer_name)
187187

188-
file = open (installer_name, "wb")
189-
file.write (self.get_exe_bytes ())
190-
file.write (cfgdata)
191-
header = struct.pack ("<ii",
192-
0x12345679, # tag
193-
len (cfgdata)) # length
194-
file.write (header)
195-
file.write (open (arcname, "rb").read())
188+
file = open(installer_name, "wb")
189+
file.write(self.get_exe_bytes())
190+
file.write(cfgdata)
191+
header = struct.pack("<ii",
192+
0x12345679, # tag
193+
len(cfgdata)) # length
194+
file.write(header)
195+
file.write(open(arcname, "rb").read())
196196

197197
# create_exe()
198198

199199
def get_exe_bytes (self):
200200
import base64
201-
return base64.decodestring (EXEDATA)
201+
return base64.decodestring(EXEDATA)
202202

203203
# class bdist_wininst
204204

205205
if __name__ == '__main__':
206206
# recreate EXEDATA from wininst.exe by rewriting this file
207207
import re, base64
208-
moddata = open ("bdist_wininst.py", "r").read()
209-
exedata = open ("../../misc/wininst.exe", "rb").read()
210-
print "wininst.exe length is %d bytes" % len (exedata)
211-
print "wininst.exe encoded length is %d bytes" % len (base64.encodestring (exedata))
212-
exp = re.compile ('EXE'+'DATA = """\\\\(\n.*)*\n"""', re.M)
213-
data = exp.sub ('EXE' + 'DATA = """\\\\\n%s"""' %
214-
base64.encodestring (exedata), moddata)
215-
open ("bdist_wininst.py", "w").write (data)
208+
moddata = open("bdist_wininst.py", "r").read()
209+
exedata = open("../../misc/wininst.exe", "rb").read()
210+
print "wininst.exe length is %d bytes" % len(exedata)
211+
print "wininst.exe encoded length is %d bytes" % len(base64.encodestring(exedata))
212+
exp = re.compile('EXE'+'DATA = """\\\\(\n.*)*\n"""', re.M)
213+
data = exp.sub('EXE' + 'DATA = """\\\\\n%s"""' %
214+
base64.encodestring(exedata), moddata)
215+
open("bdist_wininst.py", "w").write(data)
216216
print "bdist_wininst.py recreated"
217217

218218
EXEDATA = """\

Lib/distutils/command/build.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ def finalize_options (self):
7070
# 'lib.<plat>' under the base build directory. We only use one of
7171
# them for a given distribution, though --
7272
if self.build_purelib is None:
73-
self.build_purelib = os.path.join (self.build_base, 'lib')
73+
self.build_purelib = os.path.join(self.build_base, 'lib')
7474
if self.build_platlib is None:
75-
self.build_platlib = os.path.join (self.build_base,
76-
'lib' + plat_specifier)
75+
self.build_platlib = os.path.join(self.build_base,
76+
'lib' + plat_specifier)
7777

7878
# 'build_lib' is the actual directory that we will use for this
7979
# particular module distribution -- if user didn't supply it, pick
@@ -87,10 +87,10 @@ def finalize_options (self):
8787
# 'build_temp' -- temporary directory for compiler turds,
8888
# "build/temp.<plat>"
8989
if self.build_temp is None:
90-
self.build_temp = os.path.join (self.build_base,
91-
'temp' + plat_specifier)
90+
self.build_temp = os.path.join(self.build_base,
91+
'temp' + plat_specifier)
9292
if self.build_scripts is None:
93-
self.build_scripts = os.path.join (self.build_base, 'scripts')
93+
self.build_scripts = os.path.join(self.build_base, 'scripts')
9494

9595
# finalize_options ()
9696

Lib/distutils/command/build_clib.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,22 @@ def finalize_options (self):
8080
# I think that C libraries are really just temporary build
8181
# by-products, at least from the point of view of building Python
8282
# extensions -- but I want to keep my options open.
83-
self.set_undefined_options ('build',
84-
('build_temp', 'build_clib'),
85-
('build_temp', 'build_temp'),
86-
('compiler', 'compiler'),
87-
('debug', 'debug'),
88-
('force', 'force'))
83+
self.set_undefined_options('build',
84+
('build_temp', 'build_clib'),
85+
('build_temp', 'build_temp'),
86+
('compiler', 'compiler'),
87+
('debug', 'debug'),
88+
('force', 'force'))
8989

9090
self.libraries = self.distribution.libraries
9191
if self.libraries:
92-
self.check_library_list (self.libraries)
92+
self.check_library_list(self.libraries)
9393

9494
if self.include_dirs is None:
9595
self.include_dirs = self.distribution.include_dirs or []
96-
if type (self.include_dirs) is StringType:
97-
self.include_dirs = string.split (self.include_dirs,
98-
os.pathsep)
96+
if type(self.include_dirs) is StringType:
97+
self.include_dirs = string.split(self.include_dirs,
98+
os.pathsep)
9999

100100
# XXX same as for build_ext -- what about 'self.define' and
101101
# 'self.undef' ?
@@ -110,23 +110,23 @@ def run (self):
110110

111111
# Yech -- this is cut 'n pasted from build_ext.py!
112112
from distutils.ccompiler import new_compiler
113-
self.compiler = new_compiler (compiler=self.compiler,
114-
verbose=self.verbose,
115-
dry_run=self.dry_run,
116-
force=self.force)
113+
self.compiler = new_compiler(compiler=self.compiler,
114+
verbose=self.verbose,
115+
dry_run=self.dry_run,
116+
force=self.force)
117117
customize_compiler(self.compiler)
118118

119119
if self.include_dirs is not None:
120-
self.compiler.set_include_dirs (self.include_dirs)
120+
self.compiler.set_include_dirs(self.include_dirs)
121121
if self.define is not None:
122122
# 'define' option is a list of (name,value) tuples
123123
for (name,value) in self.define:
124-
self.compiler.define_macro (name, value)
124+
self.compiler.define_macro(name, value)
125125
if self.undef is not None:
126126
for macro in self.undef:
127-
self.compiler.undefine_macro (macro)
127+
self.compiler.undefine_macro(macro)
128128

129-
self.build_libraries (self.libraries)
129+
self.build_libraries(self.libraries)
130130

131131
# run()
132132

@@ -141,16 +141,16 @@ def check_library_list (self, libraries):
141141
# Yechh, blecch, ackk: this is ripped straight out of build_ext.py,
142142
# with only names changed to protect the innocent!
143143

144-
if type (libraries) is not ListType:
144+
if type(libraries) is not ListType:
145145
raise DistutilsSetupError, \
146146
"'libraries' option must be a list of tuples"
147147

148148
for lib in libraries:
149-
if type (lib) is not TupleType and len (lib) != 2:
149+
if type(lib) is not TupleType and len(lib) != 2:
150150
raise DistutilsSetupError, \
151151
"each element of 'libraries' must a 2-tuple"
152152

153-
if type (lib[0]) is not StringType:
153+
if type(lib[0]) is not StringType:
154154
raise DistutilsSetupError, \
155155
"first element of each tuple in 'libraries' " + \
156156
"must be a string (the library name)"
@@ -160,7 +160,7 @@ def check_library_list (self, libraries):
160160
"may not contain directory separators") % \
161161
lib[0]
162162

163-
if type (lib[1]) is not DictionaryType:
163+
if type(lib[1]) is not DictionaryType:
164164
raise DistutilsSetupError, \
165165
"second element of each tuple in 'libraries' " + \
166166
"must be a dictionary (build info)"
@@ -178,7 +178,7 @@ def get_library_names (self):
178178

179179
lib_names = []
180180
for (lib_name, build_info) in self.libraries:
181-
lib_names.append (lib_name)
181+
lib_names.append(lib_name)
182182
return lib_names
183183

184184
# get_library_names ()
@@ -189,33 +189,33 @@ def build_libraries (self, libraries):
189189
compiler = self.compiler
190190

191191
for (lib_name, build_info) in libraries:
192-
sources = build_info.get ('sources')
193-
if sources is None or type (sources) not in (ListType, TupleType):
192+
sources = build_info.get('sources')
193+
if sources is None or type(sources) not in (ListType, TupleType):
194194
raise DistutilsSetupError, \
195195
("in 'libraries' option (library '%s'), " +
196196
"'sources' must be present and must be " +
197197
"a list of source filenames") % lib_name
198-
sources = list (sources)
198+
sources = list(sources)
199199

200-
self.announce ("building '%s' library" % lib_name)
200+
self.announce("building '%s' library" % lib_name)
201201

202202
# First, compile the source code to object files in the library
203203
# directory. (This should probably change to putting object
204204
# files in a temporary build directory.)
205-
macros = build_info.get ('macros')
206-
include_dirs = build_info.get ('include_dirs')
207-
objects = self.compiler.compile (sources,
208-
output_dir=self.build_temp,
209-
macros=macros,
210-
include_dirs=include_dirs,
211-
debug=self.debug)
205+
macros = build_info.get('macros')
206+
include_dirs = build_info.get('include_dirs')
207+
objects = self.compiler.compile(sources,
208+
output_dir=self.build_temp,
209+
macros=macros,
210+
include_dirs=include_dirs,
211+
debug=self.debug)
212212

213213
# Now "link" the object files together into a static library.
214214
# (On Unix at least, this isn't really linking -- it just
215215
# builds an archive. Whatever.)
216-
self.compiler.create_static_lib (objects, lib_name,
217-
output_dir=self.build_clib,
218-
debug=self.debug)
216+
self.compiler.create_static_lib(objects, lib_name,
217+
output_dir=self.build_clib,
218+
debug=self.debug)
219219

220220
# for libraries
221221

0 commit comments

Comments
 (0)