contrib/setup-pytype.sh
author Pierre-Yves David <pierre-yves.david@octobus.net>
Sun, 27 Oct 2024 14:10:45 +0100
branchstable
changeset 52150 c99cbb02a82e
parent 51711 832a1aeb576f
permissions -rwxr-xr-x
ci: split the jobs on more stage We start to have a lot of job, grouping them help to clarifying the pipeline. We don't actually create dependency between each stage, so everything still run concurrently. However we are about to introduce some wheel-building job that will be reused by some tests. So some dependencies are coming.

#!/bin/bash

set -e
set -u

# Find the python3 setup that would run pytype
PYTYPE=`which pytype`
PYTHON3=${PYTHON:-`head -n1 ${PYTYPE} | sed -s 's/#!//'`}

# Existing stubs that pytype processes live here
TYPESHED=$(${PYTHON3} -c "import pytype; print(pytype.__path__[0])")/typeshed/stubs
HG_STUBS=${TYPESHED}/mercurial

echo "Patching typeshed at $HG_STUBS"

rm -rf ${HG_STUBS}
mkdir -p ${HG_STUBS}

cat > ${HG_STUBS}/METADATA.toml <<EOF
version = "0.1"
EOF


mkdir -p ${HG_STUBS}/mercurial/cext ${HG_STUBS}/mercurial/thirdparty/attr

touch ${HG_STUBS}/mercurial/__init__.pyi
touch ${HG_STUBS}/mercurial/cext/__init__.pyi
touch ${HG_STUBS}/mercurial/thirdparty/__init__.pyi

ln -sf $(hg root)/mercurial/cext/*.{pyi,typed} \
       ${HG_STUBS}/mercurial/cext
ln -sf $(hg root)/mercurial/thirdparty/attr/*.{pyi,typed} \
       ${HG_STUBS}/mercurial/thirdparty/attr