Unverified Commit c81c467d authored by Theodore Ni's avatar Theodore Ni
Browse files

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.
parent e7ced436
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
{ 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 ];
  };
}
+17 −0
Original line number Diff line number Diff line
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:]))
+13 −0
Original line number Diff line number Diff line
[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"
+2 −0
Original line number Diff line number Diff line
@@ -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 { };