From 808bb3d649252dfead8932ee87d51ebaffd52608 Mon Sep 17 00:00:00 2001 From: Ben Bariteau Date: Mon, 8 Mar 2021 16:02:31 -0800 Subject: [PATCH] fix pypy matching for change in pypy3 the subdir in lib-python is now major version (i.e. 3) instead of major.minor (e.g. 2.7) --- virtualenv_tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virtualenv_tools.py b/virtualenv_tools.py index cb5c75b..47218e9 100644 --- a/virtualenv_tools.py +++ b/virtualenv_tools.py @@ -29,7 +29,7 @@ 'activate.xsh', ] _pybin_match = re.compile(r'^python\d+\.\d+$') -_pypy_match = re.compile(r'^\d+.\d+$') +_pypy_match = re.compile(r'^\d+(.\d+)?$') _activation_path_re = re.compile( r'^(?:set -gx |setenv |)VIRTUAL_ENV[ =][\'"](.*?)[\'"]\s*$', ) @@ -294,7 +294,7 @@ def _get_original_state(path): raise NotAVirtualenvError( path, 'directory', - os.path.join(base_lib_dir, '#.#' if is_pypy else 'python#.#'), + os.path.join(base_lib_dir, '#(.#)?' if is_pypy else 'python#.#'), ) lib_dir, = lib_dirs