cppcheck-py 2.21.1__tar.gz → 2.22.0__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.
- {cppcheck_py-2.21.1 → cppcheck_py-2.22.0}/.gitignore +2 -0
- cppcheck_py-2.22.0/CMakeLists.txt +103 -0
- {cppcheck_py-2.21.1 → cppcheck_py-2.22.0}/PKG-INFO +5 -3
- {cppcheck_py-2.21.1 → cppcheck_py-2.22.0}/README.md +4 -2
- cppcheck_py-2.22.0/backend_wrapper.py +49 -0
- cppcheck_py-2.22.0/cppcheck_version.txt +1 -0
- {cppcheck_py-2.21.1 → cppcheck_py-2.22.0}/pyproject.toml +7 -3
- cppcheck_py-2.22.0/scripts/vendor_cppcheck.py +37 -0
- cppcheck_py-2.22.0/third_party/cppcheck-2.22.0.tar.gz +0 -0
- cppcheck_py-2.21.1/CMakeLists.txt +0 -101
- cppcheck_py-2.21.1/cppcheck_version.txt +0 -1
- {cppcheck_py-2.21.1 → cppcheck_py-2.22.0}/.github/dependabot.yml +0 -0
- {cppcheck_py-2.21.1 → cppcheck_py-2.22.0}/.github/workflows/release.yml +0 -0
- {cppcheck_py-2.21.1 → cppcheck_py-2.22.0}/.pre-commit-config.yaml +0 -0
- {cppcheck_py-2.21.1 → cppcheck_py-2.22.0}/LICENSE.md +0 -0
- {cppcheck_py-2.21.1 → cppcheck_py-2.22.0}/cppcheck/__init__.py +0 -0
- {cppcheck_py-2.21.1 → cppcheck_py-2.22.0}/test/__init__.py +0 -0
- {cppcheck_py-2.21.1 → cppcheck_py-2.22.0}/test/test_executable.py +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.28...4.0)
|
|
2
|
+
project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION})
|
|
3
|
+
|
|
4
|
+
message(STATUS "cppcheck-wheel version: ${SKBUILD_PROJECT_VERSION}")
|
|
5
|
+
string(
|
|
6
|
+
REGEX MATCH "^([0-9]+)\.([0-9]+)\.([0-9]+)"
|
|
7
|
+
CPPCHECK_VERSION
|
|
8
|
+
"${SKBUILD_PROJECT_VERSION}"
|
|
9
|
+
)
|
|
10
|
+
message(STATUS "cppcheck version: ${CPPCHECK_VERSION}")
|
|
11
|
+
|
|
12
|
+
# Check if the current compiler/linker toolchain supports IPO
|
|
13
|
+
include(CheckIPOSupported)
|
|
14
|
+
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
|
|
15
|
+
|
|
16
|
+
if(ipo_supported)
|
|
17
|
+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
18
|
+
message(STATUS "IPO/LTO enabled")
|
|
19
|
+
else()
|
|
20
|
+
message(WARNING "IPO/LTO not supported: ${ipo_error}")
|
|
21
|
+
endif()
|
|
22
|
+
|
|
23
|
+
# Check for the execinfo header, needed for backtraces support.
|
|
24
|
+
include(CheckIncludeFileCXX)
|
|
25
|
+
check_include_file_cxx("execinfo.h" HAVE_EXECINFO_H)
|
|
26
|
+
|
|
27
|
+
# Values cppcheck's own CMakeLists.txt will pick up as already-set variables
|
|
28
|
+
# (equivalent to the old -DFOO=... CMAKE_ARGS passed to the nested build).
|
|
29
|
+
if(NOT HAVE_EXECINFO_H)
|
|
30
|
+
message(STATUS "execinfo.h not found, disabling backtrace support")
|
|
31
|
+
set(NO_UNIX_BACKTRACE_SUPPORT ON)
|
|
32
|
+
endif()
|
|
33
|
+
|
|
34
|
+
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
|
35
|
+
set(DISABLE_DMAKE ON)
|
|
36
|
+
set(FILESDIR "" CACHE STRING "" FORCE)
|
|
37
|
+
|
|
38
|
+
set(CPPCHECK_ARCHIVE
|
|
39
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/third_party/cppcheck-${CPPCHECK_VERSION}.tar.gz"
|
|
40
|
+
)
|
|
41
|
+
if(NOT EXISTS "${CPPCHECK_ARCHIVE}")
|
|
42
|
+
message(
|
|
43
|
+
FATAL_ERROR
|
|
44
|
+
"${CPPCHECK_ARCHIVE} not found; run scripts/vendor_cppcheck.py "
|
|
45
|
+
"(the PEP 517 backend wrapper normally does this for you)"
|
|
46
|
+
)
|
|
47
|
+
endif()
|
|
48
|
+
|
|
49
|
+
include(FetchContent)
|
|
50
|
+
FetchContent_Declare(cppcheck URL "${CPPCHECK_ARCHIVE}" EXCLUDE_FROM_ALL)
|
|
51
|
+
FetchContent_MakeAvailable(cppcheck)
|
|
52
|
+
|
|
53
|
+
# Force the cppcheck target to build even though its subdirectory is
|
|
54
|
+
# EXCLUDE_FROM_ALL (mirrors the old build-cppcheck ExternalProject step).
|
|
55
|
+
add_custom_target(build-cppcheck ALL DEPENDS cppcheck)
|
|
56
|
+
|
|
57
|
+
# Reduce the size of the executable by executing strip if it is present on the system
|
|
58
|
+
find_program(STRIP_EXECUTABLE strip)
|
|
59
|
+
if(STRIP_EXECUTABLE)
|
|
60
|
+
add_custom_target(
|
|
61
|
+
strip-cppcheck
|
|
62
|
+
ALL
|
|
63
|
+
COMMAND ${STRIP_EXECUTABLE} $<TARGET_FILE:cppcheck>
|
|
64
|
+
COMMENT "Stripping cppcheck executable for size reduction"
|
|
65
|
+
)
|
|
66
|
+
add_dependencies(strip-cppcheck build-cppcheck)
|
|
67
|
+
endif()
|
|
68
|
+
|
|
69
|
+
# Define an installation rule that copies the executable to our Python package
|
|
70
|
+
install(
|
|
71
|
+
PROGRAMS
|
|
72
|
+
$<TARGET_FILE:cppcheck>
|
|
73
|
+
${cppcheck_SOURCE_DIR}/htmlreport/cppcheck-htmlreport
|
|
74
|
+
DESTINATION cppcheck/data
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
install(
|
|
78
|
+
DIRECTORY ${cppcheck_SOURCE_DIR}/addons
|
|
79
|
+
DESTINATION cppcheck/data
|
|
80
|
+
FILES_MATCHING
|
|
81
|
+
PATTERN "*.py"
|
|
82
|
+
PATTERN "test" EXCLUDE
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
install(
|
|
86
|
+
DIRECTORY ${cppcheck_SOURCE_DIR}/cfg
|
|
87
|
+
DESTINATION cppcheck/data
|
|
88
|
+
FILES_MATCHING
|
|
89
|
+
PATTERN "*.cfg"
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
install(
|
|
93
|
+
DIRECTORY ${cppcheck_SOURCE_DIR}/platforms
|
|
94
|
+
DESTINATION cppcheck/data
|
|
95
|
+
FILES_MATCHING
|
|
96
|
+
PATTERN "*.xml"
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
install(
|
|
100
|
+
FILES ${cppcheck_SOURCE_DIR}/COPYING
|
|
101
|
+
DESTINATION cppcheck
|
|
102
|
+
RENAME COPYING-cppcheck
|
|
103
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: cppcheck-py
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.22.0
|
|
4
4
|
Summary: Static analysis of C/C++ code
|
|
5
5
|
License: Apache 2.0
|
|
6
6
|
Classifier: Programming Language :: C
|
|
@@ -29,11 +29,13 @@ python -m pip install cppcheck-py
|
|
|
29
29
|
|
|
30
30
|
The tools provided are:
|
|
31
31
|
|
|
32
|
-
cppcheck
|
|
33
|
-
cppcheck-htmlreport
|
|
32
|
+
* `cppcheck`: performs static analysis of C/C++ source code
|
|
33
|
+
* `cppcheck-htmlreport`: generates an html report of a XML file produced by `cppcheck`
|
|
34
34
|
|
|
35
35
|
This projects intends to release a new PyPI package for each major and minor release of `cppcheck`.
|
|
36
36
|
|
|
37
|
+
Note that these tools are GPL-3.0 licensed; source is provided in the accompanying sdist.
|
|
38
|
+
|
|
37
39
|
## Use with pipx
|
|
38
40
|
|
|
39
41
|
You can use `pipx` to run cppcheck, as well. For example, `pipx run cppcheck <args>` will run cppcheck 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`).
|
|
@@ -10,11 +10,13 @@ python -m pip install cppcheck-py
|
|
|
10
10
|
|
|
11
11
|
The tools provided are:
|
|
12
12
|
|
|
13
|
-
cppcheck
|
|
14
|
-
cppcheck-htmlreport
|
|
13
|
+
* `cppcheck`: performs static analysis of C/C++ source code
|
|
14
|
+
* `cppcheck-htmlreport`: generates an html report of a XML file produced by `cppcheck`
|
|
15
15
|
|
|
16
16
|
This projects intends to release a new PyPI package for each major and minor release of `cppcheck`.
|
|
17
17
|
|
|
18
|
+
Note that these tools are GPL-3.0 licensed; source is provided in the accompanying sdist.
|
|
19
|
+
|
|
18
20
|
## Use with pipx
|
|
19
21
|
|
|
20
22
|
You can use `pipx` to run cppcheck, as well. For example, `pipx run cppcheck <args>` will run cppcheck 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`).
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Thin PEP 517 backend wrapper around scikit-build-core.
|
|
2
|
+
|
|
3
|
+
Ensures cppcheck's source is vendored into third_party/ before the
|
|
4
|
+
sdist is actually assembled, so `python -m build --sdist` (and anything
|
|
5
|
+
that calls this hook -- pip, cibuildwheel, twine, CI) always produces a
|
|
6
|
+
self-contained sdist without a manual pre-step.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import subprocess
|
|
10
|
+
import sys
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
from scikit_build_core.build import build_editable as _build_editable
|
|
14
|
+
from scikit_build_core.build import build_sdist as _build_sdist
|
|
15
|
+
from scikit_build_core.build import build_wheel as _build_wheel
|
|
16
|
+
|
|
17
|
+
# Re-export everything scikit-build-core provides; we only override
|
|
18
|
+
# build_sdist. Anything not overridden here still needs to exist as an
|
|
19
|
+
# attribute for setuptools/pip's PEP 517 hook lookup to find it.
|
|
20
|
+
from scikit_build_core.build import ( # noqa: F401
|
|
21
|
+
get_requires_for_build_editable,
|
|
22
|
+
get_requires_for_build_sdist,
|
|
23
|
+
get_requires_for_build_wheel,
|
|
24
|
+
prepare_metadata_for_build_editable,
|
|
25
|
+
prepare_metadata_for_build_wheel,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
_ROOT = Path(__file__).resolve().parent
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _vendor_cppcheck():
|
|
32
|
+
vendor_script = _ROOT / "scripts" / "vendor_cppcheck.py"
|
|
33
|
+
print(f"[backend_wrapper] running {vendor_script}", file=sys.stderr)
|
|
34
|
+
subprocess.check_call([sys.executable, str(vendor_script)])
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def build_editable(editable_directory, config_settings=None, metadata_directory=None):
|
|
38
|
+
_vendor_cppcheck()
|
|
39
|
+
return _build_editable(editable_directory, config_settings, metadata_directory)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
|
|
43
|
+
_vendor_cppcheck()
|
|
44
|
+
return _build_wheel(wheel_directory, config_settings, metadata_directory)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def build_sdist(sdist_directory, config_settings=None):
|
|
48
|
+
_vendor_cppcheck()
|
|
49
|
+
return _build_sdist(sdist_directory, config_settings)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.22.0.0
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = [
|
|
3
|
-
build-
|
|
2
|
+
requires = [
|
|
3
|
+
"scikit-build-core",
|
|
4
|
+
"tomli>=2.0; python_version < '3.11'",]
|
|
5
|
+
build-backend = "backend_wrapper"
|
|
6
|
+
backend-path = ["."]
|
|
4
7
|
|
|
5
8
|
[project]
|
|
6
9
|
name = "cppcheck-py"
|
|
@@ -38,10 +41,11 @@ Source = "https://github.com/cconverse711/cppcheck-wheel"
|
|
|
38
41
|
[tool.scikit-build]
|
|
39
42
|
wheel.packages = ["cppcheck"]
|
|
40
43
|
wheel.py-api = "py3"
|
|
41
|
-
cmake.version = ">=3.
|
|
44
|
+
cmake.version = ">=3.28.0"
|
|
42
45
|
ninja.version = ">=1.10.0"
|
|
43
46
|
build.verbose = true
|
|
44
47
|
logging.level = "DEBUG"
|
|
48
|
+
sdist.include = ["third_party/cppcheck-*.tar.gz"]
|
|
45
49
|
|
|
46
50
|
[dependency-groups]
|
|
47
51
|
dev = ["pytest"]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Run before building an sdist or wheel: vendors cppcheck's source so the sdist
|
|
3
|
+
is self-contained and doesn't require network access to build."""
|
|
4
|
+
|
|
5
|
+
import pathlib
|
|
6
|
+
import re
|
|
7
|
+
import urllib.request
|
|
8
|
+
|
|
9
|
+
from scikit_build_core.metadata.regex import dynamic_metadata
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
import tomllib
|
|
13
|
+
except ModuleNotFoundError:
|
|
14
|
+
import tomli as tomllib
|
|
15
|
+
|
|
16
|
+
ROOT = pathlib.Path(__file__).resolve().parent.parent
|
|
17
|
+
|
|
18
|
+
with open(ROOT / "pyproject.toml", "rb") as f:
|
|
19
|
+
pyproject = tomllib.load(f)
|
|
20
|
+
|
|
21
|
+
version_entry = next(
|
|
22
|
+
e for e in pyproject["tool"]["dynamic-metadata"] if e["field"] == "version"
|
|
23
|
+
)
|
|
24
|
+
settings = {
|
|
25
|
+
k: v for k, v in version_entry.items() if k not in ("provider", "field")
|
|
26
|
+
}
|
|
27
|
+
project_version = dynamic_metadata("version", settings)
|
|
28
|
+
|
|
29
|
+
cppcheck_version = re.match(r"^(\d+\.\d+\.\d+)", project_version).group(1)
|
|
30
|
+
url = f"https://github.com/cppcheck-opensource/cppcheck/archive/refs/tags/{cppcheck_version}.tar.gz"
|
|
31
|
+
archive_path = ROOT / "third_party" / f"cppcheck-{cppcheck_version}.tar.gz"
|
|
32
|
+
if archive_path.exists():
|
|
33
|
+
print(f"{archive_path} already exists, skipping download.")
|
|
34
|
+
else:
|
|
35
|
+
archive_path.parent.mkdir(parents=True, exist_ok=True)
|
|
36
|
+
print(f"Downloading {url}")
|
|
37
|
+
urllib.request.urlretrieve(url, archive_path)
|
|
Binary file
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
cmake_minimum_required(VERSION 3.16...4.0)
|
|
2
|
-
project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION})
|
|
3
|
-
|
|
4
|
-
message(STATUS "cppcheck-wheel version: ${SKBUILD_PROJECT_VERSION}")
|
|
5
|
-
string(
|
|
6
|
-
REGEX MATCH "^([0-9]+)\.([0-9]+)\.([0-9]+)"
|
|
7
|
-
CPPCHECK_VERSION
|
|
8
|
-
"${SKBUILD_PROJECT_VERSION}"
|
|
9
|
-
)
|
|
10
|
-
message(STATUS "cppcheck version: ${CPPCHECK_VERSION}")
|
|
11
|
-
|
|
12
|
-
include(CheckIncludeFileCXX)
|
|
13
|
-
# Check for the execinfo header, needed for backtraces support.
|
|
14
|
-
check_include_file_cxx("execinfo.h" HAVE_EXECINFO_H)
|
|
15
|
-
|
|
16
|
-
set(CMAKE_ARGS
|
|
17
|
-
-DCMAKE_BUILD_TYPE=Release
|
|
18
|
-
-U
|
|
19
|
-
FILESDIR
|
|
20
|
-
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
|
21
|
-
)
|
|
22
|
-
if(NOT HAVE_EXECINFO_H)
|
|
23
|
-
message(STATUS "execinfo.h not found, disabling backtrace support")
|
|
24
|
-
list(APPEND CMAKE_ARGS -DNO_UNIX_BACKTRACE_SUPPORT=ON)
|
|
25
|
-
endif()
|
|
26
|
-
|
|
27
|
-
# Define a build rule for cppcheck
|
|
28
|
-
set(CPPCHECK_DOWNLOAD_URL
|
|
29
|
-
"https://github.com/cppcheck-opensource/cppcheck/archive/refs/tags/${CPPCHECK_VERSION}.tar.gz"
|
|
30
|
-
)
|
|
31
|
-
include(ExternalProject)
|
|
32
|
-
ExternalProject_Add(
|
|
33
|
-
build-cppcheck
|
|
34
|
-
URL "${CPPCHECK_DOWNLOAD_URL}"
|
|
35
|
-
SOURCE_DIR ${CMAKE_BINARY_DIR}/cppcheck
|
|
36
|
-
BINARY_DIR ${CMAKE_BINARY_DIR}/cppcheck-build
|
|
37
|
-
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/cppcheck-download
|
|
38
|
-
UPDATE_COMMAND ""
|
|
39
|
-
INSTALL_COMMAND ""
|
|
40
|
-
USES_TERMINAL_DOWNLOAD 1
|
|
41
|
-
USES_TERMINAL_CONFIGURE 1
|
|
42
|
-
USES_TERMINAL_BUILD 1
|
|
43
|
-
CMAKE_ARGS ${CMAKE_ARGS}
|
|
44
|
-
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target cppcheck --config Release
|
|
45
|
-
)
|
|
46
|
-
set(config-subfolder "")
|
|
47
|
-
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
|
48
|
-
set(config-subfolder "Release")
|
|
49
|
-
endif()
|
|
50
|
-
set(cppcheck-executable
|
|
51
|
-
${CMAKE_BINARY_DIR}/cppcheck-build/${config-subfolder}/bin/cppcheck${CMAKE_EXECUTABLE_SUFFIX}
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
# Reduce the size of the executable by executing strip if it is present on the system
|
|
55
|
-
find_program(STRIP_EXECUTABLE strip)
|
|
56
|
-
if(STRIP_EXECUTABLE)
|
|
57
|
-
add_custom_target(
|
|
58
|
-
strip-cppcheck
|
|
59
|
-
ALL
|
|
60
|
-
COMMAND ${STRIP_EXECUTABLE} ${cppcheck-executable}
|
|
61
|
-
COMMENT "Stripping cppcheck executable for size reduction"
|
|
62
|
-
)
|
|
63
|
-
add_dependencies(strip-cppcheck build-cppcheck)
|
|
64
|
-
endif()
|
|
65
|
-
|
|
66
|
-
# Define an installation rule that copies the executable to our Python package
|
|
67
|
-
install(
|
|
68
|
-
PROGRAMS
|
|
69
|
-
${cppcheck-executable}
|
|
70
|
-
${CMAKE_BINARY_DIR}/cppcheck/htmlreport/cppcheck-htmlreport
|
|
71
|
-
DESTINATION cppcheck/data
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
install(
|
|
75
|
-
DIRECTORY ${CMAKE_BINARY_DIR}/cppcheck/addons
|
|
76
|
-
DESTINATION cppcheck/data
|
|
77
|
-
FILES_MATCHING
|
|
78
|
-
PATTERN "*.py"
|
|
79
|
-
PATTERN "test" EXCLUDE
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
install(
|
|
83
|
-
DIRECTORY ${CMAKE_BINARY_DIR}/cppcheck/cfg
|
|
84
|
-
DESTINATION cppcheck/data
|
|
85
|
-
FILES_MATCHING
|
|
86
|
-
PATTERN "*.cfg"
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
install(
|
|
90
|
-
DIRECTORY ${CMAKE_BINARY_DIR}/cppcheck/platforms
|
|
91
|
-
DESTINATION cppcheck/data
|
|
92
|
-
FILES_MATCHING
|
|
93
|
-
PATTERN "*.xml"
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
# Install the downloaded source archive for GPLv3 compliance.
|
|
97
|
-
install(
|
|
98
|
-
FILES ${CMAKE_BINARY_DIR}/cppcheck-download/${CPPCHECK_VERSION}.tar.gz
|
|
99
|
-
DESTINATION cppcheck
|
|
100
|
-
RENAME cppcheck-${CPPCHECK_VERSION}.tar.gz
|
|
101
|
-
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.21.1.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|