2021-01-25 08:26:54 +00:00
|
|
|
{ lib, fetchFromGitHub, python3, openssl }:
|
2017-05-23 23:44:38 +00:00
|
|
|
|
|
|
|
python3.pkgs.buildPythonApplication rec {
|
2018-07-17 23:16:57 +00:00
|
|
|
pname = "esptool";
|
2022-05-12 08:41:03 +00:00
|
|
|
version = "3.3.1";
|
2017-05-23 23:44:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "espressif";
|
|
|
|
repo = "esptool";
|
|
|
|
rev = "v${version}";
|
2022-05-12 08:41:03 +00:00
|
|
|
hash = "sha256-9WmiLji7Zoad5WIzgkpvkI9t96sfdkCtFh6zqVxF7qo=";
|
2017-05-23 23:44:38 +00:00
|
|
|
};
|
|
|
|
|
2022-05-12 08:41:03 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace test/test_imagegen.py \
|
|
|
|
--replace "sys.executable, ESPTOOL_PY" "ESPTOOL_PY"
|
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
|
|
|
bitstring
|
|
|
|
cryptography
|
|
|
|
ecdsa
|
|
|
|
pyserial
|
|
|
|
reedsolo
|
|
|
|
];
|
2020-11-12 15:24:42 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
'';
|
2017-05-23 23:44:38 +00:00
|
|
|
|
2022-05-12 08:41:03 +00:00
|
|
|
checkInputs = with python3.pkgs; [
|
|
|
|
pyelftools
|
|
|
|
];
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2017-05-23 23:44:38 +00:00
|
|
|
description = "ESP8266 and ESP32 serial bootloader utility";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/espressif/esptool";
|
2021-07-09 17:20:34 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2022-05-24 10:16:25 +00:00
|
|
|
maintainers = with maintainers; [ dezgeg dotlambda ] ++ teams.lumiguide.members;
|
2017-05-23 23:44:38 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|