Skip to content

Commit 70dcb5e

Browse files
authored
Fix for macOS: tar: Option --to-command=... is not supported (#188)
1 parent 8ac15da commit 70dcb5e

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ env:
88
jobs:
99
tests:
1010
name: "Tests"
11-
runs-on: ubuntu-latest
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [macos-latest, ubuntu-latest]
1216
steps:
1317
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1418
with:
1519
persist-credentials: false
1620
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
1721
with:
18-
python-version: 3.x
22+
python-version: 3.12
1923
cache: pip
2024
cache-dependency-path: dev-requirements.txt
2125
- run: |

run_release.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import shutil
1919
import subprocess
2020
import sys
21+
import tempfile
2122
import time
2223
import urllib.request
2324
from pathlib import Path
@@ -587,17 +588,14 @@ def check_doc_unreleased_version(db: ReleaseShelf) -> None:
587588
if release_tag.includes_docs:
588589
assert archive_path.exists()
589590
if archive_path.exists():
590-
proc = subprocess.run(
591-
[
592-
"tar",
593-
"-xjf",
594-
archive_path,
595-
'--to-command=! grep -Hn --label="$TAR_FILENAME" "[(]unreleased[)]"',
596-
],
597-
)
598-
if proc.returncode != 0:
599-
if not ask_question("Are these `(unreleased)` strings in built docs OK?"):
600-
raise AssertionError("`(unreleased)` strings found in docs")
591+
with tempfile.TemporaryDirectory() as temp_dir:
592+
subprocess.run(["tar", "-xjf", archive_path, "-C", temp_dir])
593+
proc = subprocess.run(["grep", "-rHn", "[(]unreleased[)]", temp_dir])
594+
if proc.returncode == 0:
595+
if not ask_question(
596+
"Are these `(unreleased)` strings in built docs OK?"
597+
):
598+
raise AssertionError("`(unreleased)` strings found in docs")
601599

602600

603601
def sign_source_artifacts(db: ReleaseShelf) -> None:

0 commit comments

Comments
 (0)