]> granicus.if.org Git - python/commitdiff
get_script() implicitly returned None and also had explicit returns.
authorJeremy Hylton <jeremy@alum.mit.edu>
Tue, 4 Jun 2002 20:39:34 +0000 (20:39 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Tue, 4 Jun 2002 20:39:34 +0000 (20:39 +0000)
Make all returns explicit and rearrange logic to avoid extra
indentation.

Lib/distutils/command/bdist_packager.py

index dde113ce4d7c7c6b6c3eb12aab1fbb4a4fc07717..d57a59403be240265bb98e41fab5cfd9fb450d34 100644 (file)
@@ -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):