about summary refs log tree commit diff
path: root/pkgs/by-name/py
diff options
context:
space:
mode:
authorAnderson Torres <torres.anderson.85@protonmail.com>2024-03-08 15:26:06 -0300
committerAnderson Torres <torres.anderson.85@protonmail.com>2024-03-22 13:56:01 -0300
commit63efbf86e1dc9a37f10d550c0e4fc6d6a4c9d124 (patch)
treed09c8f7dccafe451250a5a9737bff1746495c518 /pkgs/by-name/py
parent2caf614765bb653fc2b3b18dea1343665b43cc89 (diff)
pyp: migrate it to by-name hierarchy
Since it is not used as library, it makes no sense to deploy it as a library.

(cherry picked from commit cd975261c7594517908b1c39d39a9197baf3b28d)
Diffstat (limited to 'pkgs/by-name/py')
-rw-r--r--pkgs/by-name/py/pyp/package.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/pkgs/by-name/py/pyp/package.nix b/pkgs/by-name/py/pyp/package.nix
new file mode 100644
index 0000000000000..08f3fdc63d491
--- /dev/null
+++ b/pkgs/by-name/py/pyp/package.nix
@@ -0,0 +1,60 @@
+{ lib
+, bc
+, fetchFromGitHub
+, jq
+, python3
+}:
+
+let
+  pythonPackages = python3.pkgs;
+  finalAttrs = {
+    pname = "pyp";
+    version = "1.2.0";
+
+    src = fetchFromGitHub {
+      owner = "hauntsaninja";
+      repo = "pyp";
+      rev = "refs/tags/v${finalAttrs.version}";
+      hash = "sha256-hnEgqWOIVj2ugOhd2aS9IulfkVnrlkhwOtrgH4qQqO8=";
+    };
+
+    pyproject = true;
+
+    build-system = with pythonPackages; [
+      flit-core
+    ];
+
+    nativeCheckInputs = (with pythonPackages; [
+      pytestCheckHook
+    ]) ++ [
+      bc
+      jq
+    ];
+
+    pythonImportsCheck = [
+      "pyp"
+    ];
+
+    # without this, the tests fail because they are unable to find the pyp tool
+    # itself...
+    preCheck = ''
+      _OLD_PATH_=$PATH
+      PATH=$out/bin:$PATH
+   '';
+
+    # And a cleanup!
+    postCheck = ''
+      PATH=$_OLD_PATH_
+    '';
+
+    meta = {
+      homepage = "https://github.com/hauntsaninja/pyp";
+      description = "Easily run Python at the shell";
+      changelog = "https://github.com/hauntsaninja/pyp/blob/${finalAttrs.version}/CHANGELOG.md";
+      license = with lib.licenses; [ mit ];
+      mainProgram = "pyp";
+      maintainers = with lib.maintainers; [ rmcgibbo AndersonTorres ];
+    };
+  };
+in
+pythonPackages.buildPythonPackage finalAttrs