python3.pkgs.cmake: init stub at 3.26.4

I would like this to be as transparent as possible for Python packages,
so I'm shadowing the top-level cmake attribute by using the same name as
the PyPI package that this replaces.
This commit is contained in:
Theodore Ni 2023-08-03 19:42:04 -07:00
parent e7ced4364b
commit c81c467dce
No known key found for this signature in database
GPG Key ID: 48B67583BDDD4474
4 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,42 @@
{ lib
, buildPythonPackage
, flit-core
, cmake
}:
buildPythonPackage rec {
pname = "cmake";
inherit (cmake) version;
format = "pyproject";
src = ./stub;
postUnpack = ''
substituteInPlace "$sourceRoot/pyproject.toml" \
--subst-var version
substituteInPlace "$sourceRoot/cmake/__init__.py" \
--subst-var-by CMAKE_BIN_DIR "${cmake}/bin"
'';
inherit (cmake) setupHooks;
nativeBuildInputs = [
flit-core
];
pythonImportsCheck = [
"cmake"
];
meta = with lib; {
description = "CMake is an open-source, cross-platform family of tools designed to build, test and package software";
longDescription = ''
This is a stub of the cmake package on PyPI that uses the cmake program
provided by nixpkgs instead of downloading cmake from the web.
'';
homepage = "https://github.com/scikit-build/cmake-python-distributions";
license = licenses.asl20;
maintainers = with maintainers; [ tjni ];
};
}

View File

@ -0,0 +1,17 @@
import os
import subprocess
import sys
CMAKE_BIN_DIR = '@CMAKE_BIN_DIR@'
def _program(name, args):
return subprocess.call([os.path.join(CMAKE_BIN_DIR, name)] + args, close_fds=False)
def cmake():
raise SystemExit(_program('cmake', sys.argv[1:]))
def cpack():
raise SystemExit(_program('cpack', sys.argv[1:]))
def ctest():
raise SystemExit(_program('ctest', sys.argv[1:]))

View File

@ -0,0 +1,13 @@
[build-system]
requires = ["flit_core"]
build-backend = "flit_core.buildapi"
[project]
name = "cmake"
version = "@version@"
description = "CMake is an open-source, cross-platform family oftools designed to build, test and package software"
[project.scripts]
cmake = "cmake:cmake"
cpack = "cmake:cpack"
ctest = "cmake:ctest"

View File

@ -2033,6 +2033,8 @@ self: super: with self; {
cmaes = callPackage ../development/python-modules/cmaes { };
cmake = callPackage ../development/python-modules/cmake { inherit (pkgs) cmake; };
cmarkgfm = callPackage ../development/python-modules/cmarkgfm { };
cmd2 = callPackage ../development/python-modules/cmd2 { };