Merge pull request #278944 from jwijenbergh/eduvpn-client

eduvpn-client: init at 4.2.0
This commit is contained in:
Thiago Kenji Okada 2024-01-09 13:26:00 +00:00 committed by GitHub
commit b4b4478682
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 176 additions and 0 deletions

View File

@ -0,0 +1,13 @@
diff --git a/eduvpn/utils.py b/eduvpn/utils.py
index db0bf0c..76fc52a 100644
--- a/eduvpn/utils.py
+++ b/eduvpn/utils.py
@@ -69,7 +69,7 @@ def get_prefix() -> str:
"""
target = "share/eduvpn/builder/mainwindow.ui"
local = path.dirname(path.dirname(path.abspath(__file__)))
- options = [local, path.expanduser("~/.local"), "/usr/local", prefix]
+ options = ["@out@"]
for option in options:
logger.debug(f"looking for '{target}' in '{option}'")
if path.isfile(path.join(option, target)):

View File

@ -0,0 +1,60 @@
{ lib
, fetchurl
, gdk-pixbuf
, gobject-introspection
, gtk3
, libnotify
, libsecret
, networkmanager
, python3Packages
, wrapGAppsHook
}:
python3Packages.buildPythonApplication rec {
pname = "eduvpn-client";
version = "4.2.0";
src = fetchurl {
url = "https://github.com/eduvpn/python-${pname}/releases/download/${version}/python-${pname}-${version}.tar.xz";
hash = "sha256-W5z0ykrwWANZmW+lQt6m+BmYPI0cutsamx8V2JrpeHA=";
};
nativeBuildInputs = [
gdk-pixbuf
gobject-introspection
wrapGAppsHook
];
buildInputs = [
gtk3
libnotify
libsecret
networkmanager
];
propagatedBuildInputs = with python3Packages; [
eduvpn-common
pygobject3
setuptools
];
patches = [ ./nix-python-prefix.patch ];
postPatch = ''
substituteInPlace eduvpn/utils.py --subst-var-by out $out
'';
checkInputs = with python3Packages; [
pytestCheckHook
];
meta = with lib; {
changelog = "https://raw.githubusercontent.com/eduvpn/python-eduvpn-client/${version}/CHANGES.md";
description = "Linux client for eduVPN";
homepage = "https://github.com/eduvpn/python-eduvpn-client";
license = licenses.gpl3Plus;
mainProgram = "eduvpn-gui";
maintainers = with maintainers; [ benneti jwijenbergh ];
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,37 @@
{ lib
, buildGoModule
, fetchurl
}:
buildGoModule rec {
pname = "libeduvpn-common";
version = "1.2.0";
src = fetchurl {
url = "https://github.com/eduvpn/eduvpn-common/releases/download/${version}/eduvpn-common-${version}.tar.xz";
hash = "sha256-CqpOgvGGD6pW03fvKUzgoeCz6YgnzuYK2u5Zbw+/Ks4=";
};
vendorHash = null;
buildPhase = ''
runHook preBuild
go build -o ${pname}-${version}.so -buildmode=c-shared -tags=release ./exports
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dt $out/lib ${pname}-${version}.so
runHook postInstall
'';
meta = with lib; {
changelog = "https://raw.githubusercontent.com/eduvpn/eduvpn-common/${version}/CHANGES.md";
description = "Code to be shared between eduVPN clients";
homepage = "https://github.com/eduvpn/eduvpn-common";
maintainers = with maintainers; [ benneti jwijenbergh ];
license = licenses.mit;
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,39 @@
{ lib
, buildPythonPackage
, callPackage
, fetchurl
, libeduvpn-common
, selenium
, setuptools
}:
buildPythonPackage rec {
inherit (libeduvpn-common) version src;
pname = "eduvpn-common";
sourceRoot = "${pname}-${version}/wrappers/python";
patches = [ ./use-nix-lib.patch ];
postPatch = ''
substituteInPlace eduvpn_common/loader.py \
--subst-var-by libeduvpn-common ${libeduvpn-common.out}/lib/lib${pname}-${version}.so
'';
format = "pyproject";
propagatedBuildInputs = [
libeduvpn-common
setuptools
];
nativeCheckInputs = [
selenium
];
pythonImportsCheck = [ "eduvpn_common" ];
meta = libeduvpn-common.meta // {
description = "Python wrapper for libeduvpn-common";
};
}

View File

@ -0,0 +1,25 @@
diff --git a/eduvpn_common/loader.py b/eduvpn_common/loader.py
index 673d180..195f8c1 100644
--- a/eduvpn_common/loader.py
+++ b/eduvpn_common/loader.py
@@ -21,6 +21,7 @@ def load_lib() -> CDLL:
:return: The Go shared library loaded with cdll.LoadLibrary from ctypes
:rtype: CDLL
"""
+ return cdll.LoadLibrary("@libeduvpn-common@")
lib_prefixes = defaultdict(
lambda: "lib",
{
diff --git a/setup.py b/setup.py
index 0d23379..a9d7926 100755
--- a/setup.py
+++ b/setup.py
@@ -92,4 +92,6 @@ class bdist_wheel(_bdist_wheel):
self.exports_lib_path = "../../exports/lib" # default
def run(self):
+ _bdist_wheel.run(self)
+ return
self.plat_name_supplied = True # Force use platform
libpath = getlibpath(self.plat_name)

View File

@ -3550,6 +3550,8 @@ self: super: with self; {
inherit (pkgs) edlib;
};
eduvpn-common = callPackage ../development/python-modules/eduvpn-common { };
edward = callPackage ../development/python-modules/edward { };
effdet = callPackage ../development/python-modules/effdet { };