From 0fcbad89ce10f6927d03666e7ea290cf17883114 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Tue, 16 Jun 2015 16:18:03 +0200 Subject: scanner: future-proof cachestore version hashing Python 3 does not write .pyc files like Python 2 used to do but instead put's them in a __pycache__ directory. Simply compute the version hash using the .py files instead. --- giscanner/cachestore.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/giscanner/cachestore.py b/giscanner/cachestore.py index c588792d..d6120706 100644 --- a/giscanner/cachestore.py +++ b/giscanner/cachestore.py @@ -37,8 +37,7 @@ _CACHE_VERSION_FILENAME = '.cache-version' def _get_versionhash(): toplevel = os.path.dirname(giscanner.__file__) - # Use pyc instead of py to avoid extra IO - sources = glob.glob(os.path.join(toplevel, '*.pyc')) + sources = glob.glob(os.path.join(toplevel, '*.py')) sources.append(sys.argv[0]) # Using mtimes is a bit (5x) faster than hashing the file contents mtimes = (str(os.stat(source).st_mtime) for source in sources) -- cgit v1.2.1