Skip to content

Commit f6bc95b

Browse files
committed
feat(Makefile): install clang-format and clang-tidy from PyPI
1 parent d81999c commit f6bc95b

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

.github/workflows/lint.yml

-6
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,6 @@ jobs:
9898
9999
- name: clang-format
100100
run: |
101-
(
102-
source /etc/os-release
103-
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
104-
sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME} llvm-toolchain-${UBUNTU_CODENAME} main" --yes
105-
)
106-
sudo apt-get update && sudo apt-get install clang-format --yes
107101
make clang-format
108102
109103
- name: addlicense

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ FROM builder AS devel-builder
4848

4949
# Install extra dependencies
5050
RUN sudo apt-get update && \
51-
sudo apt-get install -y golang clang-format clang-tidy && \
51+
sudo apt-get install -y golang && \
5252
sudo chown -R "$(whoami):$(whoami)" "$(realpath /usr/lib/go)" && \
5353
sudo rm -rf /var/lib/apt/lists/*
5454

Makefile

+4-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ CUDA_FILES = $(shell find $(SOURCE_FOLDERS) -type f -name "*.cuh" -o -name "
1010
COMMIT_HASH = $(shell git log -1 --format=%h)
1111
PATH := $(HOME)/go/bin:$(PATH)
1212
PYTHON ?= $(shell command -v python3 || command -v python)
13-
CLANG_FORMAT ?= $(shell command -v clang-format-17 || command -v clang-format)
1413
PYTESTOPTS ?=
1514

1615
.PHONY: default
@@ -96,12 +95,10 @@ cpplint-install:
9695
$(call check_pip_install,cpplint)
9796

9897
clang-format-install:
99-
command -v clang-format-17 || command -v clang-format || \
100-
sudo apt-get install -y clang-format-17 || \
101-
sudo apt-get install -y clang-format
98+
$(call check_pip_install,clang-format)
10299

103100
clang-tidy-install:
104-
command -v clang-tidy || sudo apt-get install -y clang-tidy
101+
$(call check_pip_install,clang-tidy)
105102

106103
go-install:
107104
# requires go >= 1.16
@@ -172,8 +169,8 @@ cpplint: cpplint-install
172169
$(PYTHON) -m cpplint $(CXX_FILES) $(CUDA_FILES)
173170

174171
clang-format: clang-format-install
175-
$(CLANG_FORMAT) --version
176-
$(CLANG_FORMAT) --style=file -i $(CXX_FILES) $(CUDA_FILES) -n --Werror
172+
clang-format --version
173+
clang-format --style=file -i $(CXX_FILES) $(CUDA_FILES) -n --Werror
177174

178175
clang-tidy: clang-tidy-install cmake-configure
179176
clang-tidy --version

tests/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ doc8
2626
pydocstyle[toml]
2727
pyenchant
2828
cpplint
29+
clang-format
30+
clang-tidy
2931
pre-commit

0 commit comments

Comments
 (0)