Skip to content

Commit

Permalink
Add conan package manager API
Browse files Browse the repository at this point in the history
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
  • Loading branch information
TG1999 committed Mar 27, 2023
1 parent edda714 commit 8e09aaa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ toml==0.10.2
tomli==2.0.1
traitlets==5.1.1
typing_extensions==4.1.1
univers==30.9.1
univers==30.10.0
urllib3==1.26.9
wcwidth==0.2.5
websocket-client==0.59.0
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ install_requires =

#essentials
packageurl-python>=0.10.5rc1
univers>=30.9.1
univers>=30.10.0
license-expression>=21.6.14

# file and data formats
Expand Down
17 changes: 17 additions & 0 deletions vulnerabilities/package_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,22 @@ def fetch(self, pkg: str) -> Iterable[PackageVersion]:
)


class ConanVersionAPI(VersionAPI):
"""
Fetch versions of Erlang packages from the hex API
"""

package_type = "conan"

def fetch(self, pkg: str) -> Iterable[PackageVersion]:
response = get_response(
url=f"https://conan.io/center/api/ui/details?name={pkg}&user=_&channel=_",
content_type="json",
)
for release in response["versions"]:
yield PackageVersion(value=release["version"])


class GoproxyVersionAPI(VersionAPI):
"""
Fetch versions of Go "golang" packages from the Go proxy API
Expand Down Expand Up @@ -688,6 +704,7 @@ def fetch(self, pkg: str) -> Iterable[PackageVersion]:
CratesVersionAPI,
DebianVersionAPI,
GitHubTagsAPI,
ConanVersionAPI,
}

VERSION_API_CLASSES_BY_PACKAGE_TYPE = {cls.package_type: cls for cls in VERSION_API_CLASSES}
Expand Down

0 comments on commit 8e09aaa

Please sign in to comment.