Add early return in fix_script
No behavior change, just making this function easier to refactor.
@@ -96,7 +96,9 @@ def fix_script(path):
Return True if file was changed.
"""
# XXX RECORD hashes will need to be updated
- if os.path.isfile(path):
+ if not os.path.isfile(path):
+ return None
+
with open(path, 'rb') as script:
firstline = script.readline()
if not firstline.startswith(b'#!python'):
@@ -108,7 +110,6 @@ def fix_script(path):
script.write(firstline)
script.write(rest)
return True
- return None
def wheel_root_is_purelib(metadata):
