From 83aecae842e55939f298cc6fffdfecb30fa8efb0 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 31 Jul 2021 21:06:23 +0800 Subject: [PATCH] qa/tasks: s/virtualenv/python3 -m venv/ so we don't need to use virtualenv python package for creating a virtualenv, the "venv" module in Python3 would suffice. see also https://docs.python.org/3/library/venv.html Signed-off-by: Kefu Chai (cherry picked from commit f0ed7a188facb9bb5098c2452fb4d3d134d2c436) --- qa/tasks/barbican.py | 7 +++++-- qa/tasks/cram.py | 2 +- qa/tasks/pykmip.py | 2 +- qa/tasks/s3a_hadoop.py | 4 +++- qa/tasks/tox.py | 14 +++++++------- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/qa/tasks/barbican.py b/qa/tasks/barbican.py index cfa85e1ddd6ea..4d1354903df82 100644 --- a/qa/tasks/barbican.py +++ b/qa/tasks/barbican.py @@ -96,8 +96,11 @@ def setup_venv(ctx, config): assert isinstance(config, dict) log.info('Setting up virtualenv for barbican...') for (client, _) in config.items(): - run_in_barbican_dir(ctx, client, ['virtualenv', '.barbicanenv']) - run_in_barbican_venv(ctx, client, ['pip', 'install', 'pytz', '-e', get_barbican_dir(ctx)]) + run_in_barbican_dir(ctx, client, + ['python3', '-m', 'venv', '.barbicanenv']) + run_in_barbican_venv(ctx, client, + ['pip', 'install', 'pytz', + '-e', get_barbican_dir(ctx)]) yield def assign_ports(ctx, config, initial_port): diff --git a/qa/tasks/cram.py b/qa/tasks/cram.py index fd17f4832b71a..a445a146fe2e0 100644 --- a/qa/tasks/cram.py +++ b/qa/tasks/cram.py @@ -71,7 +71,7 @@ def task(ctx, config): args=[ 'mkdir', '--', client_dir, run.Raw('&&'), - 'virtualenv', '{tdir}/virtualenv'.format(tdir=testdir), + 'python3', '-m', 'venv', '{tdir}/virtualenv'.format(tdir=testdir), run.Raw('&&'), '{tdir}/virtualenv/bin/pip'.format(tdir=testdir), 'install', 'cram==0.6', diff --git a/qa/tasks/pykmip.py b/qa/tasks/pykmip.py index d0b72f69ecc0a..3491babc517cc 100644 --- a/qa/tasks/pykmip.py +++ b/qa/tasks/pykmip.py @@ -147,7 +147,7 @@ def setup_venv(ctx, config): assert isinstance(config, dict) log.info('Setting up virtualenv for pykmip...') for (client, _) in config.items(): - run_in_pykmip_dir(ctx, client, ['virtualenv', '.pykmipenv']) + run_in_pykmip_dir(ctx, client, ['python3', '-m', 'venv', '.pykmipenv']) run_in_pykmip_venv(ctx, client, ['pip', 'install', 'pytz', '-e', get_pykmip_dir(ctx)]) yield diff --git a/qa/tasks/s3a_hadoop.py b/qa/tasks/s3a_hadoop.py index f06c9acfe9d59..cfccf65e3b9e5 100644 --- a/qa/tasks/s3a_hadoop.py +++ b/qa/tasks/s3a_hadoop.py @@ -144,7 +144,9 @@ def setup_user_bucket(client, dns_name, access_key, secret_key, bucket_name, tes ) client.run( args=[ - 'virtualenv', + 'python3', + '-m', + 'venv', '{testdir}/venv'.format(testdir=testdir), run.Raw('&&'), run.Raw('{testdir}/venv/bin/pip'.format(testdir=testdir)), diff --git a/qa/tasks/tox.py b/qa/tasks/tox.py index 36c226d0b2e6e..61c5b7411b45d 100644 --- a/qa/tasks/tox.py +++ b/qa/tasks/tox.py @@ -29,14 +29,14 @@ def task(ctx, config): log.info('Deploying tox from pip...') for (client, _) in config.items(): # yup, we have to deploy tox first. The packaged one, available - # on Sepia's Ubuntu machines, is outdated for Keystone/Tempest. + # on Sepia's Ubuntu machines, is outdated for Keystone/Tempest. tvdir = get_toxvenv_dir(ctx) - ctx.cluster.only(client).run(args=[ 'virtualenv', '-p', 'python3', tvdir ]) - ctx.cluster.only(client).run(args= - [ 'source', '{tvdir}/bin/activate'.format(tvdir=tvdir), - run.Raw('&&'), - 'pip', 'install', 'tox==3.15.0' - ]) + ctx.cluster.only(client).run(args=['python3', '-m', 'venv', tvdir]) + ctx.cluster.only(client).run(args=[ + 'source', '{tvdir}/bin/activate'.format(tvdir=tvdir), + run.Raw('&&'), + 'pip', 'install', 'tox==3.15.0' + ]) # export the path Keystone and Tempest ctx.tox = argparse.Namespace() -- 2.39.5