diff --git a/check-pyc-and-pyo-timestamps.py b/check-pyc-and-pyo-timestamps.py index 76a3421..262a985 100644 --- a/check-pyc-and-pyo-timestamps.py +++ b/check-pyc-and-pyo-timestamps.py @@ -1,6 +1,6 @@ """Checks if all *.pyc and *.pyo files have later mtime than their *.py files.""" -import imp +import importlib.util import os import sys @@ -37,16 +37,18 @@ not_compiled = [ ] failed = 0 + def bytecode_expected(source): for f in not_compiled: if source.endswith(f): return False return True + compiled = filter(lambda f: bytecode_expected(f), sys.argv[1:]) for f in compiled: # check both pyo and pyc - to_check = map(lambda b: imp.cache_from_source(f, b), (True, False)) + to_check = map(lambda b: importlib.util.cache_from_source(f, b), (True, False)) f_mtime = os.path.getmtime(f) for c in to_check: c_mtime = os.path.getmtime(c)