Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pypi_dist/
58 changes: 58 additions & 0 deletions admin/build_pypi_packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash
set -e

TAG=develop
if [ "$1" != "" ]; then
TAG=$1
fi

cd $(dirname $(readlink -f $0))

if ! ../venv/bin/twine -h > /dev/null 2> /dev/null; then
echo "Did not find twine. Please run ../venv/bin/pip install twine"
exit 1
fi

if [[ -n $(git status -s) ]]; then
echo "Repository is dirty."
git status -s
exit 1
fi

if [[ $(git rev-parse --abbrev-ref HEAD) != ${TAG} && $(git describe --exact-match --tags 2>/dev/null) != ${TAG} ]]; then
echo "Repository is currently not on branch/tag ${TAG}."
exit 1
fi

echo "Building sdist and manylinux wheel"
sudo rm -rf ./pypi_dist
docker run --rm -v $(pwd)/..:/problemtools -v $(pwd)/pypi_dist:/dist quay.io/pypa/manylinux_2_28_x86_64 /bin/bash -c "
yum -y install boost-devel gmp-devel ;
mkdir /build ;
cd /build ;
git config --global --add safe.directory /problemtools/.git ;
git clone /problemtools ;
cd problemtools ;
git checkout ${TAG} ;
/opt/python/cp311-cp311/bin/python -m build ;
auditwheel repair dist/problemtools-*.whl ;
cp dist/*.tar.gz /dist ;
cp wheelhouse/*.whl /dist"
sudo chown -R $USER:$USER pypi_dist

../venv/bin/twine check pypi_dist/*

echo "Running verifyproblem from wheel on all examples"
TEMPDIR=$(mktemp -d)
python3 -m venv "${TEMPDIR}"
"${TEMPDIR}/bin/pip" install pypi_dist/problemtools*manylinux*whl
shopt -s extglob
if ! "${TEMPDIR}/bin/verifyproblem" ../examples/!(README.md); then
echo "Running verifyproblem on all examples failed. Please review output above to debug."
rm -rf "${TEMPDIR}"
exit 1
fi
rm -rf "${TEMPDIR}"

echo "Sucessfully built packages. If you're happy with them, upload:"
echo " ../venv/bin/twine upload --verbose pypi_dist/*"
Empty file added problemtools/py.typed
Empty file.
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ build-backend = "setuptools.build_meta"
[project]
name = "problemtools"
authors = [
{name = "Fredrik Niemela", email = "niemela@kattis.com"},
{name = "Gunnar Kreitz", email = "gkreitz@kattis.com"},
{name = "Mikael Goldman", email = "migo@kattis.com"},
{name = "Pehr Söderman", email = "pehrs@kattis.com"},
{name = "Per Austrin", email = "austrin@kattis.com"},
{name = "Kattis AB", email = "contact@kattis.com"},
]
description = "Kattis Problem Tools"
readme = "README.md"
license = "MIT"
keywords = ["kattis", "problemtools", "icpc", "clics"]
requires-python = ">= 3.11"

dependencies = [
"colorlog",
Expand Down Expand Up @@ -44,6 +41,7 @@ include = ["problemtools", "problemtools.*"]

[tool.setuptools_scm]
version_file = "problemtools/_version.py"
local_scheme = "no-local-version"

[tool.ruff]
line-length = 130
Expand Down