git.iko.soy/typeable/nixpkgs
on master help sign in
python3Packages.python3-gnutls: init at 3.1.9
commitf49be866a94c73e15252c4967023b18076a66ff3 authorCharlie Hanley <charles.scott.hanley+git@gmail.com> dateSun 19 Sep 2021, 19:33 (5 years ago) parentfde5e30
3 files changed+96
pkgs/development/python-modules/python3-gnutls/default.nix+52 pkgs/development/python-modules/python3-gnutls/libgnutls-path.patch+42 pkgs/top-level/python-packages.nix+2
pkgs/development/python-modules/python3-gnutls/default.nixnew file+52
@@ -0,0 +1,52 @@
1+{ lib, fetchFromGitHub, substituteAll, buildPythonPackage, isPy3k, gnutls
2+, twisted, pyopenssl, service-identity }:
3+
4+buildPythonPackage rec {
5+ pname = "python3-gnutls";
6+ version = "3.1.9";
7+
8+ disabled = !isPy3k;
9+
10+ src = fetchFromGitHub {
11+ owner = "AGProjects";
12+ repo = "python3-gnutls";
13+ rev = "324b78f7cd3d9fe58c89c7f0b2bf94199bd6a6e5"; # version not tagged
14+ sha256 = "sha256-18T8bAHlNERHobsspUFvSC6ulN55nrFFb5aqNwU8T00=";
15+ };
16+
17+ propagatedBuildInputs = [ twisted pyopenssl service-identity ];
18+
19+ patches = [
20+ (substituteAll {
21+ src = ./libgnutls-path.patch;
22+ gnutlslib = "${lib.getLib gnutls}/lib";
23+ })
24+ ];
25+
26+ pythonImportsCheck = [ "gnutls" ];
27+
28+ meta = with lib; {
29+ description = "Python wrapper for the GnuTLS library";
30+ homepage = "https://github.com/AGProjects/python3-gnutls";
31+ license = licenses.lgpl21Plus;
32+ maintainers = with maintainers; [ chanley ];
33+ longDescription = ''
34+ This package provides a high level object oriented wrapper around libgnutls,
35+ as well as low level bindings to the GnuTLS types and functions via ctypes.
36+ The high level wrapper hides the details of accessing the GnuTLS library via
37+ ctypes behind a set of classes that encapsulate GnuTLS sessions, certificates
38+ and credentials and expose them to python applications using a simple API.
39+
40+ The package also includes a Twisted interface that has seamless intergration
41+ with Twisted, providing connectTLS and listenTLS methods on the Twisted
42+ reactor once imported (the methods are automatically attached to the reactor
43+ by simply importing the GnuTLS Twisted interface module).
44+
45+ The high level wrapper is written using the GnuTLS library bindings that are
46+ made available via ctypes. This makes the wrapper very powerful and flexible
47+ as it has direct access to all the GnuTLS internals and is also very easy to
48+ extend without any need to write C code or recompile anything.
49+
50+ '';
51+ };
52+}
pkgs/development/python-modules/python3-gnutls/libgnutls-path.patchnew file+42
@@ -0,0 +1,42 @@
1+diff --git a/gnutls/library/__init__.py b/gnutls/library/__init__.py
2+index c1d898a..b87bd2e 100644
3+--- a/gnutls/library/__init__.py
4++++ b/gnutls/library/__init__.py
5+@@ -18,35 +18,19 @@ def _library_locations(abi_version):
6+ system = _get_system_name()
7+ if system == "darwin":
8+ library_names = ["libgnutls.%d.dylib" % abi_version]
9+- dynamic_loader_env_vars = ["DYLD_LIBRARY_PATH", "LD_LIBRARY_PATH"]
10+- additional_paths = ["/usr/local/lib", "/opt/local/lib", "/sw/lib"]
11+ elif system == "windows":
12+ library_names = ["libgnutls-%d.dll" % abi_version]
13+- dynamic_loader_env_vars = ["PATH"]
14+- additional_paths = ["."]
15+ elif system == "cygwin":
16+ library_names = ["cyggnutls-%d.dll" % abi_version]
17+- dynamic_loader_env_vars = ["LD_LIBRARY_PATH"]
18+- additional_paths = ["/usr/bin"]
19+ else:
20+ # Debian uses libgnutls-deb0.so.28, go figure
21+ library_names = [
22+ "libgnutls.so.%d" % abi_version,
23+ "libgnutls-deb0.so.%d" % abi_version,
24+ ]
25+- dynamic_loader_env_vars = ["LD_LIBRARY_PATH"]
26+- additional_paths = ["/usr/local/lib"]
27+ for library_name in library_names:
28+- for path in (
29+- path
30+- for env_var in dynamic_loader_env_vars
31+- for path in os.environ.get(env_var, "").split(":")
32+- if os.path.isdir(path)
33+- ):
34+- yield os.path.join(path, library_name)
35+- yield library_name
36+- for path in additional_paths:
37+- yield os.path.join(path, library_name)
38++ path = "@gnutlslib@"
39++ yield os.path.join(path, library_name)
40+
41+
42+ def _load_library(abi_versions):
pkgs/top-level/python-packages.nix+2
@@ -7154,6 +7154,8 @@ in {
71547154
71557155 python3-eventlib = callPackage ../development/python-modules/python3-eventlib { };
71567156
7157+ python3-gnutls = callPackage ../development/python-modules/python3-gnutls { };
7158+
71577159 python3-openid = callPackage ../development/python-modules/python3-openid { };
71587160
71597161 python-awair = callPackage ../development/python-modules/python-awair { };