Skip to content

Commit

Permalink
Remove .pyc files if .py is present
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Oct 21, 2021
1 parent 3c0b600 commit cbcdd29
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions reprozip/reprozip/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def builtin(input_files, **kwargs):

def python(files, input_files, **kwargs):
add = []
remove = set()
for path, fi in files.items():
# Include .py files instead of .pyc
if path.suffix == '.pyc':
Expand All @@ -50,9 +51,13 @@ def python(files, input_files, **kwargs):
if pyfile not in files:
logger.info("Adding %s", pyfile)
add.append(File(pyfile))
logger.info("Removing %s", path)
remove.add(path)

for fi in add:
files[fi.path] = fi
for path in remove:
files.pop(path, None)

for i in range(len(input_files)):
lst = []
Expand Down

0 comments on commit cbcdd29

Please sign in to comment.