mirror of
https://github.com/python/cpython.git
synced 2025-10-24 15:36:26 +00:00
Issue #17177: update checkpyc to stop using imp
This commit is contained in:
parent
ca5ff3a069
commit
53e600c24a
1 changed files with 4 additions and 4 deletions
|
|
@ -5,11 +5,11 @@
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from stat import ST_MTIME
|
from stat import ST_MTIME
|
||||||
import imp
|
import importlib.util
|
||||||
|
|
||||||
# PEP 3147 compatibility (PYC Repository Directories)
|
# PEP 3147 compatibility (PYC Repository Directories)
|
||||||
cache_from_source = (imp.cache_from_source if hasattr(imp, 'get_tag') else
|
cache_from_source = (importlib.util.cache_from_source if sys.implementation.cache_tag
|
||||||
lambda path: path + 'c')
|
else lambda path: path + 'c')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -18,7 +18,7 @@ def main():
|
||||||
silent = (sys.argv[1] == '-s')
|
silent = (sys.argv[1] == '-s')
|
||||||
else:
|
else:
|
||||||
verbose = silent = False
|
verbose = silent = False
|
||||||
MAGIC = imp.get_magic()
|
MAGIC = importlib.util.MAGIC_NUMBER
|
||||||
if not silent:
|
if not silent:
|
||||||
print('Using MAGIC word', repr(MAGIC))
|
print('Using MAGIC word', repr(MAGIC))
|
||||||
for dirname in sys.path:
|
for dirname in sys.path:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue