Skip to content

Commit 46323b1

Browse files
committed
feat: add support to ada and simdutf
1 parent 2e2d73f commit 46323b1

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

dep_checker/dependencies.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def get_cpe(self, repo_path: Path) -> Optional[str]:
3838
]
3939

4040
common_dependencies: list[str] = [
41+
"ada",
4142
"acorn",
4243
"brotli",
4344
"c-ares",
@@ -50,7 +51,9 @@ def get_cpe(self, repo_path: Path) -> Optional[str]:
5051
"npm",
5152
"OpenSSL",
5253
"libuv",
54+
"simdutf",
5355
"uvwasi",
56+
"undici",
5457
"zlib",
5558
]
5659

@@ -64,6 +67,14 @@ def get_cpe(self, repo_path: Path) -> Optional[str]:
6467

6568

6669
dependencies_info: dict[str, Dependency] = {
70+
"ada": Dependency(
71+
version_parser=vp.get_ada_version,
72+
cpe=CPE(vendor="ada-url", product="ada"),
73+
),
74+
"simdutf": Dependency(
75+
version_parser=vp.get_simdutf_version,
76+
cpe=CPE(vendor="simdutf", product="simdutf"),
77+
),
6778
"zlib": Dependency(
6879
version_parser=vp.get_zlib_version,
6980
cpe=CPE(vendor="zlib", product="zlib"),

dep_checker/versions_parser.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,17 @@ def get_zlib_version(repo_path: Path) -> str:
204204
if matches is None:
205205
raise RuntimeError("Error extracting version number for zlib")
206206
return matches.groupdict()["version"]
207+
208+
def get_simdutf_version(repo_path: Path) -> str:
209+
with open(repo_path / "deps/simdutf/simdutf.h", "r") as f:
210+
matches = re.search('#define SIMDUTF_VERSION "(?P<version>.*)"', f.read())
211+
if matches is None:
212+
raise RuntimeError("Error extracting version number for simdutf")
213+
return matches.groupdict()["version"]
214+
215+
def get_ada_version(repo_path: Path) -> str:
216+
with open(repo_path / "deps/ada/ada.h", "r") as f:
217+
matches = re.search('#define ADA_VERSION "(?P<version>.*)"', f.read())
218+
if matches is None:
219+
raise RuntimeError("Error extracting version number for ada")
220+
return matches.groupdict()["version"]

0 commit comments

Comments
 (0)