diff --git a/default.nix b/default.nix index 0d1c243..93a43ae 100644 --- a/default.nix +++ b/default.nix @@ -194,13 +194,7 @@ let python = py; }; - postPatch = (passedAttrs.postPatch or "") + '' - # Tell poetry not to resolve the path dependencies. Any version is - # fine ! - yj -tj < pyproject.toml | ${python.interpreter} ${./pyproject-without-path.py} > pyproject.json - yj -jt < pyproject.json > pyproject.toml - rm pyproject.json - ''; + postPatch = (passedAttrs.postPatch or "") + poetryLib.removeTOMLPathDependencies python; meta = meta // { inherit (pyProject.tool.poetry) description homepage; diff --git a/lib.nix b/lib.nix index 68d854f..7081fbc 100644 --- a/lib.nix +++ b/lib.nix @@ -93,6 +93,14 @@ let [ pythonPackages.${drvAttr} or (throw "unsupported build system ${buildSystem}") ] ); + removeTOMLPathDependencies = python: '' + # Tell poetry not to resolve the path dependencies. Any version is + # fine ! + ${pkgs.yj}/bin/yj -tj < pyproject.toml | ${python.interpreter} ${./pyproject-without-path.py} > pyproject.json + ${pkgs.yj}/bin/yj -jt < pyproject.json > pyproject.toml + rm pyproject.json + ''; + in { inherit @@ -101,5 +109,6 @@ in isCompatible readTOML getBuildSystemPkgs + removeTOMLPathDependencies ; } diff --git a/mk-poetry-dep.nix b/mk-poetry-dep.nix index ab49f5d..6c724ed 100644 --- a/mk-poetry-dep.nix +++ b/mk-poetry-dep.nix @@ -106,7 +106,9 @@ pythonPackages.callPackage ( # Stripping pre-built wheels lead to `ELF load command address/offset not properly aligned` dontStrip = format == "wheel"; - nativeBuildInputs = if (!isSource && (getManyLinuxDeps fileInfo.name).str != null) then [ autoPatchelfHook ] else []; + nativeBuildInputs = (if (!isSource && (getManyLinuxDeps fileInfo.name).str != null) then [ autoPatchelfHook ] else []) + ++ lib.optional (isLocal) pkgs.yj; + buildInputs = ( baseBuildInputs ++ lib.optional (!isSource) (getManyLinuxDeps fileInfo.name).pkg @@ -118,6 +120,8 @@ pythonPackages.callPackage ( # but dependencies try to access Django builtins.map (n: pythonPackages.${lib.toLower n}) (builtins.attrNames dependencies); + postPatch = (args.postPatch or "") + lib.optionalString isLocal (poetryLib.removeTOMLPathDependencies python); + meta = { broken = ! isCompatible python.pythonVersion python-versions; license = [];