Skip to content

Commit 0661304

Browse files
committed
fix(ci): correctly patch sdist for altered names
1 parent 4d6d885 commit 0661304

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

ci/scripts/patch_artifacts_if_distribution_name_is_altered.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ if [ -n "$artifacts" ] && [ -n "$DISTRIBUTION_NAME" ] && [ "$DISTRIBUTION_NAME"
1616
(cd "$TMP" && zip -qr "$ARTIFACT_PATH" .)
1717
else
1818
tar -xzf "$ARTIFACT_PATH" -C "$TMP"
19-
PKGDIR=$(find "$TMP" -maxdepth 1 -type d -name "*.egg-info" -o -name "*" -type d | grep -v "^\.$")
20-
echo "$injection_string" >> "$PKGDIR/PKG-INFO"
21-
(cd "$TMP" && tar -czf "$ARTIFACT_PATH" .)
19+
PKG_INFO_FILE=$(find "$TMP" -type f -name "PKG-INFO")
20+
echo "$injection_string" >> "$PKG_INFO_FILE"
21+
22+
# Get the top-level directory to repack correctly
23+
PKGDIR=$(find "$TMP" -mindepth 1 -maxdepth 1 -type d)
24+
(cd "$TMP" && tar -czf "$ARTIFACT_PATH" "$(basename "$PKGDIR")")
2225
fi
2326
echo "($injection_string): patched $ARTIFACT_PATH"
2427
rm -rf "$TMP"

0 commit comments

Comments
 (0)