about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/esptool/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/esptool/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/misc/esptool/default.nix42
1 files changed, 15 insertions, 27 deletions
diff --git a/nixpkgs/pkgs/tools/misc/esptool/default.nix b/nixpkgs/pkgs/tools/misc/esptool/default.nix
index e48e02694052..d7bf8a9b9031 100644
--- a/nixpkgs/pkgs/tools/misc/esptool/default.nix
+++ b/nixpkgs/pkgs/tools/misc/esptool/default.nix
@@ -1,21 +1,19 @@
-{ lib, fetchFromGitHub, python3, openssl }:
+{ lib
+, fetchFromGitHub
+, python3
+}:
 
 python3.pkgs.buildPythonApplication rec {
   pname = "esptool";
-  version = "3.3.1";
+  version = "4.5.1";
 
   src = fetchFromGitHub {
     owner = "espressif";
     repo = "esptool";
     rev = "v${version}";
-    hash = "sha256-9WmiLji7Zoad5WIzgkpvkI9t96sfdkCtFh6zqVxF7qo=";
+    hash = "sha256-FKFw7czXzC8F3OXjlLoJEFaqsSgqWz0ZEqd7KjCy5Ik=";
   };
 
-  postPatch = ''
-    substituteInPlace test/test_imagegen.py \
-      --replace "sys.executable, ESPTOOL_PY" "ESPTOOL_PY"
-  '';
-
   propagatedBuildInputs = with python3.pkgs; [
     bitstring
     cryptography
@@ -24,31 +22,20 @@ python3.pkgs.buildPythonApplication rec {
     reedsolo
   ];
 
-  # wrapPythonPrograms will overwrite esptool.py with a bash script,
-  # but espefuse.py tries to import it. Since we don't add any binary paths,
-  # use patchPythonScript directly.
-  dontWrapPythonPrograms = true;
-  postFixup = ''
-    buildPythonPath "$out $pythonPath"
-    for f in $out/bin/*.py; do
-        echo "Patching $f"
-        patchPythonScript "$f"
-    done
-  '';
-
-  checkInputs = with python3.pkgs; [
+  nativeCheckInputs = with python3.pkgs; [
     pyelftools
+    pytestCheckHook
   ];
 
   # tests mentioned in `.github/workflows/test_esptool.yml`
   checkPhase = ''
     runHook preCheck
 
-    export ESPTOOL_PY=$out/bin/esptool.py
-    ${python3.interpreter} test/test_imagegen.py
-    ${python3.interpreter} test/test_espsecure.py
-    ${python3.interpreter} test/test_merge_bin.py
-    ${python3.interpreter} test/test_modules.py
+    pytest test/test_imagegen.py
+    pytest test/test_espsecure.py
+    pytest test/test_merge_bin.py
+    pytest test/test_image_info.py
+    pytest test/test_modules.py
 
     runHook postCheck
   '';
@@ -58,6 +45,7 @@ python3.pkgs.buildPythonApplication rec {
     homepage = "https://github.com/espressif/esptool";
     license = licenses.gpl2Plus;
     maintainers = with maintainers; [ dezgeg dotlambda ] ++ teams.lumiguide.members;
-    platforms = platforms.linux;
+    platforms = with platforms; linux ++ darwin;
+    mainProgram = "esptool.py";
   };
 }