Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced deprecated distutils.version.StrictVersion with packaging.version.Version #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 8 additions & 4 deletions mixbox/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
# See LICENSE.txt for complete terms.

from abc import ABCMeta, abstractmethod
from distutils.version import StrictVersion

try:
from packaging.version import Version
except ImportError:
from distutils.version import StrictVersion as Version

from .exceptions import ignored
from .xml import get_etree_root, get_etree, get_schemaloc_pairs
Expand Down Expand Up @@ -59,7 +63,7 @@ def _get_version(self, root):
root (etree.Element)

Returns:
distutils.StrictVersion
packaging.version.Version

Raises:
UnknownVersionError
Expand All @@ -69,7 +73,7 @@ def _get_version(self, root):
# "cybox_minor_version", and "cybox_update_version".
version = self.get_version(root)
if version:
return StrictVersion(version)
return Version(version)

raise UnknownVersionError(
"Unable to determine the version of the input document. No "
Expand All @@ -86,7 +90,7 @@ def _check_version(self, root):
UnsupportedVersionError
"""
version = self._get_version(root)
supported = [StrictVersion(x) for x in
supported = [Version(x) for x in
self.supported_versions(root.tag)]

if version in supported:
Expand Down
2 changes: 1 addition & 1 deletion mixbox/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.

__version__ = "1.0.5"
__version__ = "1.0.6"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.0.5
current_version = 1.0.6
tag = True
commit = True

Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,9 @@ def get_version():
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
)
6 changes: 5 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py26, py27, py35, py36, py37, py38, rhel6
envlist = py26, py27, py35, py36, py37, py38, py39, py310, py311, py312, rhel6, rhel7, rhel8

[testenv]
commands =
Expand All @@ -25,3 +25,7 @@ python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312