lgpio: document pyProject options & use lib.optionalString

This commit is contained in:
Doron Behar
2025-06-13 10:12:11 +03:00
parent 740c292864
commit 0bdfa8921f
+18 -23
View File
@@ -6,7 +6,14 @@
# If we build the python packages, these two are not null
buildPythonPackage ? null,
lgpioWithoutPython ? null,
# When building a python Packages, this specifies the python subproject
# When building a python Packages, this specifies the python subproject - a
# folder in the repository. The current options are:
#
# - <empty>
# - PY_LGPIO
# - PY_RGPIO
#
# Where an empty value means 'build the non python project'.
pyProject ? "",
}:
@@ -28,30 +35,18 @@ mkDerivation rec {
swig
];
preConfigure =
if pyProject != "" then
''
cd ${pyProject}
''
else
"";
preConfigure = lib.optionalString (pyProject != "") ''
cd ${pyProject}
'';
# Emulate ldconfig when building the C API
postConfigure =
if pyProject == "" then
''
substituteInPlace Makefile \
--replace ldconfig 'echo ldconfig'
''
else
"";
postConfigure = lib.optionalString (pyProject == "") ''
substituteInPlace Makefile \
--replace ldconfig 'echo ldconfig'
'';
preBuild =
if pyProject == "PY_LGPIO" then
''
swig -python lgpio.i
''
else
"";
preBuild = lib.optionalString (pyProject == "PY_LGPIO") ''
swig -python lgpio.i
'';
buildInputs = [
lgpioWithoutPython