Skip to content

Commit

Permalink
change to use parse_version instead of version.parse, because "versio…
Browse files Browse the repository at this point in the history
…n" is used as variables everywhere

Signed-off-by: ijnek <kenjibrameld@gmail.com>
  • Loading branch information
ijnek committed Mar 6, 2023
1 parent d8e4d15 commit cd20317
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
2 changes: 0 additions & 2 deletions bloom/commands/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
import webbrowser
import yaml

from packaging import version

# python2/3 compatibility
try:
from urllib.error import HTTPError, URLError
Expand Down
4 changes: 2 additions & 2 deletions bloom/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
from bloom.util import add_global_arguments
from bloom.util import handle_global_arguments

from packaging import version
from packaging.version import parse as parse_version
from threading import Lock

_updater_running = False
Expand Down Expand Up @@ -115,7 +115,7 @@ def fetch_update(user_bloom):
newest_version = pypi_result['info']['version']
current_version = bloom.__version__
if newest_version and bloom.__version__ != 'unset':
if version.parse(bloom.__version__) < version.parse(newest_version):
if parse_version(bloom.__version__) < parse_version(newest_version):
version_dict = {
'current': str(current_version),
'newest': str(newest_version)
Expand Down
4 changes: 2 additions & 2 deletions bloom/generators/debian/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
except ImportError:
from ConfigParser import SafeConfigParser
from dateutil import tz
from packaging import version
from packaging.version import parse as parse_version

from bloom.generators import BloomGenerator
from bloom.generators import GeneratorError
Expand Down Expand Up @@ -449,7 +449,7 @@ def generate_substitutions_from_package(
bad_changelog = True
# Make sure that the current version is the latest in the changelog
for changelog in changelogs:
if version.parse(package.version) < version.parse(changelog[0]):
if parse_version(package.version) < parse_version(changelog[0]):
error("")
error("There is at least one changelog entry, '{0}', which has a "
"newer version than the version of package '{1}' being released, '{2}'."
Expand Down
4 changes: 2 additions & 2 deletions bloom/generators/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@

try:
import catkin_pkg
from packaging import version
if version.parse(catkin_pkg.__version__) < version.parse('0.3.8'):
from packaging.version import parse as parse_version
if parse_version(catkin_pkg.__version__) < parse_version('0.3.8'):
warning("This version of bloom requires catkin_pkg version >= '0.3.8',"
" the used version of catkin_pkg is '{0}'".format(catkin_pkg.__version__))
from catkin_pkg import metapackage
Expand Down
4 changes: 1 addition & 3 deletions bloom/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
from subprocess import PIPE
from subprocess import CalledProcessError

from packaging import version

from bloom.logging import debug
from bloom.logging import error
from bloom.logging import fmt
Expand Down Expand Up @@ -687,7 +685,7 @@ def get_last_tag_by_version(directory=None):
versions = []
for line in output.splitlines():
tags.append(line.strip())
ver = re.match("[0-9]+.[0-9]+.[0-9]+", line)
ver = re.match(r"[0-9]+\.[0-9]+\.[0-9]+", line)
if ver:
versions.append(ver)
return tags[versions.index(max(versions))] if versions else ''
Expand Down
4 changes: 2 additions & 2 deletions bloom/rosdistro_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import sys
import traceback

from packaging import version
from packaging.version import parse as parse_version

# python2/3 compatibility
try:
Expand All @@ -58,7 +58,7 @@

try:
import rosdistro
if version.parse(rosdistro.__version__) < version.parse('0.7.0'):
if parse_version(rosdistro.__version__) < parse_version('0.7.0'):
error("rosdistro version 0.7.0 or greater is required, found '{0}' from '{1}'."
.format(rosdistro.__version__, os.path.dirname(rosdistro.__file__)),
exit=True)
Expand Down

0 comments on commit cd20317

Please sign in to comment.