Skip to content

Commit

Permalink
fix: detection when version is not a exact match
Browse files Browse the repository at this point in the history
the name of the folder inside the source tarball won't always be equal
the package + version provided.
  • Loading branch information
bruno-fs committed Jan 30, 2023
1 parent e6615da commit cf8cb28
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pybuild-deps"
version = "0.0.2"
version = "0.0.3"
description = "A simple tool for detection of PEP-517 build dependencies."
authors = ["Bruno Ciconelle <[email protected]>"]
license = "GPL-3.0"
Expand Down
3 changes: 2 additions & 1 deletion src/pybuild_deps/find_build_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def find_build_dependencies(package_name, version):
build_dependencies = []
with tarfile.open(fileobj=source_path.open("rb")) as tarball:
for file_name, parser in file_parser_map.items():
root_dir = tarball.getnames()[0].split("/")[0]
try:
file = tarball.extractfile(f"{package_name}-{version}/{file_name}")
file = tarball.extractfile(f"{root_dir}/{file_name}")
except KeyError:
logging.info(
"%s file not found for package %s==%s",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_log_level(runner: CliRunner, mocker):
("urllib3", "1.26.13", []),
(
"cryptography",
"39.0.0",
"39",
[
"setuptools>=40.6.0,!=60.9.0",
"wheel",
Expand Down

0 comments on commit cf8cb28

Please sign in to comment.