diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-06-04 20:39:34 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-06-04 20:39:34 (GMT) |
commit | d003abccc73b3101efbfd7ee27c72ead2990bd7b (patch) | |
tree | 005fb37086090215280663be9ccc2aa4ca4f9852 /Lib/distutils/command/bdist_packager.py | |
parent | d53f6e43e76a2ddba989ddd59d7be57c4f84d10d (diff) | |
download | cpython-d003abccc73b3101efbfd7ee27c72ead2990bd7b.zip cpython-d003abccc73b3101efbfd7ee27c72ead2990bd7b.tar.gz cpython-d003abccc73b3101efbfd7ee27c72ead2990bd7b.tar.bz2 |
get_script() implicitly returned None and also had explicit returns.
Make all returns explicit and rearrange logic to avoid extra
indentation.
Diffstat (limited to 'Lib/distutils/command/bdist_packager.py')
-rw-r--r-- | Lib/distutils/command/bdist_packager.py | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/Lib/distutils/command/bdist_packager.py b/Lib/distutils/command/bdist_packager.py index dde113c..d57a594 100644 --- a/Lib/distutils/command/bdist_packager.py +++ b/Lib/distutils/command/bdist_packager.py @@ -3,8 +3,8 @@ Modified from bdist_dumb by Mark W. Alexander <slash@dotnetslash.net> 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" @@ -114,34 +114,33 @@ class bdist_packager (Command): return self.name + '-' + self.version + '-' + \ self.revision + '-' + py_ver - def get_script (self,attr): + def get_script (self, attr): # accept a script as a string ("line\012line\012..."), # a filename, or a list # XXX We could probably get away with copy_file, but I'm # guessing this will be more flexible later on.... - val = getattr(self,attr) - ret=None - if val: - try: - os.stat(val) - # script is a file - ret=[] - f=open(val) - ret=string.split(f.read(),"\012"); - f.close() - #return ret - except: - if type(val)==type(""): - # script is a string - ret = string.split(val,"\012") - elif type(val)==type([]): - # script is a list - ret = val - else: - raise RuntimeError, \ - "cannot figure out what to do with 'request' option (%s)" \ - % val - return ret + val = getattr(self, attr) + if val is None: + return None + try: + os.stat(val) + # script is a file + ret = [] + f = open(val) + ret = string.split(f.read(), "\012"); + f.close() + except: + if type(val) == type(""): + # script is a string + ret = string.split(val, "\012") + elif type(val) == type([]): + # script is a list + ret = val + else: + raise RuntimeError, \ + "cannot figure out what to do with 'request' option (%s)" \ + % val + return ret def initialize_options (self): |