view contrib/setup-pytype.sh @ 51626:865efc020c33 default tip

dirstate: remove the python-side whitelist of allowed matchers This whitelist is too permissive because it allows matchers that contain disallowed ones deep inside, for example through `intersectionmatcher`. It is also too restrictive because it doesn't pass through some of the matchers we support, such as `patternmatcher`. It's also unnecessary because unsupported matchers raise `FallbackError` and we fall back anyway. Making this change makes more of the tests use rust code path, and therefore subtly change behavior. For example, rust status in largefiles repos seems to have strange behavior.
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Fri, 26 Apr 2024 19:10:35 +0100
parents 03792c1ed341
children
line wrap: on
line source

#!/bin/bash

set -e
set -u

# Find the python3 setup that would run pytype
PYTYPE=`which pytype`
PYTHON3=`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