Skip to content

Commit

Permalink
python3Packages.pyepics: init at 3.5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
minijackson committed Jul 2, 2024
1 parent be5ebea commit 2f7bd2c
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ in
++ [
(final: prev: {
lewis = final.callPackage ./epnix/tools/lewis {};
pyepics = final.callPackage ./epnix/python-modules/pyepics {};
scanf = final.callPackage ./epnix/tools/scanf {};
})
];
Expand Down Expand Up @@ -61,7 +62,7 @@ in

ca-gateway = callPackage ./epnix/tools/ca-gateway {};

inherit (final.python3Packages) lewis;
inherit (final.python3Packages) lewis pyepics;
inherit (callPackage ./epnix/tools/lewis/lib.nix {}) mkLewisSimulator;

pcas = callPackage ./epnix/tools/pcas {};
Expand Down
64 changes: 64 additions & 0 deletions pkgs/epnix/python-modules/pyepics/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
stdenv,
epnix,
epnixLib,
buildPythonPackage,
fetchPypi,
setuptools,
setuptools-scm,
pyparsing,
numpy,
importlib-resources,
}:
buildPythonPackage rec {
pname = "pyepics";
version = "3.5.6";
format = "pyproject";

src = fetchPypi {
inherit pname version;
hash = "sha256-NYj8EVZHTgZR13DZ46ggXRFkqBROJI/CzaNghB7OCwc=";
};

nativeBuildInputs = [
setuptools
setuptools-scm
];

buildInputs = [epnix.epics-base];

propagatedBuildInputs = [
pyparsing
numpy
importlib-resources
];

postInstall = let
# TODO: this only works for x86_64-linux
inherit (stdenv) hostPlatform;
kernel = hostPlatform.parsed.kernel.name;
arch =
if hostPlatform.isx86
then ""
else hostPlatform.parsed.cpu.family;
bits = toString hostPlatform.parsed.cpu.bits;
system = "${kernel}${arch}${bits}";

epicsSystem = epnixLib.toEpicsArch hostPlatform;
in ''
clibsDir=($out/lib/python*/site-packages/epics/clibs)
rm -rf $clibsDir/*/
mkdir $clibsDir/${system}
# No need to copy libCom, since libca depend on it
ln -st $clibsDir/${system} ${epnix.epics-base}/lib/${epicsSystem}/libca.so
'';

pythonImportsCheck = ["epics"];

meta = {
description = "Python interface to Epics Channel Access";
homepage = "https://github.com/pyepics/pyepics";
license = epnixLib.licenses.epics;
maintainers = with epnixLib.maintainers; [minijackson];
};
}

0 comments on commit 2f7bd2c

Please sign in to comment.