Skip to content

Commit d68de02

Browse files
author
Matthias Koeppe
committed
build/sage_bootstrap/package.py: Fixups
1 parent 134ac92 commit d68de02

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

build/sage_bootstrap/package.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,15 @@ def line_count_file(self, filename):
380380
381381
integer; 0 if the file cannot be read, 1 if it is a symlink
382382
"""
383-
filename = os.path.join(self.path, filename)
384-
if os.path.islink(filename):
383+
path = os.path.join(self.path, filename)
384+
if os.path.islink(path):
385385
return 1
386-
if os.path.isdir(filename):
386+
if os.path.isdir(path):
387387
return sum(self.line_count_file(os.path.join(filename, entry))
388-
for entry in os.listdir(filename))
388+
for entry in os.listdir(path))
389389
try:
390-
return len(list(open(filename, "rb")))
390+
with open(path, "rb") as f:
391+
return len(list(f))
391392
except OSError:
392393
return 0
393394

0 commit comments

Comments
 (0)