mirror of
https://github.com/ceph/ceph
synced 2025-01-02 17:12:31 +00:00
Merge pull request #42575 from tchaikov/wip-venv
*: s/virtualenv/python -m venv/ Reviewed-by: Sebastian Wagner <sewagner@redhat.com>
This commit is contained in:
commit
a17ebc0406
@ -20,7 +20,7 @@ if command -v dpkg >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
elif command -v yum >/dev/null; then
|
||||
for package in ant ditaa doxygen libxslt-devel libxml2-devel graphviz python3-devel python3-pip python3-virtualenv python3-Cython; do
|
||||
for package in ant ditaa doxygen libxslt-devel libxml2-devel graphviz python3-devel python3-pip python3-Cython; do
|
||||
if ! rpm -q --whatprovides $package >/dev/null ; then
|
||||
missing="${missing:+$missing }$package"
|
||||
fi
|
||||
@ -31,7 +31,7 @@ elif command -v yum >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
for command in dot virtualenv doxygen ant ditaa cython; do
|
||||
for command in dot doxygen ant ditaa cython; do
|
||||
if ! command -v "$command" > /dev/null; then
|
||||
# add a space after old values
|
||||
missing="${missing:+$missing }$command"
|
||||
@ -51,8 +51,9 @@ set -e
|
||||
[ -z "$vdir" ] && vdir="$TOPDIR/build-doc/virtualenv"
|
||||
|
||||
if [ ! -e $vdir ]; then
|
||||
virtualenv --python=python3 $vdir
|
||||
python3 -m venv $vdir
|
||||
|
||||
$vdir/bin/pip install --quiet wheel
|
||||
$vdir/bin/pip install --quiet \
|
||||
-r $TOPDIR/admin/doc-requirements.txt \
|
||||
-r $TOPDIR/admin/doc-python-common-requirements.txt
|
||||
|
@ -257,7 +257,6 @@ BuildRequires: python%{python3_pkgversion}-nose
|
||||
BuildRequires: python%{python3_pkgversion}-pecan
|
||||
BuildRequires: python%{python3_pkgversion}-requests
|
||||
BuildRequires: python%{python3_pkgversion}-dateutil
|
||||
BuildRequires: python%{python3_pkgversion}-virtualenv
|
||||
BuildRequires: python%{python3_pkgversion}-coverage
|
||||
BuildRequires: python%{python3_pkgversion}-pyOpenSSL
|
||||
BuildRequires: socat
|
||||
|
2
debian/control
vendored
2
debian/control
vendored
@ -97,6 +97,7 @@ Build-Depends: automake,
|
||||
python3-scipy <pkg.ceph.check>,
|
||||
python3-setuptools,
|
||||
python3-sphinx,
|
||||
python3-venv,
|
||||
python3-werkzeug <pkg.ceph.check>,
|
||||
python3-yaml,
|
||||
ragel <pkg.ceph.crimson>,
|
||||
@ -105,7 +106,6 @@ Build-Depends: automake,
|
||||
uuid-dev <pkg.ceph.check>,
|
||||
uuid-runtime,
|
||||
valgrind,
|
||||
virtualenv,
|
||||
xfslibs-dev,
|
||||
xfsprogs <pkg.ceph.check>,
|
||||
xmlstarlet <pkg.ceph.check>,
|
||||
|
@ -1138,7 +1138,7 @@ Unit tests based on tox
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
We included a ``tox`` configuration file that will run the unit tests under
|
||||
Python 2 or 3, as well as linting tools to guarantee the uniformity of code.
|
||||
Python 3, as well as linting tools to guarantee the uniformity of code.
|
||||
|
||||
You need to install ``tox`` and ``coverage`` before running it. To install the
|
||||
packages in your system, either install it via your operating system's package
|
||||
@ -1153,9 +1153,6 @@ Alternatively, you can use Python's native package installation method::
|
||||
To run the tests, run ``src/script/run_tox.sh`` in the dashboard directory (where
|
||||
``tox.ini`` is located)::
|
||||
|
||||
## Run Python 2+3 tests+lint commands:
|
||||
$ ../../../script/run_tox.sh --tox-env py27,py3,lint,check
|
||||
|
||||
## Run Python 3 tests+lint commands:
|
||||
$ ../../../script/run_tox.sh --tox-env py3,lint,check
|
||||
|
||||
|
@ -145,7 +145,6 @@ environments and run options::
|
||||
$ tox -e py3,lint,check
|
||||
|
||||
## To run it as Jenkins would:
|
||||
$ ../../../script/run_tox.sh --tox-env py27,py3,lint,check
|
||||
$ ../../../script/run_tox.sh --tox-env py3,lint,check
|
||||
|
||||
Manager core unit tests
|
||||
|
@ -52,7 +52,7 @@ Options
|
||||
|
||||
.. code:: bash
|
||||
|
||||
[build]$ virtualenv -p python3 venv && source venv/bin/activate && pip3 install cmd2
|
||||
[build]$ python3 -m venv venv && source venv/bin/activate && pip3 install cmd2
|
||||
[build]$ source vstart_environment.sh && source venv/bin/activate && python3 ../src/tools/cephfs/cephfs-shell
|
||||
|
||||
Commands
|
||||
|
@ -270,10 +270,10 @@ the following packages are required:
|
||||
<table cellpadding="10"><colgroup><col width="30%"><col width="30%"><col width="30%"></colgroup><tbody valign="top"><tr><td><h3>Debian/Ubuntu</h3>
|
||||
|
||||
- gcc
|
||||
- python-dev
|
||||
- python-pip
|
||||
- python-virtualenv
|
||||
- python-sphinx
|
||||
- python3-dev
|
||||
- python3-pip
|
||||
- python3-sphinx
|
||||
- pytnon3-venv
|
||||
- libxml2-dev
|
||||
- libxslt1-dev
|
||||
- doxygen
|
||||
@ -288,7 +288,6 @@ the following packages are required:
|
||||
- gcc
|
||||
- python-devel
|
||||
- python-pip
|
||||
- python-virtualenv
|
||||
- python-docutils
|
||||
- python-jinja2
|
||||
- python-pygments
|
||||
@ -307,7 +306,6 @@ the following packages are required:
|
||||
- gcc
|
||||
- python-devel
|
||||
- python-pip
|
||||
- python-virtualenv
|
||||
- python-docutils
|
||||
- python-jinja2
|
||||
- python-pygments
|
||||
@ -328,14 +326,14 @@ distributions, execute the following:
|
||||
|
||||
.. prompt:: bash $
|
||||
|
||||
sudo apt-get install gcc python-dev python-pip python-virtualenv libxml2-dev libxslt-dev doxygen graphviz ant ditaa
|
||||
sudo apt-get install gcc python-dev python-pip libxml2-dev libxslt-dev doxygen graphviz ant ditaa
|
||||
sudo apt-get install python-sphinx
|
||||
|
||||
For Fedora distributions, execute the following:
|
||||
|
||||
.. prompt:: bash $
|
||||
|
||||
sudo yum install gcc python-devel python-pip python-virtualenv libxml2-devel libxslt-devel doxygen graphviz ant
|
||||
sudo yum install gcc python-devel python-pip libxml2-devel libxslt-devel doxygen graphviz ant
|
||||
sudo pip install html2text
|
||||
sudo yum install python-jinja2 python-pygments python-docutils python-sphinx
|
||||
sudo yum install jericho-html ditaa
|
||||
@ -353,7 +351,7 @@ For CentOS/RHEL distributions, execute the following:
|
||||
|
||||
.. prompt:: bash $
|
||||
|
||||
sudo yum install gcc python-devel python-pip python-virtualenv libxml2-devel libxslt-devel doxygen graphviz ant
|
||||
sudo yum install gcc python-devel python-pip libxml2-devel libxslt-devel doxygen graphviz ant
|
||||
sudo pip install html2text
|
||||
|
||||
For CentOS/RHEL distributions, the remaining python packages are not available
|
||||
|
@ -2,8 +2,7 @@ git
|
||||
gcc
|
||||
python3-dev
|
||||
python3-pip
|
||||
python3-virtualenv
|
||||
virtualenv
|
||||
python3-venv
|
||||
doxygen
|
||||
ditaa
|
||||
libxml2-dev
|
||||
|
@ -261,7 +261,6 @@ if [ x$(uname)x = xFreeBSDx ]; then
|
||||
devel/libtool \
|
||||
devel/google-perftools \
|
||||
lang/cython \
|
||||
devel/py-virtualenv \
|
||||
databases/leveldb \
|
||||
net/openldap24-client \
|
||||
archivers/snappy \
|
||||
@ -431,7 +430,7 @@ function activate_virtualenv() {
|
||||
local env_dir=$top_srcdir/install-deps-python3
|
||||
|
||||
if ! test -d $env_dir ; then
|
||||
virtualenv --python=python3 ${env_dir}
|
||||
python3 -m venv ${env_dir}
|
||||
. $env_dir/bin/activate
|
||||
if ! populate_wheelhouse install ; then
|
||||
rm -rf $env_dir
|
||||
|
@ -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):
|
||||
|
@ -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',
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)),
|
||||
|
@ -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()
|
||||
|
@ -41,7 +41,7 @@ setup_teuthology() {
|
||||
TEMP_DIR=`mktemp -d`
|
||||
cd $TEMP_DIR
|
||||
|
||||
virtualenv --python=${TEUTHOLOGY_PYTHON_BIN:-/usr/bin/python3} venv
|
||||
${TEUTHOLOGY_PYTHON_BIN:-/usr/bin/python3} -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install 'setuptools >= 12'
|
||||
pip install git+https://github.com/ceph/teuthology#egg=teuthology[test]
|
||||
@ -56,7 +56,7 @@ setup_coverage() {
|
||||
# In CI environment we cannot install coverage in system, so we install it in a dedicated venv
|
||||
# so only coverage is available when adding this path.
|
||||
cd $TEMP_DIR
|
||||
virtualenv --python=/usr/bin/python3 coverage-venv
|
||||
/usr/bin/python3 -m venv coverage-venv
|
||||
source coverage-venv/bin/activate
|
||||
cd $CURR_DIR
|
||||
pip install coverage==4.5.2
|
||||
|
@ -4,7 +4,7 @@
|
||||
"""To run this script first install the dependencies
|
||||
|
||||
|
||||
virtualenv v
|
||||
python3 -m venv v
|
||||
source v/bin/activate
|
||||
pip install githubpy GitPython requests
|
||||
|
||||
|
@ -25,13 +25,13 @@ options:
|
||||
|
||||
example:
|
||||
|
||||
following command will run tox with envlist of "py27,py3" using the "tox.ini" in current directory.
|
||||
following command will run tox with envlist of "py3,mypy" using the "tox.ini" in current directory.
|
||||
|
||||
$prog_name --tox-envs py27,py3
|
||||
$prog_name --tox-envs py3,mypy
|
||||
|
||||
following command will run tox with envlist of "py27" using "/ceph/src/python-common/tox.ini"
|
||||
following command will run tox with envlist of "py3" using "/ceph/src/python-common/tox.ini"
|
||||
|
||||
$prog_name --tox-envs py27 --tox-path /ceph/src/python-common
|
||||
$prog_name --tox-envs py3 --tox-path /ceph/src/python-common
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -116,17 +116,7 @@ function main() {
|
||||
echo "$PWD already exists, but it's not a virtualenv. test_name empty?"
|
||||
exit 1
|
||||
fi
|
||||
# try to use the prefered python for creating the virtual env for
|
||||
# bootstrapping tox.
|
||||
case $tox_envs in
|
||||
py3*)
|
||||
virtualenv_python=python3;;
|
||||
py2*)
|
||||
virtualenv_python=python2;;
|
||||
*)
|
||||
virtualenv_python=python3;;
|
||||
esac
|
||||
$source_dir/src/tools/setup-virtualenv.sh --python=${virtualenv_python} ${venv_path}
|
||||
$source_dir/src/tools/setup-virtualenv.sh ${venv_path}
|
||||
fi
|
||||
source ${venv_path}/bin/activate
|
||||
pip install tox
|
||||
|
@ -2,7 +2,7 @@
|
||||
set -e
|
||||
|
||||
if [ -f /etc/debian_version ]; then
|
||||
for package in python3-pip python3-virtualenv python3-dev python3-xmltodict python3-pika libevent-dev libxml2-dev libxslt-dev zlib1g-dev; do
|
||||
for package in python3-pip python3-dev python3-xmltodict python3-pika libevent-dev libxml2-dev libxslt-dev zlib1g-dev; do
|
||||
if [ "$(dpkg --status -- $package 2>/dev/null|sed -n 's/^Status: //p')" != "install ok installed" ]; then
|
||||
# add a space after old values
|
||||
missing="${missing:+$missing }$package"
|
||||
@ -14,7 +14,7 @@ if [ -f /etc/debian_version ]; then
|
||||
fi
|
||||
fi
|
||||
if [ -f /etc/redhat-release ]; then
|
||||
for package in python3-pip python3-virtualenv python3-devel python3-xmltodict python3-pika libevent-devel libxml2-devel libxslt-devel zlib-devel; do
|
||||
for package in python3-pip python3-devel python3-xmltodict python3-pika libevent-devel libxml2-devel libxslt-devel zlib-devel; do
|
||||
if [ "$(rpm -qa $package 2>/dev/null)" == "" ]; then
|
||||
missing="${missing:+$missing }$package"
|
||||
fi
|
||||
@ -25,7 +25,7 @@ if [ -f /etc/redhat-release ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
virtualenv -p python3 --system-site-packages virtualenv
|
||||
python3 -m venv --system-site-packages virtualenv
|
||||
|
||||
# avoid pip bugs
|
||||
./virtualenv/bin/pip install --upgrade pip
|
||||
|
@ -1,11 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if ! command -v virtualenv >/dev/null; then
|
||||
echo "$0: virtualenv not installed, skipping python-using tests." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SRCDIR="$(dirname "$0")"
|
||||
|
||||
# build directory, if different, can be passed as an argument;
|
||||
@ -30,7 +25,7 @@ if [ ! -e "$CRAM_BIN" ]; then
|
||||
# patched cram to support that. See upstream ticket at
|
||||
# https://bitbucket.org/brodie/cram/issue/9/allow-read-only-directories-for-t
|
||||
# -- tv@inktank.com
|
||||
virtualenv --python python3 "$VENV" && $VENV/bin/pip --log "$VENV"/log.txt \
|
||||
python3 -m venv "$VENV" && $VENV/bin/pip --log "$VENV"/log.txt \
|
||||
install git+https://github.com/ceph/cram.git@0.7-error-dir#egg=cram
|
||||
fi
|
||||
|
||||
|
@ -40,11 +40,11 @@ TEMP=$($GETOPT --options "h" --long "help,python:" --name "$SCRIPTNAME" -- "$@")
|
||||
test $? != 0 && usage
|
||||
eval set -- "$TEMP"
|
||||
|
||||
PYTHON_OPTION=""
|
||||
PYTHON=python3
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h|--help) usage ;; # does not return
|
||||
--python) PYTHON_OPTION="--python=$2" ; shift ; shift ;;
|
||||
--python) PYTHON="$2" ; shift ; shift ;;
|
||||
--) shift ; break ;;
|
||||
*) echo "Internal error" ; exit 1 ;;
|
||||
esac
|
||||
@ -57,7 +57,7 @@ if [ -z "$DIR" ] ; then
|
||||
fi
|
||||
rm -fr $DIR
|
||||
mkdir -p $DIR
|
||||
virtualenv $PYTHON_OPTION $DIR
|
||||
$PYTHON -m venv $DIR
|
||||
. $DIR/bin/activate
|
||||
|
||||
if pip --help | grep -q disable-pip-version-check; then
|
||||
|
Loading…
Reference in New Issue
Block a user