diff --git a/admin/build-doc b/admin/build-doc index d8b82b32c97..267d292dd55 100755 --- a/admin/build-doc +++ b/admin/build-doc @@ -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 diff --git a/ceph.spec.in b/ceph.spec.in index b6b3b75384f..1503b3038bc 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -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 diff --git a/debian/control b/debian/control index a3b6d524e41..af74fbd5f42 100644 --- a/debian/control +++ b/debian/control @@ -97,6 +97,7 @@ Build-Depends: automake, python3-scipy , python3-setuptools, python3-sphinx, + python3-venv, python3-werkzeug , python3-yaml, ragel , @@ -105,7 +106,6 @@ Build-Depends: automake, uuid-dev , uuid-runtime, valgrind, - virtualenv, xfslibs-dev, xfsprogs , xmlstarlet , diff --git a/doc/dev/developer_guide/dash-devel.rst b/doc/dev/developer_guide/dash-devel.rst index 64a28cb4776..9e99c019f25 100644 --- a/doc/dev/developer_guide/dash-devel.rst +++ b/doc/dev/developer_guide/dash-devel.rst @@ -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 diff --git a/doc/dev/developer_guide/tests-unit-tests.rst b/doc/dev/developer_guide/tests-unit-tests.rst index de9d6de6fcd..21db9bf9f4c 100644 --- a/doc/dev/developer_guide/tests-unit-tests.rst +++ b/doc/dev/developer_guide/tests-unit-tests.rst @@ -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 diff --git a/doc/man/8/cephfs-shell.rst b/doc/man/8/cephfs-shell.rst index 62ebf60f205..b8a3699f90c 100644 --- a/doc/man/8/cephfs-shell.rst +++ b/doc/man/8/cephfs-shell.rst @@ -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 diff --git a/doc/start/documenting-ceph.rst b/doc/start/documenting-ceph.rst index 695388f7405..622494ba5e4 100644 --- a/doc/start/documenting-ceph.rst +++ b/doc/start/documenting-ceph.rst @@ -270,10 +270,10 @@ the following packages are required:

Debian/Ubuntu

- 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 diff --git a/doc_deps.deb.txt b/doc_deps.deb.txt index 4bfff0f205b..e2eb80a2f40 100644 --- a/doc_deps.deb.txt +++ b/doc_deps.deb.txt @@ -2,8 +2,7 @@ git gcc python3-dev python3-pip -python3-virtualenv -virtualenv +python3-venv doxygen ditaa libxml2-dev diff --git a/install-deps.sh b/install-deps.sh index cc47663328b..c5dd7df5a94 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -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 diff --git a/qa/tasks/barbican.py b/qa/tasks/barbican.py index cfa85e1ddd6..4d1354903df 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 fd17f4832b7..a445a146fe2 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 d0b72f69ecc..3491babc517 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 f06c9acfe9d..cfccf65e3b9 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 36c226d0b2e..61c5b7411b4 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() diff --git a/src/pybind/mgr/dashboard/run-backend-api-tests.sh b/src/pybind/mgr/dashboard/run-backend-api-tests.sh index 3c1d2e8b8b4..46ce4ce951e 100755 --- a/src/pybind/mgr/dashboard/run-backend-api-tests.sh +++ b/src/pybind/mgr/dashboard/run-backend-api-tests.sh @@ -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 diff --git a/src/script/ceph-release-notes b/src/script/ceph-release-notes index f804fc136f2..8b0b4857822 100755 --- a/src/script/ceph-release-notes +++ b/src/script/ceph-release-notes @@ -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 diff --git a/src/script/run_tox.sh b/src/script/run_tox.sh index 2dab5f1d987..9d45d8b9246 100755 --- a/src/script/run_tox.sh +++ b/src/script/run_tox.sh @@ -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 diff --git a/src/test/rgw/bucket_notification/bootstrap b/src/test/rgw/bucket_notification/bootstrap index 3eafe297c21..4d4a5a74878 100755 --- a/src/test/rgw/bucket_notification/bootstrap +++ b/src/test/rgw/bucket_notification/bootstrap @@ -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 diff --git a/src/test/run-cli-tests b/src/test/run-cli-tests index 0e94751ceaa..9572c68342f 100755 --- a/src/test/run-cli-tests +++ b/src/test/run-cli-tests @@ -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 diff --git a/src/tools/setup-virtualenv.sh b/src/tools/setup-virtualenv.sh index af945e2c5a4..e9a1c6ddfbe 100755 --- a/src/tools/setup-virtualenv.sh +++ b/src/tools/setup-virtualenv.sh @@ -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