python-cmake-format: new package for formatting CMakeLists.txt files (#24708)

* python-cmake-format: new package for formatting CMakeLists.txt files

- tried to get modern python -m build to work with this package, but it
  wouldn't build properly with it.  Reverting to python setup.py bdist_wheel
  works.

- This package provides tools for parsing and providing a consistent format
  for CMakeLists.txt files.

* rename to cmakelang to match project name

and to match what other distros call it

---------

Co-authored-by: Christoph Reiter <reiter.christoph@gmail.com>
This commit is contained in:
Chris Gorman 2025-07-28 15:20:48 -04:00 committed by GitHub
parent 536974b878
commit 24464332e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,60 @@
# Maintainer: Chris Gorman <chrisjohgorman@gmail.com>
_realname=cmakelang
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.6.13
pkgrel=1
pkgdesc="Source code formater for CMake listfiles (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/cheshirekow/cmake_format'
license=('GPL-3.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-python"
"${MINGW_PACKAGE_PREFIX}-python-six"
"git")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-installer"
"${MINGW_PACKAGE_PREFIX}-python-setuptools")
optdepends=("${MINGW_PACKAGE_PREFIX}-python-jinja"
"${MINGW_PACKAGE_PREFIX}-python-yaml"
"${MINGW_PACKAGE_PREFIX}-python-argcomplete")
options=('!strip')
_commit='904c42da298f7fda932d9ac774517c20e2667fb8'
source=("${_realname}"::"git+https://github.com/cheshirekow/cmake_format.git#commit=${_commit}")
sha256sums=('db1cdeb4bc4bac7896285f3b4bfa5b0af25cd187ca7454eeacfc8bb97d700e66')
build() {
cp -r "cmakelang" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"
# if we don't rename the jinja.py files the build process includes them and then we get an
# error in packaging. step 1 rename the files to not have .py extensions.
find cmakelang -name "*.jinja.py" -exec sh -c 'mv "$1" "${1%.py}"' _ {} \;
python cmakelang/pypi/setup.py bdist_wheel
# step 2 move the renamed .jinja files back to having .py extensions.
find cmakelang -name "*.jinja" -exec mv {} {}.py \;
}
package() {
cd "python-build-${MSYSTEM}"
MSYS2_ARG_CONV_EXCL="--prefix=" \
python -m installer --prefix=${MINGW_PREFIX} \
--destdir="${pkgdir}" dist/cmake_format*.whl
MSYS2_ARG_CONV_EXCL="--prefix=" \
python -m installer --prefix=${MINGW_PREFIX} \
--destdir="${pkgdir}" dist/cmake_lint*.whl
MSYS2_ARG_CONV_EXCL="--prefix=" \
python -m installer --prefix=${MINGW_PREFIX} \
--destdir="${pkgdir}" dist/cmake_parse*.whl
MSYS2_ARG_CONV_EXCL="--prefix=" \
python -m installer --prefix=${MINGW_PREFIX} \
--destdir="${pkgdir}" dist/cmakelang*.whl
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}