Skip to content

Commit

Permalink
upgraded version checking to fix deprecation warnings
Browse files Browse the repository at this point in the history
Removed usage of pgk_resources and distutils.version.LooseVersion
  • Loading branch information
Daraan committed Apr 12, 2024
1 parent 7d119a5 commit 7cbbc67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scenario_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
import argparse
from argparse import RawTextHelpFormatter
from datetime import datetime
from distutils.version import LooseVersion
from packaging.version import Version
import importlib
import inspect
import os
import signal
import sys
import time
import json
import pkg_resources
from importlib.metadata import metadata

import carla

Expand Down Expand Up @@ -92,9 +92,9 @@ def __init__(self, args):
# requests in the localhost at port 2000.
self.client = carla.Client(args.host, int(args.port))
self.client.set_timeout(self.client_timeout)
dist = pkg_resources.get_distribution("carla")
if LooseVersion(dist.version) < LooseVersion('0.9.15'):
raise ImportError("CARLA version 0.9.15 or newer required. CARLA version found: {}".format(dist))
md = metadata("carla")
if Version(md["Version"]) < Version('0.9.15'):
raise ImportError("CARLA version 0.9.15 or newer required. CARLA version found: {}".format(md["Version"]))

# Load agent if requested via command line args
# If something goes wrong an exception will be thrown by importlib (ok here)
Expand Down

0 comments on commit 7cbbc67

Please sign in to comment.