Compare commits

...

1 Commits

Author SHA1 Message Date
04109012ae Make min python 3.9+
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-07 11:47:33 -08:00
5 changed files with 6 additions and 35 deletions

View File

@ -1,12 +1,11 @@
# Build pipelines # Build pipelines
PYTHON_VERSIONS = [ PYTHON_VERSIONS = [
"3.7",
"3.8",
"3.9", "3.9",
"3.10", "3.10",
"3.11", "3.11",
"3.12", "3.12",
"3.13",
"latest", "latest",
] ]

View File

@ -14,7 +14,6 @@ import toml
from wheel.wheelfile import WheelFile from wheel.wheelfile import WheelFile
import release_gitter as rg import release_gitter as rg
from release_gitter import removeprefix
@dataclass @dataclass
@ -96,7 +95,7 @@ class _PseudoBuildBackend:
print("Prepare meta", metadata_directory, config_settings) print("Prepare meta", metadata_directory, config_settings)
metadata = read_metadata() metadata = read_metadata()
version = removeprefix(metadata.version, "v") if metadata.version else "0.0.0" version = metadata.version.removeprefix("v") if metadata.version else "0.0.0"
# Returns distinfo dir? # Returns distinfo dir?
dist_info = Path(metadata_directory) / f"{metadata.name}-{version}.dist-info" dist_info = Path(metadata_directory) / f"{metadata.name}-{version}.dist-info"
@ -145,7 +144,7 @@ class _PseudoBuildBackend:
metadata_directory = Path(metadata_directory) metadata_directory = Path(metadata_directory)
metadata = read_metadata() metadata = read_metadata()
version = removeprefix(metadata.version, "v") if metadata.version else "0.0.0" version = metadata.version.removeprefix("v") if metadata.version else "0.0.0"
wheel_directory = Path(wheel_directory) wheel_directory = Path(wheel_directory)
wheel_directory.mkdir(exist_ok=True) wheel_directory.mkdir(exist_ok=True)

View File

@ -19,7 +19,7 @@ authors = [
maintainers = [ maintainers = [
{ name = "Ian Fijolek", email = "iamthefij@gmail.com" } { name = "Ian Fijolek", email = "iamthefij@gmail.com" }
] ]
requires-python = ">=3.7" requires-python = ">=3.9"
dependencies = ["requests"] dependencies = ["requests"]
[project.optional-dependencies] [project.optional-dependencies]
@ -53,7 +53,7 @@ run = [
] ]
[[tool.hatch.envs.test.matrix]] [[tool.hatch.envs.test.matrix]]
python = ["3", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] python = ["3", "3.9", "3.10", "3.11", "3.12", "3.13"]
[tool.hatch.envs.lint] [tool.hatch.envs.lint]
detached = true detached = true

View File

@ -31,24 +31,6 @@ class InvalidRemoteError(ValueError):
pass pass
def removeprefix(s: str, pre: str) -> str:
# Duplicate str.removeprefix for py<3.9
try:
return s.removeprefix(pre) # type: ignore
except AttributeError:
# Py < 3.9
return s[len(pre) :] if s and s.startswith(pre) else s
def removesuffix(s: str, suf: str) -> str:
# Duplicate str.removesuffix for py<3.9
try:
return s.removesuffix(suf) # type: ignore
except AttributeError:
# Py < 3.9
return s[: -len(suf)] if s and s.endswith(suf) else s
SYSTEM_SYNONYMS: list[list[str]] = [ SYSTEM_SYNONYMS: list[list[str]] = [
["Darwin", "darwin", "MacOS", "macos", "macOS"], ["Darwin", "darwin", "MacOS", "macos", "macOS"],
["Windows", "windows", "win", "win32", "win64"], ["Windows", "windows", "win", "win32", "win64"],
@ -147,7 +129,7 @@ def parse_git_remote(git_url: str | None = None) -> GitRemoteInfo:
f"{path[1:3]} Could not parse owner and repo from URL {git_url}" f"{path[1:3]} Could not parse owner and repo from URL {git_url}"
) )
return GitRemoteInfo(u.hostname, path[1], removesuffix(path[2], ".git")) return GitRemoteInfo(u.hostname, path[1], path[2].removesuffix(".git"))
def parse_cargo_version(p: Path) -> str: def parse_cargo_version(p: Path) -> str:

View File

@ -41,15 +41,6 @@ class TestExpression(NamedTuple):
raise raise
class TestGeneral(unittest.TestCase):
def test_removesuffix(self):
for test_case in (
TestExpression(self, ["repo.git", ".git"], {}, "repo"),
TestExpression(self, ["repo", ".git"], {}, "repo"),
):
test_case.run(release_gitter.removesuffix)
class TestRemoteInfo(unittest.TestCase): class TestRemoteInfo(unittest.TestCase):
def test_parse_remote_info(self): def test_parse_remote_info(self):
for test_case in ( for test_case in (