HWI/contrib/generate_setup.sh
Andrew Chow 77257a18da Add build scripts and documentation for building releases
Adds builds scripts that are used to build releases deterministically.
Also adds documentation that explains the release process and what
the build scripts do.
2019-03-08 00:17:33 -05:00

33 lines
570 B
Bash
Executable File

#! /bin/bash
# Generates the setup.py file
set -e
# Setup poetry and install the dependencies
poetry install
# Build the source distribution
poetry build -f sdist
# Extract setup.py from the distribution
unset -v tarball
for file in dist/*
do
if [[ $file -nt $tarball && $file == *".tar.gz" ]]
then
tarball=$file
fi
done
unset -v toextract
for file in `tar -tf $tarball`
do
if [[ $file == *"setup.py" ]]
then
toextract=$file
fi
done
tar -xf $tarball $toextract
mv $toextract .
dir=`echo $toextract | cut -f1 -d"/"`
rm -r $dir