Skip to content

Commit e7c29af

Browse files
committed
fix: could not build --version latest
Signed-off-by: Jos Verlinde <[email protected]>
1 parent 749f145 commit e7c29af

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/stubber/publish/stubpacker.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from stubber.utils.config import CONFIG
2828
from stubber.utils.versions import clean_version
2929

30-
3130
Status = NewType("Status", Dict[str, Union[str, None]])
3231
StubSources = List[Tuple[StubSource, Path]]
3332

@@ -102,7 +101,14 @@ def __init__(
102101
self.stub_sources = stubs
103102

104103
self._publish = True
105-
self.status: Status = Status({"result": "-", "name": self.package_name, "version": self.pkg_version, "error": None})
104+
self.status: Status = Status(
105+
{
106+
"result": "-",
107+
"name": self.package_name,
108+
"version": self.pkg_version,
109+
"error": None,
110+
}
111+
)
106112

107113
@property
108114
def package_path(self) -> Path:
@@ -127,7 +133,8 @@ def pkg_version(self) -> str:
127133
return self.mpy_version
128134
with open(_toml, "rb") as f:
129135
pyproject = tomllib.load(f)
130-
return str(parse(pyproject["tool"]["poetry"]["version"]))
136+
ver = pyproject["tool"]["poetry"]["version"]
137+
return str(parse(ver)) if ver != "latest" else ver
131138

132139
@pkg_version.setter
133140
def pkg_version(self, version: str) -> None:
@@ -604,7 +611,7 @@ def are_package_sources_available(self) -> bool:
604611
# todo: below is a workaround for different types, but where is the source of this difference coming from?
605612
msg = (
606613
f"{self.package_name}: source '{name.value}' not found: {CONFIG.stub_path / path}"
607-
if isinstance(name, StubSource) # type: ignore
614+
if isinstance(name, StubSource) # type: ignore
608615
else f"{self.package_name}: source '{name}' not found: {CONFIG.stub_path / path}"
609616
)
610617
self.status["error"] = msg

0 commit comments

Comments
 (0)