PYTHON-1834 Add shellcheck (#858)
This commit is contained in:
parent
c47557bc63
commit
0700a84432
@ -27,7 +27,7 @@ fi
|
||||
|
||||
for image in "${images[@]}"; do
|
||||
docker pull $image
|
||||
docker run --rm -v `pwd`:/src $image /src/.evergreen/build-manylinux-internal.sh
|
||||
docker run --rm -v "`pwd`:/src" $image /src/.evergreen/build-manylinux-internal.sh
|
||||
done
|
||||
|
||||
ls dist
|
||||
|
||||
@ -9,8 +9,8 @@ mkdir -p validdist
|
||||
mv dist/* validdist || true
|
||||
|
||||
for VERSION in 36 37 38 39 310; do
|
||||
_pythons=(C:/Python/Python${VERSION}/python.exe \
|
||||
C:/Python/32/Python${VERSION}/python.exe)
|
||||
_pythons=("C:/Python/Python${VERSION}/python.exe" \
|
||||
"C:/Python/32/Python${VERSION}/python.exe")
|
||||
for PYTHON in "${_pythons[@]}"; do
|
||||
rm -rf build
|
||||
$PYTHON setup.py bdist_wheel
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
if [ $(uname -s) = "Darwin" ]; then
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
.evergreen/build-mac.sh
|
||||
elif [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
|
||||
.evergreen/build-windows.sh
|
||||
|
||||
@ -23,7 +23,7 @@ export PYTHONHOME=/opt/python/$PYTHON_VERSION
|
||||
|
||||
cd ..
|
||||
$APACHE -k start -f ${PROJECT_DIRECTORY}/test/mod_wsgi_test/${APACHE_CONFIG}
|
||||
trap "$APACHE -k stop -f ${PROJECT_DIRECTORY}/test/mod_wsgi_test/${APACHE_CONFIG}" EXIT HUP
|
||||
trap '$APACHE -k stop -f ${PROJECT_DIRECTORY}/test/mod_wsgi_test/${APACHE_CONFIG}' EXIT HUP
|
||||
|
||||
set +e
|
||||
wget -t 1 -T 10 -O - "http://localhost:8080${PROJECT_DIRECTORY}"
|
||||
|
||||
@ -40,7 +40,7 @@ fi
|
||||
set -x
|
||||
|
||||
# Workaround macOS python 3.9 incompatibility with system virtualenv.
|
||||
if [ $(uname -s) = "Darwin" ]; then
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
VIRTUALENV="/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -m virtualenv"
|
||||
else
|
||||
VIRTUALENV=$(command -v virtualenv)
|
||||
|
||||
@ -67,9 +67,9 @@ fi
|
||||
if [ -z "$PYTHON_BINARY" ]; then
|
||||
# Use Python 3 from the server toolchain to test on ARM, POWER or zSeries if a
|
||||
# system python3 doesn't exist or exists but is older than 3.6.
|
||||
if is_python_36 $(command -v python3); then
|
||||
if is_python_36 "$(command -v python3)"; then
|
||||
PYTHON=$(command -v python3)
|
||||
elif is_python_36 $(command -v /opt/mongodbtoolchain/v2/bin/python3); then
|
||||
elif is_python_36 "$(command -v /opt/mongodbtoolchain/v2/bin/python3)"; then
|
||||
PYTHON=$(command -v /opt/mongodbtoolchain/v2/bin/python3)
|
||||
else
|
||||
echo "Cannot test without python3.6+ installed!"
|
||||
@ -119,20 +119,21 @@ if [ -n "$TEST_ENCRYPTION" ]; then
|
||||
# Use the nocrypto build to avoid dependency issues with older windows/python versions.
|
||||
BASE=$(pwd)/libmongocrypt/nocrypto
|
||||
if [ -f "${BASE}/lib/libmongocrypt.so" ]; then
|
||||
export PYMONGOCRYPT_LIB=${BASE}/lib/libmongocrypt.so
|
||||
PYMONGOCRYPT_LIB=${BASE}/lib/libmongocrypt.so
|
||||
elif [ -f "${BASE}/lib/libmongocrypt.dylib" ]; then
|
||||
export PYMONGOCRYPT_LIB=${BASE}/lib/libmongocrypt.dylib
|
||||
PYMONGOCRYPT_LIB=${BASE}/lib/libmongocrypt.dylib
|
||||
elif [ -f "${BASE}/bin/mongocrypt.dll" ]; then
|
||||
PYMONGOCRYPT_LIB=${BASE}/bin/mongocrypt.dll
|
||||
# libmongocrypt's windows dll is not marked executable.
|
||||
chmod +x $PYMONGOCRYPT_LIB
|
||||
export PYMONGOCRYPT_LIB=$(cygpath -m $PYMONGOCRYPT_LIB)
|
||||
PYMONGOCRYPT_LIB=$(cygpath -m $PYMONGOCRYPT_LIB)
|
||||
elif [ -f "${BASE}/lib64/libmongocrypt.so" ]; then
|
||||
export PYMONGOCRYPT_LIB=${BASE}/lib64/libmongocrypt.so
|
||||
PYMONGOCRYPT_LIB=${BASE}/lib64/libmongocrypt.so
|
||||
else
|
||||
echo "Cannot find libmongocrypt shared object file"
|
||||
exit 1
|
||||
fi
|
||||
export PYMONGOCRYPT_LIB
|
||||
|
||||
# TODO: Test with 'pip install pymongocrypt'
|
||||
git clone --branch master https://github.com/mongodb/libmongocrypt.git libmongocrypt_git
|
||||
@ -175,7 +176,7 @@ $PYTHON -c 'import sys; print(sys.version)'
|
||||
# Only cover CPython. PyPy reports suspiciously low coverage.
|
||||
PYTHON_IMPL=$($PYTHON -c "import platform; print(platform.python_implementation())")
|
||||
COVERAGE_ARGS=""
|
||||
if [ -n "$COVERAGE" -a $PYTHON_IMPL = "CPython" ]; then
|
||||
if [ -n "$COVERAGE" ] && [ "$PYTHON_IMPL" = "CPython" ]; then
|
||||
if $PYTHON -m coverage --version; then
|
||||
echo "INFO: coverage is installed, running tests with coverage..."
|
||||
COVERAGE_ARGS="-m coverage run --branch"
|
||||
@ -186,7 +187,7 @@ fi
|
||||
|
||||
$PYTHON setup.py clean
|
||||
if [ -z "$GREEN_FRAMEWORK" ]; then
|
||||
if [ -z "$C_EXTENSIONS" -a $PYTHON_IMPL = "CPython" ]; then
|
||||
if [ -z "$C_EXTENSIONS" ] && [ "$PYTHON_IMPL" = "CPython" ]; then
|
||||
# Fail if the C extensions fail to build.
|
||||
|
||||
# This always sets 0 for exit status, even if the build fails, due
|
||||
|
||||
@ -29,3 +29,12 @@ repos:
|
||||
- id: isort
|
||||
files: \.py$
|
||||
args: [--profile=black]
|
||||
|
||||
# We use the Python version instead of the original version which seems to require Docker
|
||||
# https://github.com/koalaman/shellcheck-precommit
|
||||
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||
rev: v0.8.0.1
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
name: shellcheck
|
||||
args: ["--severity=warning"]
|
||||
|
||||
@ -8,6 +8,7 @@ version: 2
|
||||
# Build documentation in the doc/ directory with Sphinx
|
||||
sphinx:
|
||||
configuration: doc/conf.py
|
||||
fail_on_warning: true
|
||||
|
||||
# Set the version of Python and requirements required to build the docs.
|
||||
python:
|
||||
|
||||
@ -21,6 +21,7 @@ extensions = [
|
||||
"sphinx.ext.coverage",
|
||||
"sphinx.ext.todo",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinxcontrib.shellcheck",
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
Sphinx~=4.2
|
||||
sphinx_rtd_theme~=0.5
|
||||
readthedocs-sphinx-search~=0.1
|
||||
sphinxcontrib-shellcheck~=1.1
|
||||
|
||||
@ -2947,7 +2947,7 @@ class Collection(common.BaseObject, Generic[_DocumentType]):
|
||||
as keyword arguments (for example maxTimeMS can be used with
|
||||
recent server versions).
|
||||
|
||||
|
||||
.. versionchanged:: 4.1
|
||||
Added ``let`` parameter.
|
||||
.. versionchanged:: 3.11
|
||||
Added the ``hint`` option.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user