From 865e9fbd73ec14b539d4faa8ab47ae199aa95c86 Mon Sep 17 00:00:00 2001 From: vesivaku <117249946+vesivaku@users.noreply.github.com> Date: Wed, 18 Oct 2023 09:40:30 +0530 Subject: [PATCH 1/2] Fixed get python versioninfo\n\nIf py_ver is None, load_virtualenv picks only major and minor values and misses out on micro. It errors out determine_sitedir() for a non-existent dir. Fix should certainly solve that. --- circus/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circus/util.py b/circus/util.py index c9093758..96403fb7 100644 --- a/circus/util.py +++ b/circus/util.py @@ -868,7 +868,7 @@ def load_virtualenv(watcher, py_ver=None): raise ValueError('copy_env must be True to to use virtualenv') if not py_ver: - py_ver = "%s.%s" % sys.version_info[:2] + py_ver = "%s.%s.%s" % sys.version_info[:3] def determine_sitedir(): try_dirs = ['python', 'pypy'] From 15182fc4212529688e7b7537b898350099078ce5 Mon Sep 17 00:00:00 2001 From: venkats278 Date: Sat, 21 Oct 2023 22:52:50 +0530 Subject: [PATCH 2/2] Reverting change for issue #1212 and added condition to trim py_ver in case user supplies complete version --- circus/util.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/circus/util.py b/circus/util.py index 96403fb7..892e983b 100644 --- a/circus/util.py +++ b/circus/util.py @@ -868,7 +868,13 @@ def load_virtualenv(watcher, py_ver=None): raise ValueError('copy_env must be True to to use virtualenv') if not py_ver: - py_ver = "%s.%s.%s" % sys.version_info[:3] + py_ver = "%s.%s" % sys.version_info[:2] + else: + # This condition modifies the user supplied py_ver variable and + # retains only the python version (major.minor) and omits micro version + # if present. For ex. if user sets py_ver=3.7.13, this conditions + # trims it to 3.7. + py_ver = ".".join(py_ver.split(".")[:2]) def determine_sitedir(): try_dirs = ['python', 'pypy']