clang-include-cleaner 22.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clang_include_cleaner-22.1.7/.github/dependabot.yml +6 -0
- clang_include_cleaner-22.1.7/.github/workflows/release.yml +183 -0
- clang_include_cleaner-22.1.7/.gitignore +197 -0
- clang_include_cleaner-22.1.7/CMakeLists.txt +55 -0
- clang_include_cleaner-22.1.7/LICENSE.md +191 -0
- clang_include_cleaner-22.1.7/PKG-INFO +70 -0
- clang_include_cleaner-22.1.7/README.md +52 -0
- clang_include_cleaner-22.1.7/clang-include-cleaner_version.txt +1 -0
- clang_include_cleaner-22.1.7/clang_include_cleaner/__init__.py +59 -0
- clang_include_cleaner-22.1.7/pyproject.toml +58 -0
- clang_include_cleaner-22.1.7/test/__init__.py +0 -0
- clang_include_cleaner-22.1.7/test/test_executable.py +53 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
name: Build + Release Wheels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v?[0-9]+.[0-9]+.[0-9]+'
|
|
7
|
+
- 'v?[0-9]+.[0-9]+.[0-9]+.[0-9]+'
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
llvm_version:
|
|
11
|
+
description: "LLVM version to build"
|
|
12
|
+
required: false
|
|
13
|
+
default: ""
|
|
14
|
+
wheel_version:
|
|
15
|
+
description: "Version of the wheel packaging (appended to LLVM version)"
|
|
16
|
+
required: false
|
|
17
|
+
default: "0"
|
|
18
|
+
deploy_to_testpypi:
|
|
19
|
+
description: "Whether the build should be deployed to test.pypi.org instead of regular PyPI"
|
|
20
|
+
required: true
|
|
21
|
+
default: false
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
build-wheels:
|
|
25
|
+
name: "Build wheels on ${{ matrix.os }} :: platform=${{ matrix.platform }} arch=${{ matrix.arch }}"
|
|
26
|
+
runs-on: ${{ matrix.os }}
|
|
27
|
+
|
|
28
|
+
strategy:
|
|
29
|
+
matrix:
|
|
30
|
+
include:
|
|
31
|
+
# Linux
|
|
32
|
+
- os: ubuntu-latest
|
|
33
|
+
platform: "manylinux"
|
|
34
|
+
arch: "x86_64"
|
|
35
|
+
- os: ubuntu-latest
|
|
36
|
+
platform: "musllinux"
|
|
37
|
+
arch: "x86_64"
|
|
38
|
+
- os: ubuntu-latest
|
|
39
|
+
platform: "manylinux"
|
|
40
|
+
arch: "i686"
|
|
41
|
+
- os: ubuntu-latest
|
|
42
|
+
platform: "musllinux"
|
|
43
|
+
arch: "i686"
|
|
44
|
+
- os: ubuntu-24.04-arm
|
|
45
|
+
platform: "manylinux"
|
|
46
|
+
arch: "aarch64"
|
|
47
|
+
- os: ubuntu-24.04-arm
|
|
48
|
+
platform: "manylinux"
|
|
49
|
+
arch: "armv7l"
|
|
50
|
+
- os: ubuntu-24.04-arm
|
|
51
|
+
platform: "musllinux"
|
|
52
|
+
arch: "armv7l"
|
|
53
|
+
# Windows
|
|
54
|
+
- os: windows-latest
|
|
55
|
+
platform: "win"
|
|
56
|
+
arch: "AMD64"
|
|
57
|
+
- os: windows-latest
|
|
58
|
+
platform: "win"
|
|
59
|
+
arch: "x86"
|
|
60
|
+
# macOS
|
|
61
|
+
- os: macos-15-intel
|
|
62
|
+
platform: "macos"
|
|
63
|
+
arch: "x86_64"
|
|
64
|
+
- os: macos-latest
|
|
65
|
+
platform: "macos"
|
|
66
|
+
arch: "arm64"
|
|
67
|
+
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/checkout@v6
|
|
70
|
+
|
|
71
|
+
- name: Support long paths
|
|
72
|
+
if: runner.os == 'Windows'
|
|
73
|
+
run: git config --system core.longpaths true
|
|
74
|
+
|
|
75
|
+
- name: Set up msvc on Windows
|
|
76
|
+
if: runner.os == 'Windows'
|
|
77
|
+
uses: ilammy/msvc-dev-cmd@v1
|
|
78
|
+
with:
|
|
79
|
+
arch: ${{ matrix.arch }}
|
|
80
|
+
|
|
81
|
+
- name: Export macOS SDKROOT
|
|
82
|
+
if: runner.os == 'macOS'
|
|
83
|
+
run: echo SDKROOT=$(xcrun --sdk macosx --show-sdk-path) >> $GITHUB_ENV
|
|
84
|
+
|
|
85
|
+
- name: Override LLVM version (${{ github.event.inputs.llvm_version }})
|
|
86
|
+
if: github.event.inputs.llvm_version
|
|
87
|
+
run: |
|
|
88
|
+
echo "${{ github.event.inputs.llvm_version }}.${{ github.event.inputs.wheel_version }}" > clang-include-cleaner_version.txt
|
|
89
|
+
cat clang-include-cleaner_version.txt
|
|
90
|
+
|
|
91
|
+
- name: Build wheels
|
|
92
|
+
uses: pypa/cibuildwheel@v3.4
|
|
93
|
+
env:
|
|
94
|
+
CIBW_ARCHS: "${{ matrix.arch }}"
|
|
95
|
+
CIBW_BEFORE_TEST: rm -rf {package}/clang_include_cleaner
|
|
96
|
+
CIBW_TEST_SKIP: "*linux*"
|
|
97
|
+
# always skip PyPY builds + what's defined in the matrix
|
|
98
|
+
CIBW_SKIP: "pp* ${{matrix.skip}}"
|
|
99
|
+
# restrict to a single Python version as wheel does not depend on Python:
|
|
100
|
+
CIBW_BUILD: "cp311-${{ matrix.platform }}*"
|
|
101
|
+
|
|
102
|
+
- uses: actions/upload-artifact@v7
|
|
103
|
+
with:
|
|
104
|
+
name: artifacts-wheels-${{ matrix.platform }}-${{ matrix.arch }}
|
|
105
|
+
path: ./wheelhouse/*.whl
|
|
106
|
+
|
|
107
|
+
build-sdist:
|
|
108
|
+
name: Build source distribution
|
|
109
|
+
runs-on: ubuntu-latest
|
|
110
|
+
|
|
111
|
+
steps:
|
|
112
|
+
- uses: actions/checkout@v6
|
|
113
|
+
|
|
114
|
+
- name: Override LLVM version (${{ github.event.inputs.llvm_version }})
|
|
115
|
+
if: github.event.inputs.llvm_version
|
|
116
|
+
run: |
|
|
117
|
+
echo "${{ github.event.inputs.llvm_version }}.${{ github.event.inputs.wheel_version }}" > clang-include-cleaner_version.txt
|
|
118
|
+
cat clang-include-cleaner_version.txt
|
|
119
|
+
- name: Build SDist
|
|
120
|
+
run: pipx run build --sdist
|
|
121
|
+
|
|
122
|
+
- uses: actions/upload-artifact@v7
|
|
123
|
+
with:
|
|
124
|
+
path: dist/*.tar.gz
|
|
125
|
+
name: artifacts-sdist
|
|
126
|
+
|
|
127
|
+
test-sdist:
|
|
128
|
+
name: Test build from source distribution
|
|
129
|
+
needs: [build-sdist]
|
|
130
|
+
runs-on: ubuntu-latest
|
|
131
|
+
|
|
132
|
+
steps:
|
|
133
|
+
- uses: actions/checkout@v6
|
|
134
|
+
|
|
135
|
+
- uses: actions/setup-python@v6
|
|
136
|
+
name: Install Python
|
|
137
|
+
with:
|
|
138
|
+
python-version: '3.13'
|
|
139
|
+
|
|
140
|
+
- uses: actions/download-artifact@v8
|
|
141
|
+
with:
|
|
142
|
+
name: artifacts-sdist
|
|
143
|
+
path: sdist
|
|
144
|
+
|
|
145
|
+
- name: Install from SDist
|
|
146
|
+
run: |
|
|
147
|
+
rm -r clang_include_cleaner
|
|
148
|
+
pip install sdist/*.tar.gz
|
|
149
|
+
|
|
150
|
+
- name: Run test suite
|
|
151
|
+
run: |
|
|
152
|
+
python -m pip install pytest
|
|
153
|
+
python -m pytest
|
|
154
|
+
|
|
155
|
+
upload_pypi:
|
|
156
|
+
name: Upload to PyPI
|
|
157
|
+
needs: [build-wheels, build-sdist, test-sdist]
|
|
158
|
+
runs-on: ubuntu-latest
|
|
159
|
+
permissions:
|
|
160
|
+
id-token: write
|
|
161
|
+
contents: write
|
|
162
|
+
if: github.repository_owner == 'cpp-linter'
|
|
163
|
+
|
|
164
|
+
steps:
|
|
165
|
+
- uses: actions/download-artifact@v8
|
|
166
|
+
with:
|
|
167
|
+
pattern: artifacts-*
|
|
168
|
+
merge-multiple: true
|
|
169
|
+
path: dist
|
|
170
|
+
|
|
171
|
+
- name: Upload to PyPI
|
|
172
|
+
uses: pypa/gh-action-pypi-publish@v1.14.0
|
|
173
|
+
if: (startsWith(github.event.ref, 'refs/tags/')) || (github.event.inputs.deploy_to_testpypi == 'false')
|
|
174
|
+
|
|
175
|
+
- name: Upload to TestPyPI
|
|
176
|
+
uses: pypa/gh-action-pypi-publish@v1.14.0
|
|
177
|
+
if: github.event.inputs.deploy_to_testpypi == 'true'
|
|
178
|
+
with:
|
|
179
|
+
repository-url: https://test.pypi.org/legacy/
|
|
180
|
+
|
|
181
|
+
- name: GitHub release for tagged commits
|
|
182
|
+
uses: softprops/action-gh-release@v3
|
|
183
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script form a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
98
|
+
__pypackages__/
|
|
99
|
+
|
|
100
|
+
# Celery stuff
|
|
101
|
+
celerybeat-schedule
|
|
102
|
+
celerybeat.pid
|
|
103
|
+
|
|
104
|
+
# SageMath parsed files
|
|
105
|
+
*.sage.py
|
|
106
|
+
|
|
107
|
+
# Environments
|
|
108
|
+
.env
|
|
109
|
+
.venv
|
|
110
|
+
env/
|
|
111
|
+
venv/
|
|
112
|
+
ENV/
|
|
113
|
+
env.bak/
|
|
114
|
+
venv.bak/
|
|
115
|
+
|
|
116
|
+
# Spyder project settings
|
|
117
|
+
.spyderproject
|
|
118
|
+
.spyproject
|
|
119
|
+
|
|
120
|
+
# Rope project settings
|
|
121
|
+
.ropeproject
|
|
122
|
+
|
|
123
|
+
# mkdocs documentation
|
|
124
|
+
/site
|
|
125
|
+
|
|
126
|
+
# mypy
|
|
127
|
+
.mypy_cache/
|
|
128
|
+
.dmypy.json
|
|
129
|
+
dmypy.json
|
|
130
|
+
|
|
131
|
+
# Pyre type checker
|
|
132
|
+
.pyre/
|
|
133
|
+
|
|
134
|
+
# pytype static type analyzer
|
|
135
|
+
.pytype/
|
|
136
|
+
|
|
137
|
+
# Cython debug symbols
|
|
138
|
+
cython_debug/
|
|
139
|
+
# Prerequisites
|
|
140
|
+
*.d
|
|
141
|
+
|
|
142
|
+
# Compiled Object files
|
|
143
|
+
*.slo
|
|
144
|
+
*.lo
|
|
145
|
+
*.o
|
|
146
|
+
*.obj
|
|
147
|
+
|
|
148
|
+
# Precompiled Headers
|
|
149
|
+
*.gch
|
|
150
|
+
*.pch
|
|
151
|
+
|
|
152
|
+
# Compiled Dynamic libraries
|
|
153
|
+
*.so
|
|
154
|
+
*.dylib
|
|
155
|
+
*.dll
|
|
156
|
+
|
|
157
|
+
# Fortran module files
|
|
158
|
+
*.mod
|
|
159
|
+
*.smod
|
|
160
|
+
|
|
161
|
+
# Compiled Static libraries
|
|
162
|
+
*.lai
|
|
163
|
+
*.la
|
|
164
|
+
*.a
|
|
165
|
+
*.lib
|
|
166
|
+
|
|
167
|
+
# Executables
|
|
168
|
+
*.exe
|
|
169
|
+
*.out
|
|
170
|
+
*.app
|
|
171
|
+
|
|
172
|
+
CMakeLists.txt.user
|
|
173
|
+
CMakeCache.txt
|
|
174
|
+
CMakeFiles
|
|
175
|
+
CMakeScripts
|
|
176
|
+
Testing
|
|
177
|
+
Makefile
|
|
178
|
+
cmake_install.cmake
|
|
179
|
+
install_manifest.txt
|
|
180
|
+
compile_commands.json
|
|
181
|
+
CTestTestfile.cmake
|
|
182
|
+
_deps
|
|
183
|
+
|
|
184
|
+
# scikit-build cache
|
|
185
|
+
_skbuild/
|
|
186
|
+
|
|
187
|
+
clang_include_cleaner/data/
|
|
188
|
+
|
|
189
|
+
# Standard temporal folder.
|
|
190
|
+
tmp/
|
|
191
|
+
|
|
192
|
+
# cibuild standard output of the wheels
|
|
193
|
+
wheelhouse/
|
|
194
|
+
|
|
195
|
+
# IDE configuration folders
|
|
196
|
+
.vscode/
|
|
197
|
+
.idea/
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.16...3.31)
|
|
2
|
+
project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION})
|
|
3
|
+
|
|
4
|
+
message(STATUS "clang-include-cleaner wheel version: ${SKBUILD_PROJECT_VERSION}")
|
|
5
|
+
string(REGEX MATCH "^([0-9]+)\.([0-9]+)\.([0-9]+)" LLVM_VERSION "${SKBUILD_PROJECT_VERSION}")
|
|
6
|
+
set(LLVM_VERSION_MAJOR ${CMAKE_MATCH_1}) # https://cmake.org/cmake/help/latest/variable/CMAKE_MATCH_n.html
|
|
7
|
+
message(STATUS "LLVM version: ${LLVM_VERSION}")
|
|
8
|
+
|
|
9
|
+
# Define a build rule for clang-include-cleaner
|
|
10
|
+
set(LLVM_DOWNLOAD_URL "https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz")
|
|
11
|
+
include(ExternalProject)
|
|
12
|
+
ExternalProject_add(build-clang-include-cleaner
|
|
13
|
+
URL "${LLVM_DOWNLOAD_URL}"
|
|
14
|
+
SOURCE_SUBDIR llvm
|
|
15
|
+
SOURCE_DIR ${CMAKE_BINARY_DIR}/llvm-project
|
|
16
|
+
BINARY_DIR ${CMAKE_BINARY_DIR}/llvm
|
|
17
|
+
UPDATE_COMMAND ""
|
|
18
|
+
INSTALL_COMMAND ""
|
|
19
|
+
USES_TERMINAL_DOWNLOAD 1
|
|
20
|
+
USES_TERMINAL_CONFIGURE 1
|
|
21
|
+
USES_TERMINAL_BUILD 1
|
|
22
|
+
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DLLVM_ENABLE_ZSTD=OFF -DLLVM_ENABLE_PROJECTS=clang$<SEMICOLON>clang-tools-extra
|
|
23
|
+
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target clang-include-cleaner
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
set(config-subfolder "")
|
|
27
|
+
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
|
28
|
+
set(config-subfolder "Release")
|
|
29
|
+
endif()
|
|
30
|
+
set(clang-include-cleaner-executable ${CMAKE_BINARY_DIR}/llvm/${config-subfolder}/bin/clang-include-cleaner${CMAKE_EXECUTABLE_SUFFIX})
|
|
31
|
+
|
|
32
|
+
# Reduce the size of the executable by executing strip if it is present on the system
|
|
33
|
+
find_program(STRIP_EXECUTABLE strip)
|
|
34
|
+
if(STRIP_EXECUTABLE)
|
|
35
|
+
add_custom_target(
|
|
36
|
+
strip-clang-include-cleaner
|
|
37
|
+
ALL
|
|
38
|
+
COMMAND ${STRIP_EXECUTABLE} ${clang-include-cleaner-executable}
|
|
39
|
+
COMMENT "Stripping clang-include-cleaner executable for size reduction"
|
|
40
|
+
)
|
|
41
|
+
add_dependencies(strip-clang-include-cleaner build-clang-include-cleaner)
|
|
42
|
+
endif()
|
|
43
|
+
|
|
44
|
+
# Define an installation rule that copies the executable to our Python package
|
|
45
|
+
install(
|
|
46
|
+
PROGRAMS
|
|
47
|
+
${clang-include-cleaner-executable}
|
|
48
|
+
DESTINATION clang_include_cleaner/data/bin
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
install(
|
|
52
|
+
DIRECTORY
|
|
53
|
+
${CMAKE_BINARY_DIR}/llvm/lib/clang/${LLVM_VERSION_MAJOR}/include
|
|
54
|
+
DESTINATION clang_include_cleaner/data/lib/clang/${LLVM_VERSION_MAJOR}
|
|
55
|
+
)
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and
|
|
10
|
+
distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
|
13
|
+
owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities
|
|
16
|
+
that control, are controlled by, or are under common control with that entity.
|
|
17
|
+
For the purposes of this definition, "control" means (i) the power, direct or
|
|
18
|
+
indirect, to cause the direction or management of such entity, whether by
|
|
19
|
+
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
20
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
21
|
+
|
|
22
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
|
23
|
+
permissions granted by this License.
|
|
24
|
+
|
|
25
|
+
"Source" form shall mean the preferred form for making modifications, including
|
|
26
|
+
but not limited to software source code, documentation source, and configuration
|
|
27
|
+
files.
|
|
28
|
+
|
|
29
|
+
"Object" form shall mean any form resulting from mechanical transformation or
|
|
30
|
+
translation of a Source form, including but not limited to compiled object code,
|
|
31
|
+
generated documentation, and conversions to other media types.
|
|
32
|
+
|
|
33
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
|
34
|
+
available under the License, as indicated by a copyright notice that is included
|
|
35
|
+
in or attached to the work (an example is provided in the Appendix below).
|
|
36
|
+
|
|
37
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
|
38
|
+
is based on (or derived from) the Work and for which the editorial revisions,
|
|
39
|
+
annotations, elaborations, or other modifications represent, as a whole, an
|
|
40
|
+
original work of authorship. For the purposes of this License, Derivative Works
|
|
41
|
+
shall not include works that remain separable from, or merely link (or bind by
|
|
42
|
+
name) to the interfaces of, the Work and Derivative Works thereof.
|
|
43
|
+
|
|
44
|
+
"Contribution" shall mean any work of authorship, including the original version
|
|
45
|
+
of the Work and any modifications or additions to that Work or Derivative Works
|
|
46
|
+
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
|
47
|
+
by the copyright owner or by an individual or Legal Entity authorized to submit
|
|
48
|
+
on behalf of the copyright owner. For the purposes of this definition,
|
|
49
|
+
"submitted" means any form of electronic, verbal, or written communication sent
|
|
50
|
+
to the Licensor or its representatives, including but not limited to
|
|
51
|
+
communication on electronic mailing lists, source code control systems, and
|
|
52
|
+
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
|
53
|
+
the purpose of discussing and improving the Work, but excluding communication
|
|
54
|
+
that is conspicuously marked or otherwise designated in writing by the copyright
|
|
55
|
+
owner as "Not a Contribution."
|
|
56
|
+
|
|
57
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
|
58
|
+
of whom a Contribution has been received by Licensor and subsequently
|
|
59
|
+
incorporated within the Work.
|
|
60
|
+
|
|
61
|
+
2. Grant of Copyright License.
|
|
62
|
+
|
|
63
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
|
64
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
65
|
+
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
|
66
|
+
publicly display, publicly perform, sublicense, and distribute the Work and such
|
|
67
|
+
Derivative Works in Source or Object form.
|
|
68
|
+
|
|
69
|
+
3. Grant of Patent License.
|
|
70
|
+
|
|
71
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
|
72
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
73
|
+
irrevocable (except as stated in this section) patent license to make, have
|
|
74
|
+
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
|
75
|
+
such license applies only to those patent claims licensable by such Contributor
|
|
76
|
+
that are necessarily infringed by their Contribution(s) alone or by combination
|
|
77
|
+
of their Contribution(s) with the Work to which such Contribution(s) was
|
|
78
|
+
submitted. If You institute patent litigation against any entity (including a
|
|
79
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
|
80
|
+
Contribution incorporated within the Work constitutes direct or contributory
|
|
81
|
+
patent infringement, then any patent licenses granted to You under this License
|
|
82
|
+
for that Work shall terminate as of the date such litigation is filed.
|
|
83
|
+
|
|
84
|
+
4. Redistribution.
|
|
85
|
+
|
|
86
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
|
87
|
+
in any medium, with or without modifications, and in Source or Object form,
|
|
88
|
+
provided that You meet the following conditions:
|
|
89
|
+
|
|
90
|
+
You must give any other recipients of the Work or Derivative Works a copy of
|
|
91
|
+
this License; and
|
|
92
|
+
You must cause any modified files to carry prominent notices stating that You
|
|
93
|
+
changed the files; and
|
|
94
|
+
You must retain, in the Source form of any Derivative Works that You distribute,
|
|
95
|
+
all copyright, patent, trademark, and attribution notices from the Source form
|
|
96
|
+
of the Work, excluding those notices that do not pertain to any part of the
|
|
97
|
+
Derivative Works; and
|
|
98
|
+
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
|
99
|
+
Derivative Works that You distribute must include a readable copy of the
|
|
100
|
+
attribution notices contained within such NOTICE file, excluding those notices
|
|
101
|
+
that do not pertain to any part of the Derivative Works, in at least one of the
|
|
102
|
+
following places: within a NOTICE text file distributed as part of the
|
|
103
|
+
Derivative Works; within the Source form or documentation, if provided along
|
|
104
|
+
with the Derivative Works; or, within a display generated by the Derivative
|
|
105
|
+
Works, if and wherever such third-party notices normally appear. The contents of
|
|
106
|
+
the NOTICE file are for informational purposes only and do not modify the
|
|
107
|
+
License. You may add Your own attribution notices within Derivative Works that
|
|
108
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
|
109
|
+
provided that such additional attribution notices cannot be construed as
|
|
110
|
+
modifying the License.
|
|
111
|
+
You may add Your own copyright statement to Your modifications and may provide
|
|
112
|
+
additional or different license terms and conditions for use, reproduction, or
|
|
113
|
+
distribution of Your modifications, or for any such Derivative Works as a whole,
|
|
114
|
+
provided Your use, reproduction, and distribution of the Work otherwise complies
|
|
115
|
+
with the conditions stated in this License.
|
|
116
|
+
|
|
117
|
+
5. Submission of Contributions.
|
|
118
|
+
|
|
119
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
|
120
|
+
for inclusion in the Work by You to the Licensor shall be under the terms and
|
|
121
|
+
conditions of this License, without any additional terms or conditions.
|
|
122
|
+
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
|
123
|
+
any separate license agreement you may have executed with Licensor regarding
|
|
124
|
+
such Contributions.
|
|
125
|
+
|
|
126
|
+
6. Trademarks.
|
|
127
|
+
|
|
128
|
+
This License does not grant permission to use the trade names, trademarks,
|
|
129
|
+
service marks, or product names of the Licensor, except as required for
|
|
130
|
+
reasonable and customary use in describing the origin of the Work and
|
|
131
|
+
reproducing the content of the NOTICE file.
|
|
132
|
+
|
|
133
|
+
7. Disclaimer of Warranty.
|
|
134
|
+
|
|
135
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the
|
|
136
|
+
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
137
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
|
138
|
+
including, without limitation, any warranties or conditions of TITLE,
|
|
139
|
+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
|
140
|
+
solely responsible for determining the appropriateness of using or
|
|
141
|
+
redistributing the Work and assume any risks associated with Your exercise of
|
|
142
|
+
permissions under this License.
|
|
143
|
+
|
|
144
|
+
8. Limitation of Liability.
|
|
145
|
+
|
|
146
|
+
In no event and under no legal theory, whether in tort (including negligence),
|
|
147
|
+
contract, or otherwise, unless required by applicable law (such as deliberate
|
|
148
|
+
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
|
149
|
+
liable to You for damages, including any direct, indirect, special, incidental,
|
|
150
|
+
or consequential damages of any character arising as a result of this License or
|
|
151
|
+
out of the use or inability to use the Work (including but not limited to
|
|
152
|
+
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
|
153
|
+
any and all other commercial damages or losses), even if such Contributor has
|
|
154
|
+
been advised of the possibility of such damages.
|
|
155
|
+
|
|
156
|
+
9. Accepting Warranty or Additional Liability.
|
|
157
|
+
|
|
158
|
+
While redistributing the Work or Derivative Works thereof, You may choose to
|
|
159
|
+
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
|
160
|
+
other liability obligations and/or rights consistent with this License. However,
|
|
161
|
+
in accepting such obligations, You may act only on Your own behalf and on Your
|
|
162
|
+
sole responsibility, not on behalf of any other Contributor, and only if You
|
|
163
|
+
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
|
164
|
+
incurred by, or claims asserted against, such Contributor by reason of your
|
|
165
|
+
accepting any such warranty or additional liability.
|
|
166
|
+
|
|
167
|
+
END OF TERMS AND CONDITIONS
|
|
168
|
+
|
|
169
|
+
APPENDIX: How to apply the Apache License to your work
|
|
170
|
+
|
|
171
|
+
To apply the Apache License to your work, attach the following boilerplate
|
|
172
|
+
notice, with the fields enclosed by brackets "[]" replaced with your own
|
|
173
|
+
identifying information. (Don't include the brackets!) The text should be
|
|
174
|
+
enclosed in the appropriate comment syntax for the file format. We also
|
|
175
|
+
recommend that a file or class name and description of purpose be included on
|
|
176
|
+
the same "printed page" as the copyright notice for easier identification within
|
|
177
|
+
third-party archives.
|
|
178
|
+
|
|
179
|
+
Copyright Xianpeng Shen 2026
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: clang-include-cleaner
|
|
3
|
+
Version: 22.1.7
|
|
4
|
+
Summary: Clang-include-cleaner is an LLVM-based tool for finding and removing unused #include directives in C++ code
|
|
5
|
+
Author-Email: Xianpeng Shen <xianpeng.shen@gmail.com>
|
|
6
|
+
License: Apache 2.0
|
|
7
|
+
Classifier: Programming Language :: C
|
|
8
|
+
Classifier: Programming Language :: C++
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
13
|
+
Project-URL: Clang, http://clang.llvm.org/
|
|
14
|
+
Project-URL: Documentation, https://clang.llvm.org/extra/clang-include-cleaner.html
|
|
15
|
+
Project-URL: Download, https://github.com/llvm/llvm-project/releases
|
|
16
|
+
Project-URL: Source, https://github.com/cpp-linter/clang-include-cleaner
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# clang-include-cleaner Python distribution
|
|
20
|
+
|
|
21
|
+
[](https://pypi.org/project/clang-include-cleaner)
|
|
22
|
+
|
|
23
|
+
This project packages the `clang-include-cleaner` utility as a Python package. It allows you to install `clang-include-cleaner` directly from PyPI:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
python -m pip install clang-include-cleaner
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This project intends to release a new PyPI package for each major and minor release of `clang-include-cleaner`.
|
|
30
|
+
|
|
31
|
+
## What is clang-include-cleaner?
|
|
32
|
+
|
|
33
|
+
`clang-include-cleaner` is an LLVM-based tool that analyzes C++ source files and identifies unused `#include` directives that can be safely removed. It is part of the `clang-tools-extra` suite.
|
|
34
|
+
|
|
35
|
+
## Use with pipx
|
|
36
|
+
|
|
37
|
+
You can use `pipx` to run clang-include-cleaner, as well. For example, `pipx run clang-include-cleaner <args>` will run clang-include-cleaner without any previous install required on any machine with pipx (including all default GitHub Actions / Azure runners, avoiding requiring a pre-install step or even `actions/setup-python`).
|
|
38
|
+
|
|
39
|
+
## Building new releases
|
|
40
|
+
|
|
41
|
+
The [clang-include-cleaner repository](https://github.com/cpp-linter/clang-include-cleaner) provides the logic to build and publish binary wheels of the `clang-include-cleaner` utility.
|
|
42
|
+
|
|
43
|
+
In order to add a new release, the following steps are necessary:
|
|
44
|
+
|
|
45
|
+
* Edit the [version file](https://github.com/cpp-linter/clang-include-cleaner/blob/main/clang-include-cleaner_version.txt) to reflect the new version.
|
|
46
|
+
* Make a GitHub release to trigger the [GitHub Actions release workflow](https://github.com/cpp-linter/clang-include-cleaner/actions/workflows/release.yml). Alternatively, the workflow can be triggered manually.
|
|
47
|
+
|
|
48
|
+
On manual triggers, the following input variables are available:
|
|
49
|
+
* `use_qemu`: Whether to build targets that require emulation (default: `true`)
|
|
50
|
+
* `llvm_version`: Override the LLVM version (default: `""`)
|
|
51
|
+
* `wheel_version`: Override the wheel packaging version (default `"0"`)
|
|
52
|
+
* `deploy_to_testpypi`: Whether to deploy to TestPyPI instead of PyPI (default: `false`)
|
|
53
|
+
|
|
54
|
+
The repository with the precommit hook is automatically updated using a scheduled Github Actions workflow.
|
|
55
|
+
|
|
56
|
+
## Acknowledgments
|
|
57
|
+
|
|
58
|
+
This repository extends the great work of several other projects:
|
|
59
|
+
|
|
60
|
+
* `clang-include-cleaner` itself is [provided by the LLVM project](https://github.com/llvm/llvm-project) under the Apache 2.0 License with LLVM exceptions.
|
|
61
|
+
* The build logic is based on [scikit-build](https://github.com/scikit-build/scikit-build) which greatly reduces the amount of low level code necessary to package `clang-include-cleaner`.
|
|
62
|
+
* The `scikit-build` packaging examples of [CMake](https://github.com/scikit-build/cmake-python-distributions) and [Ninja](https://github.com/scikit-build/ninja-python-distributions) were very helpful in packaging `clang-include-cleaner`.
|
|
63
|
+
* The CI build process is controlled by [cibuildwheel](https://github.com/pypa/cibuildwheel) which makes building wheels across a number of platforms a pleasant experience (!)
|
|
64
|
+
|
|
65
|
+
We are grateful for the generous provisioning with CI resources that GitHub currently offers to Open Source projects.
|
|
66
|
+
|
|
67
|
+
## Troubleshooting
|
|
68
|
+
|
|
69
|
+
To see which clang-include-cleaner binary the package is using
|
|
70
|
+
you can set `CLANG_INCLUDE_CLEANER_WHEEL_VERBOSE` to `1` in your environment.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# clang-include-cleaner Python distribution
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/clang-include-cleaner)
|
|
4
|
+
|
|
5
|
+
This project packages the `clang-include-cleaner` utility as a Python package. It allows you to install `clang-include-cleaner` directly from PyPI:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
python -m pip install clang-include-cleaner
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This project intends to release a new PyPI package for each major and minor release of `clang-include-cleaner`.
|
|
12
|
+
|
|
13
|
+
## What is clang-include-cleaner?
|
|
14
|
+
|
|
15
|
+
`clang-include-cleaner` is an LLVM-based tool that analyzes C++ source files and identifies unused `#include` directives that can be safely removed. It is part of the `clang-tools-extra` suite.
|
|
16
|
+
|
|
17
|
+
## Use with pipx
|
|
18
|
+
|
|
19
|
+
You can use `pipx` to run clang-include-cleaner, as well. For example, `pipx run clang-include-cleaner <args>` will run clang-include-cleaner without any previous install required on any machine with pipx (including all default GitHub Actions / Azure runners, avoiding requiring a pre-install step or even `actions/setup-python`).
|
|
20
|
+
|
|
21
|
+
## Building new releases
|
|
22
|
+
|
|
23
|
+
The [clang-include-cleaner repository](https://github.com/cpp-linter/clang-include-cleaner) provides the logic to build and publish binary wheels of the `clang-include-cleaner` utility.
|
|
24
|
+
|
|
25
|
+
In order to add a new release, the following steps are necessary:
|
|
26
|
+
|
|
27
|
+
* Edit the [version file](https://github.com/cpp-linter/clang-include-cleaner/blob/main/clang-include-cleaner_version.txt) to reflect the new version.
|
|
28
|
+
* Make a GitHub release to trigger the [GitHub Actions release workflow](https://github.com/cpp-linter/clang-include-cleaner/actions/workflows/release.yml). Alternatively, the workflow can be triggered manually.
|
|
29
|
+
|
|
30
|
+
On manual triggers, the following input variables are available:
|
|
31
|
+
* `use_qemu`: Whether to build targets that require emulation (default: `true`)
|
|
32
|
+
* `llvm_version`: Override the LLVM version (default: `""`)
|
|
33
|
+
* `wheel_version`: Override the wheel packaging version (default `"0"`)
|
|
34
|
+
* `deploy_to_testpypi`: Whether to deploy to TestPyPI instead of PyPI (default: `false`)
|
|
35
|
+
|
|
36
|
+
The repository with the precommit hook is automatically updated using a scheduled Github Actions workflow.
|
|
37
|
+
|
|
38
|
+
## Acknowledgments
|
|
39
|
+
|
|
40
|
+
This repository extends the great work of several other projects:
|
|
41
|
+
|
|
42
|
+
* `clang-include-cleaner` itself is [provided by the LLVM project](https://github.com/llvm/llvm-project) under the Apache 2.0 License with LLVM exceptions.
|
|
43
|
+
* The build logic is based on [scikit-build](https://github.com/scikit-build/scikit-build) which greatly reduces the amount of low level code necessary to package `clang-include-cleaner`.
|
|
44
|
+
* The `scikit-build` packaging examples of [CMake](https://github.com/scikit-build/cmake-python-distributions) and [Ninja](https://github.com/scikit-build/ninja-python-distributions) were very helpful in packaging `clang-include-cleaner`.
|
|
45
|
+
* The CI build process is controlled by [cibuildwheel](https://github.com/pypa/cibuildwheel) which makes building wheels across a number of platforms a pleasant experience (!)
|
|
46
|
+
|
|
47
|
+
We are grateful for the generous provisioning with CI resources that GitHub currently offers to Open Source projects.
|
|
48
|
+
|
|
49
|
+
## Troubleshooting
|
|
50
|
+
|
|
51
|
+
To see which clang-include-cleaner binary the package is using
|
|
52
|
+
you can set `CLANG_INCLUDE_CLEANER_WHEEL_VERBOSE` to `1` in your environment.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
22.1.7.0.0
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import functools
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
if sys.version_info.minor >= 9:
|
|
8
|
+
# Only available on 3.9 or later, and required on 3.12
|
|
9
|
+
from importlib.resources import files
|
|
10
|
+
else:
|
|
11
|
+
import pkg_resources
|
|
12
|
+
|
|
13
|
+
def get_executable(name:str) -> Path:
|
|
14
|
+
return _get_executable(name)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@functools.lru_cache(maxsize=None)
|
|
18
|
+
def _get_executable(name:str) -> Path:
|
|
19
|
+
if sys.version_info.minor >= 9:
|
|
20
|
+
# Only available in 3.9 or later, and required in 3.12
|
|
21
|
+
possibles = [
|
|
22
|
+
Path(files("clang_include_cleaner") / f"data/bin/{name}{s}")
|
|
23
|
+
for s in ("", ".exe", ".bin", ".dmg")
|
|
24
|
+
]
|
|
25
|
+
else:
|
|
26
|
+
possibles = [
|
|
27
|
+
Path(pkg_resources.resource_filename("clang_include_cleaner", f"data/bin/{name}{s}"))
|
|
28
|
+
for s in ("", ".exe", ".bin", ".dmg")
|
|
29
|
+
]
|
|
30
|
+
for exe in possibles:
|
|
31
|
+
if exe.exists():
|
|
32
|
+
if os.environ.get("CLANG_INCLUDE_CLEANER_WHEEL_VERBOSE", None):
|
|
33
|
+
print(f'Found binary: {exe} ')
|
|
34
|
+
return exe
|
|
35
|
+
|
|
36
|
+
raise FileNotFoundError(f"No executable found for {name} at\n{possibles}")
|
|
37
|
+
|
|
38
|
+
def _run(name, *args):
|
|
39
|
+
command = [_get_executable(name)]
|
|
40
|
+
if args:
|
|
41
|
+
command += list(args)
|
|
42
|
+
else:
|
|
43
|
+
command += sys.argv[1:]
|
|
44
|
+
return subprocess.call(command)
|
|
45
|
+
|
|
46
|
+
def _run_python(name, *args):
|
|
47
|
+
command = [sys.executable, _get_executable(name)]
|
|
48
|
+
if args:
|
|
49
|
+
command += list(args)
|
|
50
|
+
else:
|
|
51
|
+
command += sys.argv[1:]
|
|
52
|
+
|
|
53
|
+
# as MS Windows is not able to run Python scripts directly by name,
|
|
54
|
+
# we have to call the interpreter and pass the script as parameter
|
|
55
|
+
return subprocess.call(command)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def clang_include_cleaner():
|
|
59
|
+
raise SystemExit(_run("clang-include-cleaner"))
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["scikit-build-core"]
|
|
3
|
+
build-backend = "scikit_build_core.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "clang-include-cleaner"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
authors = [{name = "Xianpeng Shen", email = "xianpeng.shen@gmail.com"}]
|
|
9
|
+
license = { text = "Apache 2.0" }
|
|
10
|
+
description = "Clang-include-cleaner is an LLVM-based tool for finding and removing unused #include directives in C++ code"
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: C",
|
|
14
|
+
"Programming Language :: C++",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"License :: OSI Approved :: Apache Software License",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[tool.scikit-build.metadata.version]
|
|
22
|
+
provider = "scikit_build_core.metadata.regex"
|
|
23
|
+
regex = '^(?P<value>\d+\.\d+\.\d+(\.[1-9]\d*)?)'
|
|
24
|
+
input = "clang-include-cleaner_version.txt"
|
|
25
|
+
|
|
26
|
+
[dependency-groups]
|
|
27
|
+
test = ["pytest"]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Clang = "http://clang.llvm.org/"
|
|
31
|
+
Documentation = "https://clang.llvm.org/extra/clang-include-cleaner.html"
|
|
32
|
+
Download = "https://github.com/llvm/llvm-project/releases"
|
|
33
|
+
Source = "https://github.com/cpp-linter/clang-include-cleaner"
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
"clang-include-cleaner" = "clang_include_cleaner:clang_include_cleaner"
|
|
37
|
+
|
|
38
|
+
[tool.scikit-build]
|
|
39
|
+
wheel.packages = ["clang_include_cleaner"]
|
|
40
|
+
wheel.py-api = "py2.py3"
|
|
41
|
+
cmake.version = ">=3.16.0"
|
|
42
|
+
ninja.version = ">=1.10.0"
|
|
43
|
+
cmake.verbose = true
|
|
44
|
+
logging.level = "DEBUG"
|
|
45
|
+
|
|
46
|
+
[tool.cibuildwheel]
|
|
47
|
+
# Super-verbose output for debugging purpose
|
|
48
|
+
build-verbosity = 3
|
|
49
|
+
# Set CMAKE_GENERATOR env var which is respected by scikit-build-core to use Ninja on all platforms
|
|
50
|
+
environment = "CMAKE_GENERATOR=Ninja"
|
|
51
|
+
|
|
52
|
+
# Testing commands for our wheels
|
|
53
|
+
before-test = [
|
|
54
|
+
"git config --global user.name Name",
|
|
55
|
+
"git config --global user.email foo@bar.com"
|
|
56
|
+
]
|
|
57
|
+
test-requires = ["pytest", "pytest-git"]
|
|
58
|
+
test-command = "pytest {package}/test"
|
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import tempfile
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.fixture(autouse=True)
|
|
10
|
+
def ensure_include_cleaner_from_wheel(monkeypatch):
|
|
11
|
+
"""test the installed clang_include_cleaner package, not the local one"""
|
|
12
|
+
this_dir = Path(__file__).resolve().absolute().parent
|
|
13
|
+
for pd in (this_dir, this_dir / ".."):
|
|
14
|
+
try:
|
|
15
|
+
new_path = sys.path.remove(pd)
|
|
16
|
+
monkeypatch.setattr(sys, "path", new_path)
|
|
17
|
+
except ValueError:
|
|
18
|
+
pass
|
|
19
|
+
monkeypatch.delitem(sys.modules, "clang_include_cleaner", raising=False)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_executable_file(capsys):
|
|
23
|
+
import clang_include_cleaner
|
|
24
|
+
|
|
25
|
+
clang_include_cleaner._get_executable.cache_clear()
|
|
26
|
+
exe = clang_include_cleaner.get_executable("clang-include-cleaner")
|
|
27
|
+
assert os.path.exists(exe)
|
|
28
|
+
assert os.access(exe, os.X_OK)
|
|
29
|
+
assert capsys.readouterr().out == ""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _test_help():
|
|
33
|
+
import clang_include_cleaner
|
|
34
|
+
|
|
35
|
+
assert (
|
|
36
|
+
clang_include_cleaner._run(
|
|
37
|
+
"clang-include-cleaner",
|
|
38
|
+
"--help",
|
|
39
|
+
) == 0
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_verbose_output(capsys, monkeypatch):
|
|
44
|
+
import clang_include_cleaner
|
|
45
|
+
monkeypatch.setenv("CLANG_INCLUDE_CLEANER_WHEEL_VERBOSE", "1")
|
|
46
|
+
# need to clear cache to make sure the function is run again
|
|
47
|
+
clang_include_cleaner._get_executable.cache_clear()
|
|
48
|
+
clang_include_cleaner.get_executable("clang-include-cleaner")
|
|
49
|
+
assert capsys.readouterr().out
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_help():
|
|
53
|
+
_test_help()
|