Skip to content

Commit

Permalink
update justfile and rye einfinger action
Browse files Browse the repository at this point in the history
  • Loading branch information
trappitsch committed Oct 22, 2024
1 parent 3b5a4c1 commit f02d998
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/package_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ jobs:
sudo apt-get update
sudo apt-get -y install libegl1-mesa
- name: Install the latest version of rye
uses: eifinger/setup-rye@v1
uses: eifinger/setup-rye@v4
with:
version: 'latest'
- name: Sync Rye
run: |
rye pin ${{ matrix.python-version }}
Expand Down
35 changes: 18 additions & 17 deletions .justfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,31 @@ update_workflow minimum_version maximum_version:
from pathlib import Path
import sys

workflow = Path('.github/workflows/package_testing.yml')
workflows = [Path('.github/workflows/package_testing.yml'), Path('.github/workflows/release_on_pypi.yml')]

vmin = sys.argv[1]
vmax = sys.argv[2]

minor_min = int(vmin.split(".")[1])
minor_max = int(vmax.split(".")[1])

with open(workflow) as f:
content = f.readlines()

for it, line in enumerate(content):
if "MAIN_PYTHON_VERSION: " in line:
print(it)
content[it] = f' MAIN_PYTHON_VERSION: "{vmax}"\n'
elif "python-version:" in line:
new_line = f' python-version: ['
for jt in range(minor_min, minor_max):
new_line += f'"3.{jt}", '
new_line += f'"3.{minor_max}"]\n'
content[it] = new_line

with open(workflow, 'w') as f:
f.writelines(content)
for workflow in workflows:
with open(workflow) as f:
content = f.readlines()

for it, line in enumerate(content):
if "MAIN_PYTHON_VERSION: " in line:
print(it)
content[it] = f' MAIN_PYTHON_VERSION: "{vmax}"\n'
elif "python-version:" in line:
new_line = f' python-version: ['
for jt in range(minor_min, minor_max):
new_line += f'"3.{jt}", '
new_line += f'"3.{minor_max}"]\n'
content[it] = new_line

with open(workflow, 'w') as f:
f.writelines(content)

[positional-arguments]
python_update minimum_version maximum_version:
Expand Down

0 comments on commit f02d998

Please sign in to comment.