Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ check:
pylint --disable=all --enable=spelling --spelling-dict=en_US --spelling-private-dict-file=spell.ignore *

clean:
$(PYTHON) setup.py clean
rm -rf MANIFEST BUILD BUILDROOT SPECS RPMS SRPMS SOURCES PYPI_UPLOAD build dist
for pattern in "*.pyc" "__pycache__" "*.egg-info"; do \
find . -name "$$pattern" -exec rm -rf {} +; \
done

develop:
$(PYTHON) setup.py develop $(PYTHON_DEVELOP_ARGS)
Expand Down
44 changes: 7 additions & 37 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,12 @@
# Author: Lucas Meneghel Rodrigues <lmr@redhat.com>

# pylint: disable=E0611
import os
import shutil
from distutils.command.clean import clean
from pathlib import Path

from setuptools import find_packages, setup

VERSION = open("VERSION", "r").read().strip()


class Clean(clean):
"""Our custom command to get rid of scratch files after build."""

description = "Get rid of scratch, byte files and build stuff."

def run(self):
super().run()
cleaning_list = [
"MANIFEST",
"BUILD",
"BUILDROOT",
"SPECS",
"RPMS",
"SRPMS",
"SOURCES",
"PYPI_UPLOAD",
"./build",
]

cleaning_list += list(Path(".").rglob("*.pyc"))
cleaning_list += list(Path(".").rglob("__pycache__"))

for e in cleaning_list:
if not os.path.exists(e):
continue
if os.path.isfile(e):
os.remove(e)
if os.path.isdir(e):
shutil.rmtree(e)


if __name__ == "__main__":
setup(
name="avocado-framework-plugin-vt",
Expand Down Expand Up @@ -96,6 +61,11 @@ def run(self):
"avocado-vt = avocado_vt.plugins.vt_runner:VTTestRunner",
],
},
install_requires=["netifaces", "six", "aexpect", "avocado-framework>=82.1"],
cmdclass={"clean": Clean},
install_requires=[
"netifaces",
"packaging",
Comment thread
YvanY0 marked this conversation as resolved.
"six",
"aexpect",
"avocado-framework>=82.1",
],
)
5 changes: 2 additions & 3 deletions virttest/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import re
import shutil
import sys
from distutils import dir_util # virtualenv problem pylint: disable=E0611

from avocado.utils import cpu, distro, genio, linux_modules
from avocado.utils import path as utils_path
Expand Down Expand Up @@ -910,7 +909,7 @@ def bootstrap(options, interactive=False):
LOG.info("%d - Updating test providers repo configuration from local copy", step)
tp_base_dir = data_dir.get_base_test_providers_dir()
tp_local_dir = data_dir.get_test_providers_dir()
dir_util.copy_tree(tp_base_dir, tp_local_dir)
shutil.copytree(tp_base_dir, tp_local_dir, dirs_exist_ok=True)

not_downloaded = asset.test_providers_not_downloaded()
if not_downloaded:
Expand Down Expand Up @@ -950,7 +949,7 @@ def bootstrap(options, interactive=False):
LOG.info(
"%d - Syncing backend dirs %s -> %s", step, base_backend_dir, local_backend_dir
)
dir_util.copy_tree(base_backend_dir, local_backend_dir)
shutil.copytree(base_backend_dir, local_backend_dir, dirs_exist_ok=True)

sync_download_dir(interactive)

Expand Down
11 changes: 5 additions & 6 deletions virttest/utils_version.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import operator
import re
from distutils.version import ( # pylint: disable=no-name-in-module,import-error
LooseVersion,
)

from packaging.version import parse


class VersionInterval(object):
Expand Down Expand Up @@ -31,8 +30,8 @@ def __init__(self, interval):
raise ValueError("Invalid string representation of an interval")
self.opening, lower, upper, self.closing = match.groups()

self.lower_bound = LooseVersion(lower) if lower else None
self.upper_bound = LooseVersion(upper) if upper else None
self.lower_bound = parse(lower) if lower else None
Comment thread
YvanY0 marked this conversation as resolved.
self.upper_bound = parse(upper) if upper else None
self._check_interval()

def _check_interval(self):
Expand Down Expand Up @@ -64,7 +63,7 @@ def __contains__(self, version):
"]": operator.ge,
}
in_interval = True
version = LooseVersion(version)
version = parse(version)
if self.lower_bound:
opt = op_mapping.get(self.opening)
in_interval = opt(self.lower_bound, version)
Expand Down