Skip to content

Commit e2e74ef

Browse files
authored
Merge pull request #131 from dwhswenson/release-0.6.2
Release 0.6.2
2 parents 34ee9c5 + eb34fd1 commit e2e74ef

7 files changed

Lines changed: 37 additions & 43 deletions

File tree

.github/workflows/autorelease-default-env.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Vendored from Autorelease 0.6.1
1+
# Vendored from Autorelease 0.6.2
22
# Update by updating Autorelease and running `autorelease vendor actions`
3-
INSTALL_AUTORELEASE="python -m pip install autorelease==0.6.1"
3+
INSTALL_AUTORELEASE="python -m pip install autorelease==0.6.2"
44
if [ -f autorelease-env.sh ]; then
55
source autorelease-env.sh
66
fi

.github/workflows/autorelease-deploy.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Vendored from Autorelease 0.6.1
1+
# Vendored from Autorelease 0.6.2
22
# Update by updating Autorelease and running `autorelease vendor actions`
33
name: "Autorelease Deploy"
44
on:
@@ -13,26 +13,15 @@ jobs:
1313
permissions:
1414
id-token: write
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
- uses: actions/setup-python@v5
1818
with:
1919
python-version: "3.x"
20-
- run: | # TODO: move this to an action
21-
source ./.github/workflows/autorelease-default-env.sh
22-
if [ -f "autorelease-env.sh" ]; then
23-
cat autorelease-env.sh >> $GITHUB_ENV
24-
fi
25-
if [ -f "./.autorelease/install-autorelease" ]; then
26-
source ./.autorelease/install-autorelease
27-
else
28-
eval $INSTALL_AUTORELEASE
29-
fi
30-
name: "Install autorelease"
3120
- run: |
32-
python -m pip install twine wheel
21+
python -m pip install twine wheel build
3322
name: "Install release tools"
3423
- run: |
35-
python setup.py sdist bdist_wheel
24+
python -m build --sdist --wheel
3625
twine check dist/*
3726
name: "Build and check package"
3827
- uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/autorelease-gh-rel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Vendored from Autorelease 0.6.1
1+
# Vendored from Autorelease 0.6.2
22
# Update by updating Autorelease and running `autorelease vendor actions`
33
name: "Autorelease Release"
44
on:

.github/workflows/autorelease-prep.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Vendored from Autorelease 0.6.1
1+
# Vendored from Autorelease 0.6.2
22
# Update by updating Autorelease and running `autorelease vendor actions`
33
name: "Autorelease testpypi"
44
on:

autorelease/gh_actions_stages/autorelease-deploy.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,15 @@ jobs:
1313
permissions:
1414
id-token: write
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
- uses: actions/setup-python@v5
1818
with:
1919
python-version: "3.x"
20-
- run: | # TODO: move this to an action
21-
source ./.github/workflows/autorelease-default-env.sh
22-
if [ -f "autorelease-env.sh" ]; then
23-
cat autorelease-env.sh >> $$GITHUB_ENV
24-
fi
25-
if [ -f "./.autorelease/install-autorelease" ]; then
26-
source ./.autorelease/install-autorelease
27-
else
28-
eval $$INSTALL_AUTORELEASE
29-
fi
30-
name: "Install autorelease"
3120
- run: |
32-
python -m pip install twine wheel
21+
python -m pip install twine wheel build
3322
name: "Install release tools"
3423
- run: |
35-
python setup.py sdist bdist_wheel
24+
python -m build --sdist --wheel
3625
twine check dist/*
3726
name: "Build and check package"
3827
- uses: pypa/gh-action-pypi-publish@release/v1

autorelease/scripts/vendor.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22
try:
33
import pathlib
44
except ImportError: # py2
5-
import pathlib2
6-
import pkg_resources
5+
import pathlib2 as pathlib
6+
try:
7+
from importlib import resources as importlib_resources
8+
except ImportError: # py < 3.7
9+
import importlib_resources
710
from packaging.version import Version
811
import autorelease
912

1013
import git
1114
import re
1215

1316
def extract_github_owner_and_repo(url):
14-
github_url_re = ".*github.com:(?P<owner>.*)/(?P<repo>.*)"
17+
github_url_re = r".*github.com:(?P<owner>.*)/(?P<repo>.*)"
1518
m = re.match(github_url_re, url)
19+
if m is None:
20+
raise ValueError(f"Unable to parse GitHub URL: {url}")
1621
owner = m.group('owner')
1722
repo = m.group('repo')
1823
if repo.endswith('.git'):
@@ -70,23 +75,34 @@ def get_substitution_mapping(config=None):
7075

7176
def vendor(resources, base_path, relative_target_dir, substitutions):
7277
for resource in resources:
73-
orig_loc = pkg_resources.resource_filename('autorelease', resource)
74-
name = pathlib.Path(orig_loc).name
78+
# Use importlib.resources to get the resource content
79+
try:
80+
# For Python 3.9+
81+
resource_files = importlib_resources.files('autorelease')
82+
resource_path = resource_files / resource
83+
with resource_path.open('r') as rfile:
84+
template_content = rfile.read()
85+
except AttributeError:
86+
# For Python 3.7-3.8
87+
with importlib_resources.path('autorelease', resource) as resource_path:
88+
with open(resource_path, mode='r') as rfile:
89+
template_content = rfile.read()
90+
91+
name = pathlib.Path(resource).name
7592
target_dir = base_path / relative_target_dir
7693
target_dir.mkdir(parents=True, exist_ok=True)
7794
target_loc = base_path / relative_target_dir / name
78-
# print(f"cp {orig_loc} {target_loc}")
79-
with open(orig_loc, mode='r') as rfile:
80-
template = string.Template(rfile.read())
95+
# print(f"cp {resource} {target_loc}")
96+
template = string.Template(template_content)
8197

8298
with open(target_loc, mode='w') as wfile:
8399
wfile.write(template.substitute(**substitutions))
84100

101+
85102
def vendor_actions(base_path):
86103
resources = ['autorelease-default-env.sh', 'autorelease-prep.yml',
87104
'autorelease-gh-rel.yml', 'autorelease-deploy.yml']
88105
resources = ['gh_actions_stages/' + res for res in resources]
89106
target_dir = pathlib.Path('.github/workflows')
90107
substitutions = get_substitution_mapping()
91108
vendor(resources, base_path, target_dir, substitutions)
92-

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = autorelease
3-
version = 0.6.1
3+
version = 0.6.2
44
# version should end in .dev0 if this isn't to be released
55
short_description = Tools to keep the release process clean.
66
description = Tools to keep the release process clean.

0 commit comments

Comments
 (0)