#!/bin/sh
#
# Script for packaging for Zenodo, including custom dependencies.
# Needs toml-cli; install it with cargo install toml-cli
#

version=$(toml get -r Project.toml version)
name="PredictPDPS-$version"
dir="$TMPDIR/$name"

hg archive "$dir"
hg archive -R ../ImageTools "$dir/ImageTools"
hg archive -R ../AlgTools "$dir/AlgTools"
perl -p -i -e 's:../(ImageTools|AlgTools):$1:' "$dir/Manifest.toml"

# Something creates .DS_Store files although they are not in the repo,
# so need to explicitly exclude them.
tar  cz --exclude .DS_Store -C "$TMPDIR" -f $name.tar.gz $name
