Support for python3.7 and python3.8
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Added tox targets as well
This commit is contained in:
parent
1b74126494
commit
3f23ddd3cc
@ -2,6 +2,8 @@
|
|||||||
This builder functions as a pseudo builder that instead downloads and installs a binary file using
|
This builder functions as a pseudo builder that instead downloads and installs a binary file using
|
||||||
release-gitter based on a pyproject.toml file. It's a total hack...
|
release-gitter based on a pyproject.toml file. It's a total hack...
|
||||||
"""
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from shutil import copytree
|
from shutil import copytree
|
||||||
from shutil import move
|
from shutil import move
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#! /usr/bin/env python3
|
#! /usr/bin/env python3
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import platform
|
import platform
|
||||||
from collections.abc import Sequence
|
from collections.abc import Sequence
|
||||||
@ -91,7 +93,14 @@ def parse_git_remote(git_url: Optional[str] = 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], path[2].removesuffix(".git"))
|
repo = path[2]
|
||||||
|
try:
|
||||||
|
repo = repo.removesuffix(".git") # type: ignore
|
||||||
|
except AttributeError:
|
||||||
|
# Py < 3.9
|
||||||
|
repo = repo[: -len(".git")] if repo and repo.endswith(".git") else repo
|
||||||
|
|
||||||
|
return GitRemoteInfo(u.hostname, path[1], repo)
|
||||||
|
|
||||||
|
|
||||||
def parse_cargo_version(p: Path) -> str:
|
def parse_cargo_version(p: Path) -> str:
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -111,25 +113,21 @@ class TestVersionInfo(unittest.TestCase):
|
|||||||
version = release_gitter.read_version()
|
version = release_gitter.read_version()
|
||||||
self.assertIsNone(version)
|
self.assertIsNone(version)
|
||||||
|
|
||||||
def test_cargo_file_has_version(self):
|
@patch("pathlib.Path.exists", return_value=True)
|
||||||
with (
|
@patch(
|
||||||
patch("pathlib.Path.exists", return_value=True),
|
|
||||||
patch(
|
|
||||||
"pathlib.Path.open",
|
"pathlib.Path.open",
|
||||||
mock_open(read_data="\n".join(["[package]", 'version = "1.0.0"'])),
|
mock_open(read_data="\n".join(["[package]", 'version = "1.0.0"'])),
|
||||||
),
|
)
|
||||||
):
|
def test_cargo_file_has_version(self, *_):
|
||||||
version = release_gitter.read_version()
|
version = release_gitter.read_version()
|
||||||
self.assertEqual(version, "1.0.0")
|
self.assertEqual(version, "1.0.0")
|
||||||
|
|
||||||
def test_cargo_file_missing_version(self):
|
@patch("pathlib.Path.exists", return_value=True)
|
||||||
with (
|
@patch(
|
||||||
patch("pathlib.Path.exists", return_value=True),
|
|
||||||
patch(
|
|
||||||
"pathlib.Path.open",
|
"pathlib.Path.open",
|
||||||
mock_open(read_data="\n".join(["[package]"])),
|
mock_open(read_data="\n".join(["[package]"])),
|
||||||
),
|
)
|
||||||
):
|
def test_cargo_file_missing_version(self, *_):
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
release_gitter.read_version()
|
release_gitter.read_version()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user