diff --git a/pyproject.toml b/pyproject.toml index eb7df3f..17a9f89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ requires-python = ">=3.12" dependencies = [ "click >= 8", "hatch >= 1.14", + "twine", ] [project.optional-dependencies] diff --git a/squatter/templates.py b/squatter/templates.py index ddbd729..5c7b28a 100644 --- a/squatter/templates.py +++ b/squatter/templates.py @@ -1,3 +1,4 @@ +from glob import glob from pathlib import Path from subprocess import check_call, check_output from typing import Optional @@ -52,4 +53,8 @@ def sdist(self) -> None: def upload(self) -> None: self.sdist() - check_call(["hatch", "publish"], cwd=self.staging_directory) + check_call( + ["twine", "upload", *glob("dist/*", root_dir=self.staging_directory)], + cwd=self.staging_directory, + ) + # check_call(["hatch", "publish"], cwd=self.staging_directory) diff --git a/squatter/tests/__init__.py b/squatter/tests/__init__.py index a2aa960..b544b55 100644 --- a/squatter/tests/__init__.py +++ b/squatter/tests/__init__.py @@ -88,11 +88,16 @@ def test_cli_functional(self, check_call_mock: Any, check_output_mock: Any) -> N def patched_check_call(cmd: List[str], **kwargs: Any) -> Any: nonlocal uploads - if cmd[0] != "hatch": - return check_call(cmd, **kwargs) - else: + if cmd[0] == "hatch": if "publish" in cmd: uploads += 1 + else: + return check_call(cmd, **kwargs) + elif cmd[0] == "twine": + if "upload" in cmd: + uploads += 1 + else: + return check_call(cmd, **kwargs) check_call_mock.side_effect = patched_check_call