castxml 0.8.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.
@@ -0,0 +1,39 @@
1
+ cmake_minimum_required(VERSION 3.20)
2
+
3
+ project(CastXMLPythonDistributions LANGUAGES C CXX)
4
+
5
+ #-----------------------------------------------------------------------------
6
+ # Build CastXML from source with the CastXML superbuild, which builds
7
+ # LLVM/Clang and then CastXML against them.
8
+ #-----------------------------------------------------------------------------
9
+ set(CASTXML_SUPERBUILD_GIT_TAG "0b677ec7bd49fa64bf7761aaed5a5129293c8094"
10
+ CACHE STRING "CastXMLSuperbuild Git revision")
11
+
12
+ # The superbuild pins its own CastXML revision and FORCE-sets it in the cache,
13
+ # so it can't be overridden with -D. PatchCastXMLSuperbuild.cmake rewrites
14
+ # that pin to this revision instead.
15
+ set(CASTXML_GIT_TAG "v0.8.0" CACHE STRING "CastXML Git revision")
16
+
17
+ include(FetchContent)
18
+ FetchContent_Declare(castxmlsuperbuild
19
+ GIT_REPOSITORY https://github.com/CastXML/CastXMLSuperbuild.git
20
+ GIT_TAG ${CASTXML_SUPERBUILD_GIT_TAG}
21
+ PATCH_COMMAND ${CMAKE_COMMAND}
22
+ -DCASTXML_GIT_TAG=${CASTXML_GIT_TAG}
23
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/PatchCastXMLSuperbuild.cmake
24
+ )
25
+ FetchContent_MakeAvailable(castxmlsuperbuild)
26
+
27
+ message(STATUS "CastXMLSuperbuild revision: ${CASTXML_SUPERBUILD_GIT_TAG}")
28
+ message(STATUS "CastXML revision: ${CASTXML_GIT_TAG}")
29
+
30
+ #-----------------------------------------------------------------------------
31
+ # Install
32
+ #-----------------------------------------------------------------------------
33
+ # The superbuild installs CastXML into <superbuild binary dir>/castxml while
34
+ # building. Ship that whole tree: bin/castxml finds its bundled Clang headers
35
+ # relative to itself in share/castxml.
36
+ install(DIRECTORY ${castxmlsuperbuild_BINARY_DIR}/castxml/
37
+ DESTINATION .
38
+ USE_SOURCE_PERMISSIONS
39
+ )
castxml-0.8.0/PKG-INFO ADDED
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: castxml
3
+ Version: 0.8.0
4
+ Summary: Parse C-family source files and optionally write a subset of the Abstract Syntax Tree (AST) to a representation in XML.
5
+ Keywords: castxml,ast,xml,cmake,cross-platform,c++,llvm,build
6
+ Author-Email: Kitware <kitware@kitware.com>
7
+ Maintainer-Email: John Parent <john.parent@kitware.com>
8
+ License-Expression: Apache-2.0
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: C
13
+ Classifier: Programming Language :: C++
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Topic :: Software Development :: Build Tools
18
+ Project-URL: Homepage, https://github.com/castxml/castxml
19
+ Project-URL: Documentation, https://github.com/CastXML/CastXML/blob/master/doc/manual/castxml.1.rst
20
+ Project-URL: Repository, https://github.com/CastXML/CastXML-python-distributions
21
+ Project-URL: Issues, https://github.com/CastXML/CastXML-python-distributions/issues
22
+ Requires-Python: >=3
23
+ Description-Content-Type: text/markdown
24
+
25
+ # CastXML Python Distribution
26
+
27
+ Introduction
28
+ ============
29
+
30
+ The latest CastXML python wheels provide the CastXML 0.8.0 executable, built
31
+ from source with the [CastXML superbuild][superbuild].
32
+
33
+ CastXML is a C-family abstract syntax tree XML output tool.
34
+
35
+ This project is maintained by [Kitware][kitware] in support of [ITK][itk],
36
+ the Insight Segmentation and Registration Toolkit.
37
+
38
+ [superbuild]: https://github.com/CastXML/CastXMLSuperbuild
39
+ [kitware]: https://www.kitware.com/
40
+ [itk]: https://itk.org/
41
+
42
+ Manual
43
+ ======
44
+
45
+ See the [castxml(1)][manual] manual page for instructions to run the tool.
46
+
47
+ [manual]: https://github.com/CastXML/CastXML/blob/master/doc/manual/castxml.1.rst#castxml1
48
+
49
+ Latest Release
50
+ ==============
51
+
52
+ [![][pypi-version-img]][pypi] [![][pypi-download-img]][pypi]
53
+
54
+ [pypi-version-img]: https://img.shields.io/pypi/v/castxml.svg
55
+ [pypi-download-img]: https://img.shields.io/pypi/dm/castxml.svg
56
+ [pypi]: https://pypi.python.org/pypi/castxml
57
+
58
+ Build Status
59
+ ============
60
+
61
+ [![][ci-status-img]][ci-status]
62
+
63
+ [ci-status-img]: https://github.com/CastXML/CastXML-python-distributions/actions/workflows/ci.yml/badge.svg?branch=master
64
+ [ci-status]: https://github.com/CastXML/CastXML-python-distributions/actions/workflows/ci.yml
65
+
66
+ Maintainers
67
+ ===========
68
+
69
+ * [How to make a release ?](https://github.com/CastXML/CastXML-python-distributions/blob/master/docs/make_a_release.md)
70
+
71
+ Miscellaneous
72
+ =============
73
+
74
+ * Documentation: https://github.com/CastXML/CastXML-python-distributions#readme
75
+ * Source code: https://github.com/CastXML/CastXML-python-distributions
76
+ * Mailing list: https://public.kitware.com/mailman/listinfo/castxml
77
+
78
+ License
79
+ =======
80
+
81
+ CastXML is licensed under the [Apache License, Version 2.0][apache-license-2.0].
82
+ See the [LICENSE][license] and [NOTICE][notice] files for details.
83
+
84
+ [apache-license-2.0]: https://www.apache.org/licenses/LICENSE-2.0
85
+ [license]: https://github.com/CastXML/CastXML/blob/master/LICENSE
86
+ [notice]: https://raw.githubusercontent.com/CastXML/CastXML/master/NOTICE
87
+
88
+ Community
89
+ =========
90
+
91
+ Subscribe and post to the [CastXML Mailing List][mailing-list] for discussion of CastXML.
92
+
93
+ [mailing-list]: https://public.kitware.com/mailman/listinfo/castxml
@@ -0,0 +1,24 @@
1
+ # Rewrite the CastXML revision pinned by the CastXML superbuild.
2
+ #
3
+ # Usage, from the superbuild source directory:
4
+ # cmake -DCASTXML_GIT_TAG=<revision> -P PatchCastXMLSuperbuild.cmake
5
+ #
6
+ # The superbuild sets CastXML_GIT_TAG with CACHE ... FORCE, so the pin can only
7
+ # be changed by editing its CMakeLists.txt. Re-running this is harmless.
8
+
9
+ if(NOT CASTXML_GIT_TAG)
10
+ message(FATAL_ERROR "CASTXML_GIT_TAG must be set")
11
+ endif()
12
+
13
+ file(READ CMakeLists.txt content)
14
+
15
+ set(pin_regex "set\\(CastXML_GIT_TAG \"[^\"]*\"")
16
+ if(NOT content MATCHES "${pin_regex}")
17
+ message(FATAL_ERROR
18
+ "Could not find the CastXML_GIT_TAG pin in the superbuild's CMakeLists.txt; "
19
+ "PatchCastXMLSuperbuild.cmake needs updating for this superbuild revision.")
20
+ endif()
21
+
22
+ string(REGEX REPLACE "${pin_regex}" "set(CastXML_GIT_TAG \"${CASTXML_GIT_TAG}\""
23
+ content "${content}")
24
+ file(WRITE CMakeLists.txt "${content}")
@@ -0,0 +1,69 @@
1
+ # CastXML Python Distribution
2
+
3
+ Introduction
4
+ ============
5
+
6
+ The latest CastXML python wheels provide the CastXML 0.8.0 executable, built
7
+ from source with the [CastXML superbuild][superbuild].
8
+
9
+ CastXML is a C-family abstract syntax tree XML output tool.
10
+
11
+ This project is maintained by [Kitware][kitware] in support of [ITK][itk],
12
+ the Insight Segmentation and Registration Toolkit.
13
+
14
+ [superbuild]: https://github.com/CastXML/CastXMLSuperbuild
15
+ [kitware]: https://www.kitware.com/
16
+ [itk]: https://itk.org/
17
+
18
+ Manual
19
+ ======
20
+
21
+ See the [castxml(1)][manual] manual page for instructions to run the tool.
22
+
23
+ [manual]: https://github.com/CastXML/CastXML/blob/master/doc/manual/castxml.1.rst#castxml1
24
+
25
+ Latest Release
26
+ ==============
27
+
28
+ [![][pypi-version-img]][pypi] [![][pypi-download-img]][pypi]
29
+
30
+ [pypi-version-img]: https://img.shields.io/pypi/v/castxml.svg
31
+ [pypi-download-img]: https://img.shields.io/pypi/dm/castxml.svg
32
+ [pypi]: https://pypi.python.org/pypi/castxml
33
+
34
+ Build Status
35
+ ============
36
+
37
+ [![][ci-status-img]][ci-status]
38
+
39
+ [ci-status-img]: https://github.com/CastXML/CastXML-python-distributions/actions/workflows/ci.yml/badge.svg?branch=master
40
+ [ci-status]: https://github.com/CastXML/CastXML-python-distributions/actions/workflows/ci.yml
41
+
42
+ Maintainers
43
+ ===========
44
+
45
+ * [How to make a release ?](https://github.com/CastXML/CastXML-python-distributions/blob/master/docs/make_a_release.md)
46
+
47
+ Miscellaneous
48
+ =============
49
+
50
+ * Documentation: https://github.com/CastXML/CastXML-python-distributions#readme
51
+ * Source code: https://github.com/CastXML/CastXML-python-distributions
52
+ * Mailing list: https://public.kitware.com/mailman/listinfo/castxml
53
+
54
+ License
55
+ =======
56
+
57
+ CastXML is licensed under the [Apache License, Version 2.0][apache-license-2.0].
58
+ See the [LICENSE][license] and [NOTICE][notice] files for details.
59
+
60
+ [apache-license-2.0]: https://www.apache.org/licenses/LICENSE-2.0
61
+ [license]: https://github.com/CastXML/CastXML/blob/master/LICENSE
62
+ [notice]: https://raw.githubusercontent.com/CastXML/CastXML/master/NOTICE
63
+
64
+ Community
65
+ =========
66
+
67
+ Subscribe and post to the [CastXML Mailing List][mailing-list] for discussion of CastXML.
68
+
69
+ [mailing-list]: https://public.kitware.com/mailman/listinfo/castxml
@@ -0,0 +1,25 @@
1
+ import os
2
+ import subprocess
3
+ import sys
4
+
5
+ from ._version import __version__ # noqa: F401
6
+
7
+ DATA = os.path.join(os.path.dirname(__file__), 'data')
8
+
9
+ # In an editable install (pip install -e .) this file runs from the source
10
+ # tree, but the CMake-installed files live in site-packages. scikit-build-core
11
+ # adds that location to the package's __path__, so look there too.
12
+ for _path in __path__:
13
+ if os.path.isdir(os.path.join(_path, 'data')):
14
+ DATA = os.path.join(_path, 'data')
15
+ break
16
+
17
+ BIN_DIR = os.path.join(DATA, 'bin')
18
+
19
+
20
+ def _program(name, args):
21
+ return subprocess.call([os.path.join(BIN_DIR, name)] + args)
22
+
23
+
24
+ def castxml():
25
+ raise SystemExit(_program('castxml', sys.argv[1:]))
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '0.8.0'
22
+ __version_tuple__ = version_tuple = (0, 8, 0)
23
+
24
+ __commit_id__ = commit_id = 'g082c846b7'
@@ -0,0 +1,114 @@
1
+ [build-system]
2
+ requires = ["scikit-build-core>=1.0", "setuptools-scm>=8"]
3
+ build-backend = "scikit_build_core.build"
4
+
5
+ [tool.scikit-build]
6
+ minimum-version = "build-system.requires"
7
+ # Keep the build tree between local builds so rebuilding doesn't redo the
8
+ # LLVM/Clang build from scratch. CI and sdist builds always start fresh.
9
+ build-dir = "build/{wheel_tag}"
10
+
11
+ [tool.scikit-build.ninja]
12
+ make-fallback = false
13
+
14
+ [tool.scikit-build.sdist]
15
+ # Only files matching `include` go into the sdist.
16
+ inclusion-mode = "explicit"
17
+ include = [
18
+ "/castxml/*.py",
19
+ "/CMakeLists.txt",
20
+ "/*.cmake",
21
+ "/pyproject.toml",
22
+ "/README.md", # referenced by project.readme
23
+ "/tests/*.py", # lets downstream packagers test the wheel they build from the sdist
24
+ ]
25
+
26
+ [tool.scikit-build.wheel]
27
+ packages = ["castxml"]
28
+ install-dir = "castxml/data"
29
+ # The wheel ships a standalone executable, not an extension module, so tag it
30
+ # py3-none-<platform> instead of tying it to one CPython version.
31
+ py-api = "py3"
32
+
33
+ [project]
34
+ name = "castxml"
35
+ dynamic = ["version"] # supplied by setuptools-scm from git tags
36
+ description = "Parse C-family source files and optionally write a subset of the Abstract Syntax Tree (AST) to a representation in XML."
37
+ readme = "README.md"
38
+ requires-python = ">=3"
39
+ license = "Apache-2.0"
40
+ authors = [
41
+ {name = "Kitware", email = "kitware@kitware.com"},
42
+ ]
43
+ maintainers = [
44
+ {name = "John Parent", email = "john.parent@kitware.com"},
45
+ ]
46
+ keywords = ["castxml", "ast", "xml", "cmake", "cross-platform", "c++", "llvm", "build"]
47
+ classifiers = [
48
+ "Development Status :: 5 - Production/Stable",
49
+ "Intended Audience :: Developers",
50
+ "Operating System :: OS Independent",
51
+ "Programming Language :: C",
52
+ "Programming Language :: C++",
53
+ "Programming Language :: Python",
54
+ "Programming Language :: Python :: 3",
55
+ "Programming Language :: Python :: 3 :: Only",
56
+ "Topic :: Software Development :: Build Tools",
57
+ ]
58
+ # The package only wraps the CastXML executable, so there are no runtime dependencies.
59
+ dependencies = []
60
+
61
+ [project.urls]
62
+ Homepage = "https://github.com/castxml/castxml"
63
+ Documentation = "https://github.com/CastXML/CastXML/blob/master/doc/manual/castxml.1.rst"
64
+ Repository = "https://github.com/CastXML/CastXML-python-distributions"
65
+ Issues = "https://github.com/CastXML/CastXML-python-distributions/issues"
66
+
67
+ [project.scripts]
68
+ castxml = "castxml:castxml"
69
+
70
+ [dependency-groups]
71
+ test = [
72
+ "path",
73
+ "pytest>=9", # needed for the native [tool.pytest] table below
74
+ "pytest-virtualenv",
75
+ ]
76
+ lint = ["flake8>=7"]
77
+ release = ["build", "twine"]
78
+ dev = [
79
+ {include-group = "test"},
80
+ {include-group = "lint"},
81
+ ]
82
+
83
+ [tool.pytest]
84
+ testpaths = ["tests"]
85
+ addopts = ["-v", "--import-mode=importlib"]
86
+
87
+ [[tool.dynamic-metadata]]
88
+ provider = "scikit_build_core.metadata.setuptools_scm"
89
+
90
+ [tool.setuptools_scm]
91
+ version_file = "castxml/_version.py"
92
+
93
+ [tool.cibuildwheel]
94
+ manylinux-x86_64-image = "manylinux2014"
95
+ manylinux-aarch64-image = "manylinux_2_28"
96
+ # Each wheel build compiles LLVM/Clang, so build only for the runner's own
97
+ # architecture (no 32-bit or cross builds), and skip musllinux, which would
98
+ # be a second LLVM build on every Linux runner.
99
+ archs = ["native"]
100
+ skip = ["*-musllinux_*"]
101
+
102
+ test-requires = "pytest"
103
+ test-command = "pytest --import-mode=importlib {project}/tests/test_castxml.py"
104
+
105
+ [tool.cibuildwheel.windows]
106
+ # Build with Ninja instead of Visual Studio/MSBuild: much faster for LLVM, and
107
+ # the superbuild switches its LLVM/Clang/CastXML builds to Ninja whenever it
108
+ # finds ninja anyway. The workflow sets up the MSVC environment Ninja needs.
109
+ #
110
+ # Build in a short directory at the drive root. The LLVM build nests deeply
111
+ # (FetchContent, then the superbuild's ExternalProjects), and under the default
112
+ # %TEMP%\cibw-sdist-*\castxml-<version>\build\<wheel tag> its paths exceed what
113
+ # the MSVC tools can open (MAX_PATH), even with Windows long paths enabled.
114
+ environment = { CMAKE_GENERATOR = "Ninja", SKBUILD_BUILD_DIR = "C:/cxb" }
@@ -0,0 +1,12 @@
1
+
2
+ import sys
3
+
4
+ from contextlib import contextmanager
5
+
6
+
7
+ @contextmanager
8
+ def push_argv(argv):
9
+ old_argv = sys.argv
10
+ sys.argv = argv
11
+ yield
12
+ sys.argv = old_argv
@@ -0,0 +1,18 @@
1
+
2
+ import pytest
3
+
4
+ import castxml
5
+
6
+ from . import push_argv
7
+
8
+
9
+ def _run(program, args):
10
+ func = getattr(castxml, program)
11
+ args = ["%s.py" % program] + args
12
+ with push_argv(args), pytest.raises(SystemExit) as excinfo:
13
+ func()
14
+ assert 0 == excinfo.value.code
15
+
16
+
17
+ def test_castxml_module():
18
+ _run("castxml", ["--version"])
@@ -0,0 +1,29 @@
1
+
2
+ import os
3
+ import pytest
4
+
5
+ from path import Path
6
+
7
+ DIST_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../dist'))
8
+
9
+
10
+ def _check_castxml_install(virtualenv, tmpdir):
11
+ expected_version = "0.8.0"
12
+
13
+ for executable_name in ["castxml"]:
14
+ output = virtualenv.run(
15
+ "%s --version" % executable_name, capture=True).splitlines()[0]
16
+ assert output == "%s version %s" % (executable_name, expected_version)
17
+
18
+
19
+ @pytest.mark.skipif(not Path(DIST_DIR).exists(), reason="dist directory does not exist")
20
+ def test_wheel(virtualenv, tmpdir):
21
+ wheels = Path(DIST_DIR).files(match="*.whl")
22
+ if not wheels:
23
+ pytest.skip("no wheel available")
24
+ assert len(wheels) == 1
25
+ print(wheels)
26
+
27
+ virtualenv.run("pip install --no-index %s" % wheels[0])
28
+
29
+ _check_castxml_install(virtualenv, tmpdir)