Skip to content

Commit 23df84e

Browse files
Bump cpp-linter/clang-tools-static-binaries to master-6e612956 (#124)
* chore: bump clang-tools-static-binaries to master-6e612956 * chore: drop v8 and add v21 * feat: add noxfile.py and docs * fix: remove tag * fix: cleanup --------- Co-authored-by: shenxianpeng <[email protected]> Co-authored-by: shenxianpeng <[email protected]>
1 parent c657f83 commit 23df84e

17 files changed

+85
-31
lines changed

.github/workflows/bump-version.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
bump_version:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v5
12+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5
1313

1414
- name: Set up Python
15-
uses: actions/setup-python@v5
15+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 #v5
1616
with:
1717
python-version: '3.x'
1818

@@ -34,7 +34,7 @@ jobs:
3434
fi
3535
3636
- name: Create Pull Request
37-
uses: peter-evans/create-pull-request@v7
37+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e #v7
3838
with:
3939
add-paths: "clang_tools/__init__.py"
4040
commit-message: "chore: bump clang-tools-static-binaries to ${{ steps.bump.outputs.bump_tag }}"

.github/workflows/python-test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727
fail-fast: false
2828
runs-on: ${{ matrix.os }}
2929
steps:
30-
- uses: actions/checkout@v5
30+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5
3131

3232
- name: Set up Python 3.10
33-
uses: actions/setup-python@v5
33+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 #v5
3434
with:
3535
python-version: "3.10"
3636

@@ -60,15 +60,15 @@ jobs:
6060
- uses: actions/checkout@v5
6161

6262
- name: Set up Python 3.10
63-
uses: actions/setup-python@v5
63+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 #v5
6464
with:
6565
python-version: "3.10"
6666

6767
- name: Build wheel
6868
run: python -m pip wheel -w dist .
6969

7070
- name: Upload wheel as artifact
71-
uses: actions/upload-artifact@v4
71+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4
7272
with:
7373
name: clang-tools-pip_wheel
7474
path: dist/*.whl
@@ -77,18 +77,18 @@ jobs:
7777
needs: [build]
7878
strategy:
7979
matrix:
80-
version: [ 8, 9, 10, 11, 12, 12.0.1, 13, 14, 15, 16, 17, 18, 19, 20 ]
80+
version: [ 9, 10, 11, 12, 12.0.1, 13, 14, 15, 16, 17, 18, 19, 20, 21 ]
8181
os: [ ubuntu-latest, macos-13, windows-latest ]
8282
fail-fast: false
8383
runs-on: ${{ matrix.os }}
8484
steps:
8585
- name: Set up Python 3.10
86-
uses: actions/setup-python@v5
86+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 #v5
8787
with:
8888
python-version: "3.10"
8989

9090
- name: Download wheel artifact
91-
uses: actions/download-artifact@v5
91+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 #v5
9292
with:
9393
name: clang-tools-pip_wheel
9494
path: dist/
@@ -121,7 +121,7 @@ jobs:
121121
shell: bash
122122
run: |
123123
case "${{ matrix.version }}" in
124-
15|16|18|20)
124+
15|16|18|20|21)
125125
clang-format.exe --version
126126
clang-tidy.exe --version
127127
clang-query.exe --version

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*build
33
clang_tools.egg-info
44
clang_tools/__pycache__
5+
__pycache__
56
dist
67
clang_tools/llvm-project*
78
.coverage*

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Supported versions
132132
clang-format, clang-tidy, clang-query, clang-apply-replacements
133133
***************************************************************
134134
.. csv-table::
135-
:header: "Version", "20", "19", "18", "17", "16", "15", "14", "13", "12", "11", "10", "9", "8"
135+
:header: "Version", "21", "20", "19", "18", "17", "16", "15", "14", "13", "12", "11", "10", "9"
136136
:stub-columns: 1
137137

138138
Linux,✔️,✔️,✔️,✔️,✔️,✔️,✔️,✔️,✔️,✔️,✔️,✔️,✔️

clang_tools/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""The clang-tools package's base module."""
22

3+
import os
34
from .util import check_install_os
45

56

@@ -8,5 +9,7 @@
89
install_os = check_install_os()
910
suffix = ".exe" if install_os == "windows" else ""
1011

11-
# tag of https://github.com/cpp-linter/clang-tools-static-binaries/releases
12-
release_tag = "master-b35c5633"
12+
binary_repo = os.getenv(
13+
"CLANG_TOOLS_REPO", "https://github.com/cpp-linter/clang-tools-static-binaries"
14+
)
15+
binary_tag = os.getenv("CLANG_TOOLS_TAG", "master-6e612956")

clang_tools/install.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import sys
1414
from typing import Optional, cast
1515

16-
from . import release_tag, install_os, RESET_COLOR, suffix, YELLOW
16+
from . import binary_repo, binary_tag, install_os, RESET_COLOR, suffix, YELLOW
1717
from .util import download_file, verify_sha512, get_sha_checksum, Version
1818

1919

@@ -63,7 +63,7 @@ def is_installed(tool_name: str, version: Version) -> Optional[Path]:
6363
return path
6464

6565

66-
def clang_tools_binary_url(tool: str, version: str, tag: str = release_tag) -> str:
66+
def clang_tools_binary_url(tool: str, version: str) -> str:
6767
"""Assemble the URL to the binary.
6868
6969
:param tool: The name of the tool to download.
@@ -72,10 +72,7 @@ def clang_tools_binary_url(tool: str, version: str, tag: str = release_tag) -> s
7272
7373
:returns: The URL used to download the specified tool.
7474
"""
75-
base_url = (
76-
"https://github.com/cpp-linter/clang-tools-static-binaries/releases/download/"
77-
+ tag
78-
)
75+
base_url = f"{binary_repo}/releases/download/" + binary_tag
7976
download_url = f"{base_url}/{tool}-{version}_{install_os}-amd64{suffix}"
8077
return download_url.replace(" ", "")
8178

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
self
77

8+
usage
9+
810
.. toctree::
911
:hidden:
1012

docs/usage.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Using a Custom Binary Repository
2+
--------------------------------
3+
4+
You can override the default source for downloading **clang-tools** by setting the following environment variables:
5+
6+
- ``CLANG_TOOLS_REPO`` – The URL of the binary repository
7+
(default: ``https://github.com/cpp-linter/clang-tools-static-binaries``)
8+
- ``CLANG_TOOLS_TAG`` – The release tag to download binaries from
9+
(default: ``master-6e612956``)
10+
11+
**Example:**
12+
13+
If you want to use the repository at
14+
``https://github.com/muttleyxd/clang-tools-static-binaries``,
15+
configure your environment like this:
16+
17+
.. code-block:: bash
18+
19+
export CLANG_TOOLS_REPO=https://github.com/muttleyxd/clang-tools-static-binaries
20+
export CLANG_TOOLS_TAG=master-6e612956 # Replace with the tag you need

noxfile.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import nox
2+
3+
4+
@nox.session
5+
def lint(session: nox.Session) -> None:
6+
"""Run linter"""
7+
session.install("pre-commit")
8+
session.run("pre-commit", "run", "--all-files", external=True)
9+
10+
11+
@nox.session
12+
def test(session: nox.Session) -> None:
13+
"""Run tests"""
14+
session.install("--upgrade", "pip")
15+
session.install("-e", ".[dev]")
16+
session.run("coverage", "run", "-m", "pytest", "tests/", external=True)
17+
18+
19+
@nox.session
20+
def docs(session: nox.Session) -> None:
21+
"""Build docs"""
22+
session.install("--upgrade", "pip")
23+
session.install(".[docs]")
24+
session.run("sphinx-build", "-b", "html", "docs/", "docs/_build/html")
25+
26+
27+
@nox.session(name="docs-live")
28+
def docs_live(session: nox.Session) -> None:
29+
session.install(".[docs]")
30+
session.run("sphinx-autobuild", "docs/", "docs/_build/html", external=True)

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ dev = [
4444
"pre-commit",
4545
"pytest",
4646
]
47+
docs = [
48+
"sphinx",
49+
"sphinx-autobuild",
50+
"sphinx_immaterial",
51+
]
4752

4853
[tool.setuptools]
4954
zip-safe = false

0 commit comments

Comments
 (0)