forked from davestgermain/aionostr
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmake_sdist.sh
executable file
·38 lines (28 loc) · 1 KB
/
make_sdist.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
set -e
PROJECT_ROOT="$(dirname "$(readlink -e "$0")")/../.."
CONTRIB="$PROJECT_ROOT/contrib"
CONTRIB_SDIST="$CONTRIB/sdist"
BUILDDIR="$CONTRIB_SDIST/build"
DISTDIR="$PROJECT_ROOT/dist"
cd "$PROJECT_ROOT"
rm -rf "$BUILDDIR"
mkdir -p "$BUILDDIR" "$DISTDIR"
git_status=$(git status --porcelain)
if [ ! -z "$git_status" ]; then
echo "$git_status"
echo "git repo not clean, aborting"
exit 1
fi
cd "$PROJECT_ROOT"
python3 -m build --sdist . --outdir "$BUILDDIR/dist1"
# the initial tar.gz is not reproducible, see https://github.com/pypa/setuptools/issues/2133
# so we untar, fix timestamps, and then re-tar
DISTNAME=$(find "$BUILDDIR/dist1/" -type f -name 'electrum_aionostr-*.tar.gz' -printf "%f\\n")
DIST_BASENAME=$(basename --suffix ".tar.gz" "$DISTNAME")
mkdir -p "$BUILDDIR/dist2"
cd "$BUILDDIR/dist2"
tar -xzf "$BUILDDIR/dist1/$DISTNAME"
find -exec touch -h -d '2000-11-11T11:11:11+00:00' {} +
GZIP=-n tar --sort=name -czf "$DISTNAME" "$DIST_BASENAME/"
mv "$DISTNAME" "$DISTDIR/$DISTNAME"