Skip to content

Commit 39248bc

Browse files
authored
Merge pull request #7 from thatch/requires
Go back to uploading with twine
2 parents 8b4fe3a + 28b28d8 commit 39248bc

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ requires-python = ">=3.12"
1616
dependencies = [
1717
"click >= 8",
1818
"hatch >= 1.14",
19+
"twine",
1920
]
2021

2122
[project.optional-dependencies]

squatter/templates.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from glob import glob
12
from pathlib import Path
23
from subprocess import check_call, check_output
34
from typing import Optional
@@ -52,4 +53,8 @@ def sdist(self) -> None:
5253

5354
def upload(self) -> None:
5455
self.sdist()
55-
check_call(["hatch", "publish"], cwd=self.staging_directory)
56+
check_call(
57+
["twine", "upload", *glob("dist/*", root_dir=self.staging_directory)],
58+
cwd=self.staging_directory,
59+
)
60+
# check_call(["hatch", "publish"], cwd=self.staging_directory)

squatter/tests/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,16 @@ def test_cli_functional(self, check_call_mock: Any, check_output_mock: Any) -> N
8888

8989
def patched_check_call(cmd: List[str], **kwargs: Any) -> Any:
9090
nonlocal uploads
91-
if cmd[0] != "hatch":
92-
return check_call(cmd, **kwargs)
93-
else:
91+
if cmd[0] == "hatch":
9492
if "publish" in cmd:
9593
uploads += 1
94+
else:
95+
return check_call(cmd, **kwargs)
96+
elif cmd[0] == "twine":
97+
if "upload" in cmd:
98+
uploads += 1
99+
else:
100+
return check_call(cmd, **kwargs)
96101

97102
check_call_mock.side_effect = patched_check_call
98103

0 commit comments

Comments
 (0)