Skip to content

Commit ad2aa97

Browse files
committed
1.10.1 - Refactor GitHub release task
Also fixes a bug with python-build-once.
1 parent 90824ca commit ad2aa97

File tree

8 files changed

+37
-21
lines changed

8 files changed

+37
-21
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
6666
- run: |
6767
mk python-release owner=vkottler \
68-
repo=vmklib version=1.10.0
68+
repo=vmklib version=1.10.1
6969
if: |
7070
matrix.python-version == '3.11'
7171
&& matrix.system == 'ubuntu-latest'

.pylintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
[DESIGN]
2+
max-args=6
3+
14
[MESSAGES CONTROL]
25
disable=duplicate-code

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
=====================================
33
generator=datazen
44
version=3.1.2
5-
hash=0bae505c06b01979c4276b236a95630b
5+
hash=0c42310385e6f37f284556e25b419929
66
=====================================
77
-->
88

9-
# vmklib ([1.10.0](https://pypi.org/project/vmklib/))
9+
# vmklib ([1.10.1](https://pypi.org/project/vmklib/))
1010

1111
[![python](https://img.shields.io/pypi/pyversions/vmklib.svg)](https://pypi.org/project/vmklib/)
1212
![Build Status](https://github.com/vkottler/vmklib/workflows/Python%20Package/badge.svg)

local/variables/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
22
major: 1
33
minor: 10
4-
patch: 0
4+
patch: 1
55
entry: mk

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__"
44

55
[project]
66
name = "vmklib"
7-
version = "1.10.0"
7+
version = "1.10.1"
88
description = "Simplify project workflows by standardizing use of GNU Make."
99
readme = "README.md"
1010
requires-python = ">=3.8"

vmklib/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# =====================================
22
# generator=datazen
33
# version=3.1.2
4-
# hash=0e50415f07e485c70acde31abb963f05
4+
# hash=089d813c9238c490a893adefbd7ad945
55
# =====================================
66

77
"""
@@ -10,4 +10,4 @@
1010

1111
DESCRIPTION = "Simplify project workflows by standardizing use of GNU Make."
1212
PKG_NAME = "vmklib"
13-
VERSION = "1.10.0"
13+
VERSION = "1.10.1"

vmklib/tasks/python/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414

1515
# internal
1616
from vmklib.tasks.args import environ_fallback_split
17-
from vmklib.tasks.mixins.concrete import ConcreteBuilderMixin
17+
from vmklib.tasks.mixins.concrete import ConcreteOnceMixin
1818
from vmklib.tasks.python import PREFIX
1919

2020

21-
class PythonBuild(ConcreteBuilderMixin, SubprocessLogMixin):
21+
class PythonBuild(ConcreteOnceMixin, SubprocessLogMixin):
2222
"""Build a Python package."""
2323

2424
async def run(

vmklib/tasks/release.py

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ async def upload_release_asset(
4949
)
5050
return loads(result.stdout) # type: ignore
5151

52-
async def run(
52+
async def release(
5353
self,
54-
inbox: Inbox,
55-
outbox: Outbox,
56-
*args,
57-
**kwargs,
54+
cwd: Path,
55+
owner: str,
56+
repo: str,
57+
version: str,
58+
dist: str = "dist",
5859
) -> bool: # pragma: nocover
59-
"""Generate ninja configuration files."""
60+
"""Create a release."""
6061

6162
# Check for API key in environment.
6263
if "GITHUB_API_TOKEN" not in os.environ:
@@ -68,12 +69,7 @@ async def run(
6869
# Set token header.
6970
ensure_api_token(os.environ["GITHUB_API_TOKEN"])
7071

71-
cwd: Path = args[0]
72-
7372
# Ensure GitHub parameters are set.
74-
owner = kwargs["owner"]
75-
repo = kwargs["repo"]
76-
version = kwargs["version"]
7773
if not owner or not repo or not version:
7874
return False
7975

@@ -94,10 +90,27 @@ async def run(
9490

9591
# Use 'Upload a release asset' API to upload all files in the 'dist'
9692
# directory to the new release.
97-
for item in cwd.joinpath(kwargs.get("dist", "dist")).iterdir():
93+
for item in cwd.joinpath(dist).iterdir():
9894
result = await self.upload_release_asset(
9995
owner, repo, release_id, item
10096
)
10197
self.log.info("Uploaded '%s'.", result["browser_download_url"])
10298

10399
return True
100+
101+
async def run(
102+
self,
103+
inbox: Inbox,
104+
outbox: Outbox,
105+
*args,
106+
**kwargs,
107+
) -> bool: # pragma: nocover
108+
"""Generate ninja configuration files."""
109+
110+
return await self.release(
111+
args[0],
112+
kwargs["owner"],
113+
kwargs["repo"],
114+
kwargs["version"],
115+
dist=kwargs.get("dist", "dist"),
116+
)

0 commit comments

Comments
 (0)