From 910947799a4d50207d800568dcc14b305c52c9b4 Mon Sep 17 00:00:00 2001 From: bdim Date: Thu, 30 Jul 2026 20:15:52 +0800 Subject: [PATCH] pymp4: init at 1.4.0 Assisted-by: OpenAI Codex (GPT-5) --- .../pymp4/construct-2.10.70.patch | 16 ++++++++ .../python-modules/pymp4/default.nix | 40 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 58 insertions(+) create mode 100644 pkgs/development/python-modules/pymp4/construct-2.10.70.patch create mode 100644 pkgs/development/python-modules/pymp4/default.nix diff --git a/pkgs/development/python-modules/pymp4/construct-2.10.70.patch b/pkgs/development/python-modules/pymp4/construct-2.10.70.patch new file mode 100644 index 000000000000..bf3447083ca6 --- /dev/null +++ b/pkgs/development/python-modules/pymp4/construct-2.10.70.patch @@ -0,0 +1,16 @@ +--- a/src/pymp4/parser.py ++++ b/src/pymp4/parser.py +@@ -16,0 +17 @@ ++from io import BytesIO +@@ -643,0 +645,8 @@ ++class RelativePrefixed(Prefixed): ++ def _parse(self, stream, context, path): ++ length = self.lengthfield._parsereport(stream, context, path) ++ if self.includelength: ++ length -= self.lengthfield._sizeof(context, path) ++ data = stream_read(stream, length, path) ++ return self.subcon._parsereport(BytesIO(data), context, path) ++ +@@ -645 +654 @@ +-Box = Prefixed(Int32ub, Struct( ++Box = RelativePrefixed(Int32ub, Struct( diff --git a/pkgs/development/python-modules/pymp4/default.nix b/pkgs/development/python-modules/pymp4/default.nix new file mode 100644 index 000000000000..80b3eeeffade --- /dev/null +++ b/pkgs/development/python-modules/pymp4/default.nix @@ -0,0 +1,40 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + construct, + pytestCheckHook, +}: + +buildPythonPackage { + pname = "pymp4"; + version = "1.4.0-unstable-2023-08-07"; + pyproject = true; + + src = fetchFromGitHub { + owner = "devine-dl"; + repo = "pymp4"; + rev = "33dc5d620f361cb49d713b60dcb2686ab8696f91"; + hash = "sha256-tPIbehjYHg5+S62sorsWow+u/eBkqJYf6xMI8q4vEgY="; + }; + + patches = [ ./construct-2.10.70.patch ]; + + pythonRelaxDeps = [ "construct" ]; + + build-system = [ poetry-core ]; + + dependencies = [ construct ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + pythonImportsCheck = [ "pymp4" ]; + + meta = { + description = "Python library for parsing and manipulating MP4 files"; + homepage = "https://github.com/devine-dl/pymp4"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ bdim404 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ef8c6c3b8287..4672ed8ce10e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -15119,6 +15119,8 @@ self: super: with self; { pymorphy3-dicts-uk = callPackage ../development/python-modules/pymorphy3-dicts-uk { }; + pymp4 = callPackage ../development/python-modules/pymp4 { }; + pympler = callPackage ../development/python-modules/pympler { }; pymsgbox = callPackage ../development/python-modules/pymsgbox { };