xref: /aosp_15_r20/external/pytorch/.ci/docker/common/install_linter.sh (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1#!/bin/bash
2
3set -ex
4
5source "$(dirname "${BASH_SOURCE[0]}")/common_utils.sh"
6
7if [ -n "${UBUNTU_VERSION}" ]; then
8  apt update
9  apt-get install -y clang doxygen git graphviz nodejs npm libtinfo5
10fi
11
12# Do shallow clone of PyTorch so that we can init lintrunner in Docker build context
13git clone https://github.com/pytorch/pytorch.git --depth 1
14chown -R jenkins pytorch
15
16pushd pytorch
17# Install all linter dependencies
18pip_install -r requirements.txt
19conda_run lintrunner init
20
21# Cache .lintbin directory as part of the Docker image
22cp -r .lintbin /tmp
23popd
24
25# Node dependencies required by toc linter job
26npm install -g markdown-toc
27
28# Cleaning up
29rm -rf pytorch
30