#!/bin/bash

# DEST=${1:-/etc/skel}
DEST=${HOME}

ANTHROPIC_API_KEY="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"

# PLugins that Use ANTHROPIC_API_KEYs get called early so so we need to put them
# in .zshrc.pre-plugins.d so they can be loaded before the plugins are loaded.
cat <<-EOF | sudo tee "${DEST}"/.zshrc.pre-plugins.d/009_anthropic.zsh
	export ANTHROPIC_API_KEY="${ANTHROPIC_API_KEY}"
EOF

git_url="${1:-https://github.com/anthropics/anthropic-sdk-python}"

# the dependencies for the python package
sudo apt-get install python3-tifffile python3-sklearn

sudo apt-get -f install

# the dependencies for py2dsp
sudo apt-get install -f pristine-tar pypi2deb

py2dsp --profile dpt --distribution unstable --revision 1 --github "${git_url}"

# if the build fails with 'unrecognized build system: pybuild' add
# export PYBUILD_SYSTEM=distutils
# to the debian/rules file.

pushd ./result/anthropic-* || exit
dpkg-buildpackage -us -uc -b
popd || return

sudo dpkg -i result/python3-anthropic_*.deb

sudo apt-get -f install
