#!/usr/bin/env bash
#
# Script to prepare an sdist tarball for a package
# This script is not used during build.
#
# HOW TO MAKE THE TARBALL:
#
#   make python_build && ./sage --sh build/pkgs/SPKG/spkg-src
#
# or, equivalently:
#
#   make SPKG-sdist

if [ -z "$SAGE_ROOT" ] ; then
    echo >&2 "Error - SAGE_ROOT undefined ... exiting"
    echo >&2 "Maybe run 'sage -sh'?"
    exit 1
fi

# Exit on failure
set -e

cd $(dirname $0)

cd src

# Get rid of old *.egg-info/SOURCES.txt
rm -Rf *.egg-info

python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES"
