Cleanup py27 support

This repo is now testing only with Python 3, so let's make
a few cleanups:
- Remove python 2.7 stanza from setup.py
- Add requires on python >= 3.6 to setup.cfg so that pypi and pip
  know about the requirement
- Remove obsolete sections from setup.cfg
- Update classifiers
- Switch to using sphinx-build
- Cleanup doc/source/conf.py to remove now obsolete content.
- Use newer openstackdocstheme version
- Remove install_command from tox.ini, the default is fine
- Remove old python compatiblity test code

Change-Id: If7296703fc4848a16dd10d904ba3f49f19054546
This commit is contained in:
Andreas Jaeger 2020-04-13 11:19:29 +02:00 committed by Lucian Petrut
parent 44a78440e3
commit bb4934a240
9 changed files with 12 additions and 64 deletions

View File

@ -64,13 +64,10 @@ pygments_style = 'sphinx'
# Sphinx are currently 'default' and 'sphinxdoc'.
# html_theme_path = ["."]
html_theme = 'openstackdocs'
html_static_path = ['_static']
# Output file base name for HTML help builder.
htmlhelp_basename = '%sdoc' % project
html_last_updated_fmt = '%Y-%m-%d %H:%M'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto/manual]).

View File

@ -26,7 +26,7 @@ mox3==0.20.0
msgpack-python==0.4.0
netaddr==0.7.18
netifaces==0.10.4
openstackdocstheme==1.18.1
openstackdocstheme==1.31.2
os-client-config==1.28.0
oslo.concurrency==3.26.0
oslo.config==5.2.0

View File

@ -155,8 +155,7 @@ class PathUtilsTestCase(test_base.OsWinBaseTestCase):
@mock.patch('os.path.isdir')
@mock.patch('os.path.islink')
def _test_check_symlink(self, mock_is_symlink, mock_is_dir,
is_symlink=True, python_version=(2, 7),
is_dir=True):
is_symlink=True, is_dir=True):
fake_path = r'c:\\fake_path'
if is_symlink:
f_attr = 0x400
@ -167,17 +166,8 @@ class PathUtilsTestCase(test_base.OsWinBaseTestCase):
mock_is_symlink.return_value = is_symlink
self._mock_run.return_value = f_attr
with mock.patch('sys.version_info', python_version):
ret_value = self._pathutils.is_symlink(fake_path)
if python_version >= (3, 2):
mock_is_symlink.assert_called_once_with(fake_path)
else:
self._mock_run.assert_called_once_with(
pathutils.kernel32.GetFileAttributesW,
fake_path,
error_ret_vals=[w_const.INVALID_FILE_ATTRIBUTES],
kernel32_lib_func=True)
ret_value = self._pathutils.is_symlink(fake_path)
mock_is_symlink.assert_called_once_with(fake_path)
self.assertEqual(is_symlink, ret_value)
@ -187,9 +177,6 @@ class PathUtilsTestCase(test_base.OsWinBaseTestCase):
def test_is_not_symlink(self):
self._test_check_symlink(is_symlink=False)
def test_is_symlink_python_gt_3_2(self):
self._test_check_symlink(python_version=(3, 3))
def test_create_sym_link(self):
tg_is_dir = False
self._pathutils.create_sym_link(mock.sentinel.path,

View File

@ -15,7 +15,6 @@
import ctypes
import struct
import sys
from eventlet import patcher
from oslo_log import log as logging
@ -34,11 +33,7 @@ kernel32 = w_lib.get_shared_lib_handle(w_lib.KERNEL32)
LOG = logging.getLogger(__name__)
# Avoid using six.moves.queue as we need a non monkey patched class
if sys.version_info > (3, 0):
Queue = patcher.original('queue')
else:
Queue = patcher.original('Queue')
Queue = patcher.original('queue')
WAIT_PIPE_DEFAULT_TIMEOUT = 5 # seconds
WAIT_IO_COMPLETION_TIMEOUT = 2 * units.k

View File

@ -17,7 +17,6 @@ import contextlib
import ctypes
import os
import shutil
import sys
import tempfile
from oslo_log import log as logging
@ -153,17 +152,7 @@ class PathUtils(object):
self.rmtree(path)
def is_symlink(self, path):
if sys.version_info >= (3, 2):
return os.path.islink(path)
file_attr = self._win32_utils.run_and_check_output(
kernel32.GetFileAttributesW,
path,
error_ret_vals=[w_const.INVALID_FILE_ATTRIBUTES],
kernel32_lib_func=True)
return bool(os.path.isdir(path) and (
file_attr & w_const.FILE_ATTRIBUTE_REPARSE_POINT))
return os.path.islink(path)
def create_sym_link(self, link, target, target_is_dir=True):
"""If target_is_dir is True, a junction will be created.

View File

@ -6,6 +6,7 @@ description-file =
author = OpenStack
author-email = openstack-discuss@lists.openstack.org
home-page = http://www.cloudbase.it/
python-requires = >=3.6
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
@ -13,6 +14,8 @@ classifier =
License :: OSI Approved :: Apache Software License
Operating System :: Microsoft :: Windows
Programming Language :: Python
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
@ -25,14 +28,6 @@ packages =
oslo.config.opts =
os_win = os_win.conf:list_opts
[build_sphinx]
source-dir = doc/source
build-dir = doc/build
all_files = 1
[upload_sphinx]
upload-dir = doc/build/html
[compile_catalog]
directory = os_win/locale
domain = os-win

View File

@ -13,17 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr>=2.0.0'],
pbr=True)

View File

@ -13,6 +13,6 @@ oslotest>=3.2.0 # Apache-2.0
stestr>=2.0.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT
openstackdocstheme>=1.18.1 # Apache-2.0
openstackdocstheme>=1.31.2 # Apache-2.0
# releasenotes
reno>=2.5.0 # Apache-2.0

10
tox.ini
View File

@ -4,8 +4,8 @@ envlist = py37,pep8
skipsdist = True
[testenv]
basepython = python3
usedevelop = True
install_command = pip install {opts} {packages}
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
-r{toxinidir}/test-requirements.txt
@ -13,27 +13,21 @@ deps =
commands = stestr run --slowest {posargs}
[testenv:pep8]
basepython = python3
commands = flake8
[testenv:venv]
basepython = python3
commands = {posargs}
[testenv:cover]
basepython = python3
commands = python setup.py test --coverage --testr-args='{posargs}'
[testenv:docs]
basepython = python3
commands = python setup.py build_sphinx
commands = sphinx-build -W -b html doc/source doc/build/html
[testenv:releasenotes]
basepython = python3
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:debug]
basepython = python3
commands = oslo_debug_helper -t os_win/tests/unit {posargs}
[flake8]