Commit d003abcc authored by Jeremy Hylton's avatar Jeremy Hylton

get_script() implicitly returned None and also had explicit returns.

Make all returns explicit and rearrange logic to avoid extra
indentation.
parent d53f6e43
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
Modified from bdist_dumb by Mark W. Alexander <slash@dotnetslash.net> Modified from bdist_dumb by Mark W. Alexander <slash@dotnetslash.net>
Implements the Distutils 'bdist_packager' abstract command Implements the Distutils 'bdist_packager' abstract command
to be subclassed by binary package creation commands.""" to be subclassed by binary package creation commands.
"""
__revision__ = "$Id: bdist_packager.py,v 0.1 2001/04/4 mwa" __revision__ = "$Id: bdist_packager.py,v 0.1 2001/04/4 mwa"
...@@ -114,34 +114,33 @@ class bdist_packager (Command): ...@@ -114,34 +114,33 @@ class bdist_packager (Command):
return self.name + '-' + self.version + '-' + \ return self.name + '-' + self.version + '-' + \
self.revision + '-' + py_ver self.revision + '-' + py_ver
def get_script (self,attr): def get_script (self, attr):
# accept a script as a string ("line\012line\012..."), # accept a script as a string ("line\012line\012..."),
# a filename, or a list # a filename, or a list
# XXX We could probably get away with copy_file, but I'm # XXX We could probably get away with copy_file, but I'm
# guessing this will be more flexible later on.... # guessing this will be more flexible later on....
val = getattr(self,attr) val = getattr(self, attr)
ret=None if val is None:
if val: return None
try: try:
os.stat(val) os.stat(val)
# script is a file # script is a file
ret=[] ret = []
f=open(val) f = open(val)
ret=string.split(f.read(),"\012"); ret = string.split(f.read(), "\012");
f.close() f.close()
#return ret except:
except: if type(val) == type(""):
if type(val)==type(""): # script is a string
# script is a string ret = string.split(val, "\012")
ret = string.split(val,"\012") elif type(val) == type([]):
elif type(val)==type([]): # script is a list
# script is a list ret = val
ret = val else:
else: raise RuntimeError, \
raise RuntimeError, \ "cannot figure out what to do with 'request' option (%s)" \
"cannot figure out what to do with 'request' option (%s)" \ % val
% val return ret
return ret
def initialize_options (self): def initialize_options (self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment