about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/cmake')
-rw-r--r--nixpkgs/pkgs/development/python-modules/cmake/default.nix43
-rw-r--r--nixpkgs/pkgs/development/python-modules/cmake/stub/cmake/__init__.py19
-rw-r--r--nixpkgs/pkgs/development/python-modules/cmake/stub/pyproject.toml13
3 files changed, 75 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/cmake/default.nix b/nixpkgs/pkgs/development/python-modules/cmake/default.nix
new file mode 100644
index 000000000000..c9ee7d11c8fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/cmake/default.nix
@@ -0,0 +1,43 @@
+{ 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 version \
+      --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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/python-modules/cmake/stub/cmake/__init__.py b/nixpkgs/pkgs/development/python-modules/cmake/stub/cmake/__init__.py
new file mode 100644
index 000000000000..512a13f3d94a
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/cmake/stub/cmake/__init__.py
@@ -0,0 +1,19 @@
+import os
+import subprocess
+import sys
+
+__version__ = '@version@'
+
+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:]))
diff --git a/nixpkgs/pkgs/development/python-modules/cmake/stub/pyproject.toml b/nixpkgs/pkgs/development/python-modules/cmake/stub/pyproject.toml
new file mode 100644
index 000000000000..f5c0502a3b7f
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/cmake/stub/pyproject.toml
@@ -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"