Skip to content

Commit cae4199

Browse files
authored
Merge pull request #323 from gkreitz/pypi_preparation
Pypi preparation
2 parents 5b039f1 + 8418e70 commit cae4199

File tree

4 files changed

+62
-5
lines changed

4 files changed

+62
-5
lines changed

admin/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pypi_dist/

admin/build_pypi_packages.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
set -e
3+
4+
TAG=develop
5+
if [ "$1" != "" ]; then
6+
TAG=$1
7+
fi
8+
9+
cd $(dirname $(readlink -f $0))
10+
11+
if ! ../venv/bin/twine -h > /dev/null 2> /dev/null; then
12+
echo "Did not find twine. Please run ../venv/bin/pip install twine"
13+
exit 1
14+
fi
15+
16+
if [[ -n $(git status -s) ]]; then
17+
echo "Repository is dirty."
18+
git status -s
19+
exit 1
20+
fi
21+
22+
if [[ $(git rev-parse --abbrev-ref HEAD) != ${TAG} && $(git describe --exact-match --tags 2>/dev/null) != ${TAG} ]]; then
23+
echo "Repository is currently not on branch/tag ${TAG}."
24+
exit 1
25+
fi
26+
27+
echo "Building sdist and manylinux wheel"
28+
sudo rm -rf ./pypi_dist
29+
docker run --rm -v $(pwd)/..:/problemtools -v $(pwd)/pypi_dist:/dist quay.io/pypa/manylinux_2_28_x86_64 /bin/bash -c "
30+
yum -y install boost-devel gmp-devel ;
31+
mkdir /build ;
32+
cd /build ;
33+
git config --global --add safe.directory /problemtools/.git ;
34+
git clone /problemtools ;
35+
cd problemtools ;
36+
git checkout ${TAG} ;
37+
/opt/python/cp311-cp311/bin/python -m build ;
38+
auditwheel repair dist/problemtools-*.whl ;
39+
cp dist/*.tar.gz /dist ;
40+
cp wheelhouse/*.whl /dist"
41+
sudo chown -R $USER:$USER pypi_dist
42+
43+
../venv/bin/twine check pypi_dist/*
44+
45+
echo "Running verifyproblem from wheel on all examples"
46+
TEMPDIR=$(mktemp -d)
47+
python3 -m venv "${TEMPDIR}"
48+
"${TEMPDIR}/bin/pip" install pypi_dist/problemtools*manylinux*whl
49+
shopt -s extglob
50+
if ! "${TEMPDIR}/bin/verifyproblem" ../examples/!(README.md); then
51+
echo "Running verifyproblem on all examples failed. Please review output above to debug."
52+
rm -rf "${TEMPDIR}"
53+
exit 1
54+
fi
55+
rm -rf "${TEMPDIR}"
56+
57+
echo "Sucessfully built packages. If you're happy with them, upload:"
58+
echo " ../venv/bin/twine upload --verbose pypi_dist/*"

problemtools/py.typed

Whitespace-only changes.

pyproject.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@ build-backend = "setuptools.build_meta"
55
[project]
66
name = "problemtools"
77
authors = [
8-
{name = "Fredrik Niemela", email = "niemela@kattis.com"},
9-
{name = "Gunnar Kreitz", email = "gkreitz@kattis.com"},
10-
{name = "Mikael Goldman", email = "migo@kattis.com"},
11-
{name = "Pehr Söderman", email = "pehrs@kattis.com"},
12-
{name = "Per Austrin", email = "austrin@kattis.com"},
8+
{name = "Kattis AB", email = "contact@kattis.com"},
139
]
1410
description = "Kattis Problem Tools"
1511
readme = "README.md"
1612
license = "MIT"
1713
keywords = ["kattis", "problemtools", "icpc", "clics"]
14+
requires-python = ">= 3.11"
1815

1916
dependencies = [
2017
"colorlog",
@@ -44,6 +41,7 @@ include = ["problemtools", "problemtools.*"]
4441

4542
[tool.setuptools_scm]
4643
version_file = "problemtools/_version.py"
44+
local_scheme = "no-local-version"
4745

4846
[tool.ruff]
4947
line-length = 130

0 commit comments

Comments
 (0)