mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-07-31 10:52:50 +08:00
Summary: Update all FB license strings to the new format. Reviewed By: patricklabatut Differential Revision: D33403538 fbshipit-source-id: 97a4596c5c888f3c54f44456dc07e718a387a02c
47 lines
1.4 KiB
Bash
Executable File
47 lines
1.4 KiB
Bash
Executable File
#!/bin/bash -e
|
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the BSD-style license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
# Run this script at project root by "./dev/linter.sh" before you commit
|
|
|
|
{
|
|
V=$(black --version|cut '-d ' -f3)
|
|
code='import distutils.version; assert "19.3" < distutils.version.LooseVersion("'$V'")'
|
|
PYTHON=false
|
|
command -v python > /dev/null && PYTHON=python
|
|
command -v python3 > /dev/null && PYTHON=python3
|
|
${PYTHON} -c "${code}" 2> /dev/null
|
|
} || {
|
|
echo "Linter requires black 19.3b0 or higher!"
|
|
exit 1
|
|
}
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
DIR=$(dirname "${DIR}")
|
|
|
|
echo "Running isort..."
|
|
isort -y -sp "${DIR}"
|
|
|
|
echo "Running black..."
|
|
black "${DIR}"
|
|
|
|
echo "Running flake..."
|
|
flake8 "${DIR}" || true
|
|
|
|
echo "Running clang-format ..."
|
|
clangformat=$(command -v clang-format-8 || echo clang-format)
|
|
find "${DIR}" -regex ".*\.\(cpp\|c\|cc\|cu\|cuh\|cxx\|h\|hh\|hpp\|hxx\|tcc\|mm\|m\)" -print0 | xargs -0 "${clangformat}" -i
|
|
|
|
# Run arc and pyre internally only.
|
|
if [[ -f "${DIR}/tests/TARGETS" ]]
|
|
then
|
|
(cd "${DIR}"; command -v arc > /dev/null && arc lint) || true
|
|
|
|
echo "Running pyre..."
|
|
echo "To restart/kill pyre server, run 'pyre restart' or 'pyre kill' in fbcode/"
|
|
( cd ~/fbsource/fbcode; pyre -l vision/fair/pytorch3d/ )
|
|
fi
|