#!/bin/bash
set -e

git clone https://github.com/python-restx/flask-restx opengnsys-flask-restx
cd opengnsys-flask-restx
git checkout 1.3.0
version=`python3 ./setup.py --version`
cd ..

if [ -d "opengnsys-flask-restx-${version}" ] ; then
	echo "Directory opengnsys-flask-restx-${version} already exists, won't overwrite"
	exit 1
else
	rm -rf opengnsys-flask-restx/.git
	mv opengnsys-flask-restx "opengnsys-flask-restx-${version}"
	tar -c --xz -v -f "opengnsys-flask-restx_${version}.orig.tar.xz" "opengnsys-flask-restx-${version}"
fi

