Skip to content

Commit

Permalink
Merge pull request #247064 from tjni/cmake
Browse files Browse the repository at this point in the history
python3.pkgs.cmake: init stub at 3.26.4
  • Loading branch information
tjni authored Aug 16, 2023
2 parents ffe4cde + d856935 commit c306c88
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 2 deletions.
42 changes: 42 additions & 0 deletions pkgs/development/python-modules/cmake/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
17 changes: 17 additions & 0 deletions pkgs/development/python-modules/cmake/stub/cmake/__init__.py
Original file line number Diff line number Diff line change
@@ -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:]))
13 changes: 13 additions & 0 deletions pkgs/development/python-modules/cmake/stub/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
10 changes: 8 additions & 2 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,9 @@ self: super: with self; {

awkward = callPackage ../development/python-modules/awkward { };

awkward-cpp = callPackage ../development/python-modules/awkward-cpp { };
awkward-cpp = callPackage ../development/python-modules/awkward-cpp {
inherit (pkgs) cmake;
};

aws-adfs = callPackage ../development/python-modules/aws-adfs { };

Expand Down Expand Up @@ -2033,6 +2035,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 { };
Expand Down Expand Up @@ -11359,7 +11363,9 @@ self: super: with self; {

scikit-build = callPackage ../development/python-modules/scikit-build { };

scikit-build-core = callPackage ../development/python-modules/scikit-build-core { };
scikit-build-core = callPackage ../development/python-modules/scikit-build-core {
inherit (pkgs) cmake;
};

scikit-fmm = callPackage ../development/python-modules/scikit-fmm { };

Expand Down

0 comments on commit c306c88

Please sign in to comment.