From 00d73c42407d22cb94bac67ca889318e1c373787 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Thu, 13 Jul 2017 04:49:21 +0300 Subject: [PATCH] python2Packages.pyslurm: init --- .../python-modules/pyslurm/default.nix | 24 +++++++++++++++++++ .../pyslurm/pyslurm-dlfcn.patch | 18 ++++++++++++++ pkgs/top-level/python-packages.nix | 4 ++++ 3 files changed, 46 insertions(+) create mode 100644 pkgs/development/python-modules/pyslurm/default.nix create mode 100644 pkgs/development/python-modules/pyslurm/pyslurm-dlfcn.patch diff --git a/pkgs/development/python-modules/pyslurm/default.nix b/pkgs/development/python-modules/pyslurm/default.nix new file mode 100644 index 000000000000..2acdef1b372e --- /dev/null +++ b/pkgs/development/python-modules/pyslurm/default.nix @@ -0,0 +1,24 @@ +{ lib, fetchFromGitHub, buildPythonPackage, cython, slurm }: + +buildPythonPackage rec { + name = "pyslurm"; + + src = fetchFromGitHub { + repo = "pyslurm"; + owner = "PySlurm"; + rev = "69e4f4fd66003b98ddb7da25613fe641d4ae160d"; + sha256 = "051kafkndbniklxyf0drb360aiblnqcf9rqjbvmqh66zrfya1m28"; + }; + + patches = [ ./pyslurm-dlfcn.patch ]; + + buildInputs = [ cython slurm ]; + setupPyBuildFlags = [ "--slurm-lib=${slurm}/lib" "--slurm-inc=${slurm.dev}/include" ]; + + meta = with lib; { + homepage = "https://github.com/PySlurm/pyslurm"; + description = "Python bindings to Slurm"; + license = licenses.gpl2; + maintainers = [ maintainers.veprbl ]; + }; +} diff --git a/pkgs/development/python-modules/pyslurm/pyslurm-dlfcn.patch b/pkgs/development/python-modules/pyslurm/pyslurm-dlfcn.patch new file mode 100644 index 000000000000..2b3798a30706 --- /dev/null +++ b/pkgs/development/python-modules/pyslurm/pyslurm-dlfcn.patch @@ -0,0 +1,18 @@ +diff --git a/pyslurm/__init__.py b/pyslurm/__init__.py +index 81643e1..e8b6836 100644 +--- a/pyslurm/__init__.py ++++ b/pyslurm/__init__.py +@@ -11,8 +11,11 @@ import sys + old_dlopen_flags = '' + if hasattr(sys, "setdlopenflags"): + old_dlopen_flags = sys.getdlopenflags() +- import DLFCN +- sys.setdlopenflags(old_dlopen_flags | DLFCN.RTLD_GLOBAL) ++ if sys.version_info >= (3,6): ++ from os import RTLD_GLOBAL ++ else: ++ from DLFCN import RTLD_GLOBAL ++ sys.setdlopenflags(old_dlopen_flags | RTLD_GLOBAL) + + from .pyslurm import * + diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6f3adb9d9d50..ea89b736beba 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -324,6 +324,10 @@ in { pysideTools = callPackage ../development/python-modules/pyside/tools.nix { }; + pyslurm = callPackage ../development/python-modules/pyslurm { + slurm = pkgs.slurm; + }; + python-sql = callPackage ../development/python-modules/python-sql { }; python-stdnum = callPackage ../development/python-modules/python-stdnum { };