Refactor elixir importer to use universal_versions
@@ -24,7 +24,8 @@ import asyncio
from typing import List, Set
import yaml
-from dephell_specifier import RangeSpecifier
+from universal_versions.version_specifier import VersionSpecifier
+from universal_versions.versions import SemverVersion
from packageurl import PackageURL
from vulnerabilities.data_source import GitDataSource
@@ -86,9 +87,13 @@ class ElixirSecurityDataSource(GitDataSource):
all_version_list = self.pkg_manager_api.get(pkg_name)
if not version_range_list:
return [], all_version_list
- version_ranges = {RangeSpecifier(r) for r in version_range_list}
+ version_ranges = {
+ VersionSpecifier.from_scheme_version_spec_string("semver", r)
+ for r in version_range_list
+ }
for version in all_version_list:
- if any([version in v for v in version_ranges]):
+ version_obj = SemverVersion(version)
+ if any([version_obj in v for v in version_ranges]):
safe_pkg_versions.append(version)
vuln_pkg_versions = set(all_version_list) - set(safe_pkg_versions)
