Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
adds "from" path to package location
Browse files Browse the repository at this point in the history
  • Loading branch information
g.trantham committed Apr 30, 2024
1 parent d4e4980 commit bb48b11
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions poetry_version_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def activate(self, poetry: Poetry, io: IO) -> None:
if packages:
if len(packages) == 1:
package_name = packages[0]["include"]
package_path = packages[0].get("from", ".")
else:
message = (
"<b>poetry-version-plugin</b>: More than one package set, "
Expand All @@ -39,18 +40,19 @@ def activate(self, poetry: Poetry, io: IO) -> None:
raise RuntimeError(message)
else:
package_name = module_name(poetry.package.name)
init_path = Path(package_name) / "__init__.py"
package_path = "."
init_path = Path(package_path) / package_name / "__init__.py"
if not init_path.is_file():
message = (
"<b>poetry-version-plugin</b>: __init__.py file not found at "
f"{init_path} cannot extract dynamic version"
f"{init_path.resolve()} cannot extract dynamic version"
)
io.write_error_line(message)
raise RuntimeError(message)
else:
io.write_line(
"<b>poetry-version-plugin</b>: Using __init__.py file at "
f"{init_path} for dynamic version"
f"{init_path.resolve()} for dynamic version"
)
tree = ast.parse(init_path.read_text())
for el in tree.body:
Expand Down

0 comments on commit bb48b11

Please sign in to comment.