mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 20:22:46 +00:00
Use packaging.version.Version() not LooseVersion
The Version is more strict, but we only use this for the implementation of tito.props configuration: [requirements] tito = <version> And the tito versions are not anyhow extraordinary. Note, this is done to fix a tox test failure.
This commit is contained in:
parent
8ce108266b
commit
ef5e8abd81
2 changed files with 11 additions and 4 deletions
|
@ -22,7 +22,6 @@ import re
|
||||||
import shutil
|
import shutil
|
||||||
import rpm
|
import rpm
|
||||||
from pkg_resources import require
|
from pkg_resources import require
|
||||||
from distutils.version import LooseVersion as loose_version
|
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
from tito.common import scl_to_rpm_option, get_latest_tagged_version, \
|
from tito.common import scl_to_rpm_option, get_latest_tagged_version, \
|
||||||
|
@ -34,7 +33,8 @@ from tito.common import scl_to_rpm_option, get_latest_tagged_version, \
|
||||||
find_cheetah_template_file, render_cheetah, replace_spec_release, \
|
find_cheetah_template_file, render_cheetah, replace_spec_release, \
|
||||||
find_spec_like_file, warn_out, get_commit_timestamp, chdir, mkdir_p, \
|
find_spec_like_file, warn_out, get_commit_timestamp, chdir, mkdir_p, \
|
||||||
find_git_root, info_out, munge_specfile, BUILDCONFIG_SECTION
|
find_git_root, info_out, munge_specfile, BUILDCONFIG_SECTION
|
||||||
from tito.compat import getstatusoutput, getoutput, urlparse, urlretrieve
|
from tito.compat import (getstatusoutput, getoutput, urlparse, urlretrieve,
|
||||||
|
Version)
|
||||||
from tito.exception import RunCommandException
|
from tito.exception import RunCommandException
|
||||||
from tito.exception import TitoException
|
from tito.exception import TitoException
|
||||||
from tito.config_object import ConfigObject
|
from tito.config_object import ConfigObject
|
||||||
|
@ -406,8 +406,8 @@ class Builder(ConfigObject, BuilderBase):
|
||||||
|
|
||||||
if self.config.has_section("requirements"):
|
if self.config.has_section("requirements"):
|
||||||
if self.config.has_option("requirements", "tito"):
|
if self.config.has_option("requirements", "tito"):
|
||||||
if loose_version(self.config.get("requirements", "tito")) > \
|
if Version(self.config.get("requirements", "tito")) > \
|
||||||
loose_version(require('tito')[0].version):
|
Version(require('tito')[0].version):
|
||||||
error_out([
|
error_out([
|
||||||
"tito version %s or later is needed to build this project." %
|
"tito version %s or later is needed to build this project." %
|
||||||
self.config.get("requirements", "tito"),
|
self.config.get("requirements", "tito"),
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
# in this software or its documentation.
|
# in this software or its documentation.
|
||||||
|
|
||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
|
# pylint: disable=unused-import,deprecated-module,function-redefined
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Compatibility library for Python 2.4 up through Python 3.
|
Compatibility library for Python 2.4 up through Python 3.
|
||||||
|
@ -19,6 +20,12 @@ Compatibility library for Python 2.4 up through Python 3.
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
|
try:
|
||||||
|
from packaging.version import Version
|
||||||
|
except ImportError:
|
||||||
|
from distutils.version import LooseVersion as Version
|
||||||
|
|
||||||
ENCODING = sys.getdefaultencoding()
|
ENCODING = sys.getdefaultencoding()
|
||||||
PY2 = sys.version_info[0] == 2
|
PY2 = sys.version_info[0] == 2
|
||||||
if PY2:
|
if PY2:
|
||||||
|
|
Loading…
Add table
Reference in a new issue