From 80887851ff201e53740a1fe037a900b4b8aeb9dd Mon Sep 17 00:00:00 2001 From: tali auster Date: Wed, 15 Nov 2023 15:51:05 -0700 Subject: [PATCH] e3-core: init at 22.3.1 --- .../e3-core/0001-use-distro-over-ld.patch | 42 ++++++++++++ .../python-modules/e3-core/default.nix | 65 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 109 insertions(+) create mode 100644 pkgs/development/python-modules/e3-core/0001-use-distro-over-ld.patch create mode 100644 pkgs/development/python-modules/e3-core/default.nix diff --git a/pkgs/development/python-modules/e3-core/0001-use-distro-over-ld.patch b/pkgs/development/python-modules/e3-core/0001-use-distro-over-ld.patch new file mode 100644 index 000000000000..15548b7aec1c --- /dev/null +++ b/pkgs/development/python-modules/e3-core/0001-use-distro-over-ld.patch @@ -0,0 +1,42 @@ +From 189681bbfb703a7026ca7bbb3b21ef554807b144 Mon Sep 17 00:00:00 2001 +From: tali auster +Date: Wed, 15 Nov 2023 12:15:34 -0700 +Subject: [PATCH] use distro over ld + +The `ld` module (linux distribution) was renamed to `distro`, presumably +so as not to subsume binutils name. + +--- + setup.py | 2 +- + src/e3/os/platform.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/setup.py b/setup.py +index c32f46f..de1ada6 100644 +--- a/setup.py ++++ b/setup.py +@@ -25,7 +25,7 @@ for p in ("darwin", "linux", "linux2", "win32"): + platform_string = ":sys_platform=='%s'" % p + extras_require[platform_string] = ["psutil"] + if p in ("linux", "linux2"): +- extras_require[platform_string].append("ld") ++ extras_require[platform_string].append("distro") + + # Get e3 version from the VERSION file. + version_file = os.path.join(os.path.dirname(__file__), "VERSION") +diff --git a/src/e3/os/platform.py b/src/e3/os/platform.py +index 2d4e174..a9d12d3 100644 +--- a/src/e3/os/platform.py ++++ b/src/e3/os/platform.py +@@ -78,7 +78,7 @@ class SystemInfo: + + # Fetch linux distribution info on linux OS + if cls.uname.system == "Linux": # linux-only +- import ld ++ import distro as ld + + cls.ld_info = { + "name": ld.name(), +-- +2.40.1 + diff --git a/pkgs/development/python-modules/e3-core/default.nix b/pkgs/development/python-modules/e3-core/default.nix new file mode 100644 index 000000000000..95759b6a096c --- /dev/null +++ b/pkgs/development/python-modules/e3-core/default.nix @@ -0,0 +1,65 @@ +{ buildPythonPackage +, colorama +, coverage +, distro +, fetchFromGitHub +, httpretty +, lib +, mock +, psutil +, pytest +, pytest-socket +, python-dateutil +, pyyaml +, requests +, requests-toolbelt +, stdenv +, setuptools +, stevedore +, tomlkit +, tox +, tqdm +, typeguard +}: + +buildPythonPackage rec { + pname = "e3-core"; + version = "22.3.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "AdaCore"; + repo = "e3-core"; + rev = "v${version}"; + hash = "sha256-4StHOJldfeqApdF6D14Euzg9HvZ2e7G4/OQ0UrEbEIw="; + }; + + patches = [ ./0001-use-distro-over-ld.patch ]; + + nativeBuildInputs = [ setuptools ]; + + propagatedBuildInputs = [ + colorama pyyaml python-dateutil requests requests-toolbelt tqdm stevedore + ] ++ lib.optional stdenv.isLinux [ + # See setup.py:24. These are required only on Linux. Darwin has its own set + # of requirements. + psutil distro + ]; + + pythonImportsCheck = [ "e3" ]; + + # e3-core is tested with tox; it's hard to test without internet. + doCheck = false; + + meta = with lib; { + changelog = "https://github.com/AdaCore/e3-core/releases/tag/${src.rev}"; + homepage = "https://github.com/AdaCore/e3-core/"; + description = "Core framework for developing portable automated build systems"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ atalii ]; + mainProgram = "e3"; + # See the comment regarding distro and psutil. Other platforms are supported + # upstream, but not by this package. + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 922e5a1b792e..8fd8f75413a3 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3412,6 +3412,8 @@ self: super: with self; { dynd = callPackage ../development/python-modules/dynd { }; + e3-core = callPackage ../development/python-modules/e3-core { }; + eagle100 = callPackage ../development/python-modules/eagle100 { }; easydict = callPackage ../development/python-modules/easydict { };