Skip to content

Commit

Permalink
Merge pull request #74 from trailofbits/go-version-comparison
Browse files Browse the repository at this point in the history
Adds the ability to compare Go versions
  • Loading branch information
ESultanik authored Dec 9, 2024
2 parents 54c6224 + 967c424 commit 2b265e2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion it_depends/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ def resolve_from_source(
package_name = body[0]
elif command == "set":
# detect project version...
value: Optional[str] = (body + [None,])[
# TODO: Revisit the following type error:
value: Optional[str] = (body + [None,])[ # type: ignore
1
] # type: ignore
if (
Expand Down
3 changes: 3 additions & 0 deletions it_depends/go.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def __init__(self, go_version_string: str):
self.version_string = self.version_string[1:]
self.build: bool = False # This is to appease semantic_version.base.SimpleSpec

def __lt__(self, other):
return self.version_string < str(other)

def __eq__(self, other):
return isinstance(other, GoVersion) and self.version_string == other.version_string

Expand Down
2 changes: 1 addition & 1 deletion it_depends/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def shortest_path_length(self, from_node: Union[T, R], to_node: T) -> int:
self._all_pairs_shortest_paths = dict(nx.all_pairs_shortest_path_length(self)) # type: ignore
if (
from_node not in self._all_pairs_shortest_paths
or to_node not in self._all_pairs_shortest_paths[from_node]
or to_node not in self._all_pairs_shortest_paths[from_node] # type: ignore
): # type: ignore
return -1
return self._all_pairs_shortest_paths[from_node][to_node] # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
license="LGPL-3.0-or-later",
url="https://github.com/trailofbits/it-depends",
author="Trail of Bits",
version="0.1.1",
version="0.1.2",
packages=find_packages(exclude=["test"]),
python_requires=">=3.7",
install_requires=[
Expand Down

0 comments on commit 2b265e2

Please sign in to comment.