If a Python package does not come with either `format` or `pyproject` we consider it a setuptools build, that calls `setup.py` directly, which is deprecated. This change, as a first step, migrates a large chunk of these packages to set setuptools as their explicit format This is so we can unify the problem space for the next step of the migration.
48 lines
1.2 KiB
Nix
48 lines
1.2 KiB
Nix
{
|
|
lib,
|
|
buildPythonApplication,
|
|
pkgsBuildTarget,
|
|
python,
|
|
minijail,
|
|
}:
|
|
|
|
let
|
|
targetClang = pkgsBuildTarget.targetPackages.clangStdenv.cc;
|
|
in
|
|
|
|
buildPythonApplication {
|
|
format = "setuptools";
|
|
pname = "minijail-tools";
|
|
inherit (minijail) version src;
|
|
|
|
postPatch = ''
|
|
substituteInPlace Makefile --replace /bin/echo echo
|
|
'';
|
|
|
|
postConfigure = ''
|
|
substituteInPlace tools/compile_seccomp_policy.py \
|
|
--replace "'constants.json'" "'$out/share/constants.json'"
|
|
'';
|
|
|
|
preBuild = ''
|
|
make libconstants.gen.c libsyscalls.gen.c
|
|
${targetClang}/bin/${targetClang.targetPrefix}cc -S -emit-llvm \
|
|
libconstants.gen.c libsyscalls.gen.c
|
|
${python.pythonOnBuildForHost.interpreter} tools/generate_constants_json.py \
|
|
--output constants.json \
|
|
libconstants.gen.ll libsyscalls.gen.ll
|
|
'';
|
|
|
|
postInstall = ''
|
|
mkdir -p $out/share
|
|
cp -v constants.json $out/share/constants.json
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://android.googlesource.com/platform/external/minijail/+/refs/heads/master/tools/";
|
|
description = "Set of tools for minijail";
|
|
license = licenses.asl20;
|
|
inherit (minijail.meta) maintainers platforms;
|
|
};
|
|
}
|