|
46 | 46 |
|
47 | 47 | steps: |
48 | 48 | - uses: actions/checkout@v4 |
| 49 | + |
| 50 | + - name: Edit pyproject.toml (macOS) |
| 51 | + if: runner.os == 'macOS' |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + # macOS sed requires a backup extension (here, an empty string '') |
| 55 | + sed -i '' '/cmake\.args = \[/,/\]/{ |
| 56 | + s|"-DPYTHON_BUILD_SETUP=ON"|"-DPYTHON_BUILD_SETUP=ON",\ |
| 57 | + "-DHIPO=ON"| |
| 58 | + }' pyproject.toml |
| 59 | + echo "--- pyproject.toml content after macOS edit ---" |
| 60 | + cat pyproject.toml |
| 61 | +
|
| 62 | + - name: Edit pyproject.toml (Linux) |
| 63 | + if: runner.os == 'Linux' |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + # Linux sed does NOT require a backup extension |
| 67 | + sed -i '/cmake\.args = \[/,/\]/{ |
| 68 | + s|"-DPYTHON_BUILD_SETUP=ON"|"-DPYTHON_BUILD_SETUP=ON",\ |
| 69 | + "-DHIPO=ON",\ |
| 70 | + "-DBUILD_OPENBLAS=ON"| |
| 71 | + }' pyproject.toml |
| 72 | + echo "--- pyproject.toml content after Linux edit ---" |
| 73 | + cat pyproject.toml |
| 74 | +
|
| 75 | + - name: Edit pyproject.toml (Windows) |
| 76 | + if: runner.os == 'Windows' |
| 77 | + shell: pwsh |
| 78 | + run: | |
| 79 | + $filePath = "pyproject.toml" |
| 80 | + $newContent = 'cmake.args = [ |
| 81 | + "-DPYTHON_BUILD_SETUP=ON", |
| 82 | + "-DHIPO=ON", |
| 83 | + "-DBUILD_OPENBLAS=ON" |
| 84 | + ]' |
| 85 | +
|
| 86 | + # Read file, replace the block, and write back |
| 87 | + $fileContent = Get-Content $filePath -Raw |
| 88 | + $regex = "(?s)cmake\.args = \[\s*?\"-DPYTHON_BUILD_SETUP=ON\".*?\]" |
| 89 | + $updatedContent = $fileContent -replace $regex, $newContent |
| 90 | +
|
| 91 | + $updatedContent | Set-Content $filePath |
| 92 | +
|
| 93 | + echo "--- pyproject.toml content after Windows edit ---" |
| 94 | + Get-Content $filePath |
| 95 | +
|
49 | 96 | - name: Build wheels |
50 | 97 | |
51 | 98 | env: |
|
0 commit comments