mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-04 16:51:40 -05:00
Fix build with separated poetry/poetry-core build systems
This commit is contained in:
parent
3de03cdddc
commit
234b0f3f4d
3 changed files with 25 additions and 0 deletions
|
@ -108,7 +108,11 @@ lib.makeScope pkgs.newScope (self: {
|
|||
mkPoetryDep = self.callPackage ./mk-poetry-dep.nix {
|
||||
inherit pkgs lib python poetryLib evalPep508;
|
||||
};
|
||||
|
||||
# Use poetry-core from the poetry build (pep517/518 build-system)
|
||||
poetry-core = if __isBootstrap then null else poetryPkg.passthru.python.pkgs.poetry-core;
|
||||
poetry = if __isBootstrap then null else poetryPkg;
|
||||
|
||||
# The canonical name is setuptools-scm
|
||||
setuptools-scm = super.setuptools_scm;
|
||||
|
||||
|
|
|
@ -594,6 +594,22 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
poetry-core = super.poetry-core.overridePythonAttrs(old: {
|
||||
# "Vendor" dependencies (for build-system support)
|
||||
postPatch = ''
|
||||
echo "import sys" >> poetry/__init__.py
|
||||
for path in ''${PYTHONPATH//:/ }; do echo $path; done | uniq | while read path; do
|
||||
echo "sys.path.insert(0, \"$path\")" >> poetry/__init__.py
|
||||
done
|
||||
'';
|
||||
|
||||
# Propagating dependencies leads to issues downstream
|
||||
# We've already patched poetry to prefer "vendored" dependencies
|
||||
postFixup = ''
|
||||
rm $out/nix-support/propagated-build-inputs
|
||||
'';
|
||||
});
|
||||
|
||||
# disable the removal of pyproject.toml, required because of setuptools_scm
|
||||
portend = super.portend.overridePythonAttrs (
|
||||
old: {
|
||||
|
|
|
@ -21,6 +21,11 @@ poetry2nix.mkPoetryApplication {
|
|||
'';
|
||||
|
||||
postInstall = ''
|
||||
# Figure out the location of poetry.core
|
||||
# As poetry.core is using the same root import name as the poetry package and the python module system wont look for the root
|
||||
# in the separate second location we need to link poetry.core to poetry
|
||||
ln -s $(python -c 'import poetry.core; import os.path; print(os.path.dirname(poetry.core.__file__))') $out/${python.sitePackages}/poetry/core
|
||||
|
||||
mkdir -p "$out/share/bash-completion/completions"
|
||||
"$out/bin/poetry" completions bash > "$out/share/bash-completion/completions/poetry"
|
||||
mkdir -p "$out/share/zsh/vendor-completions"
|
||||
|
|
Loading…
Add table
Reference in a new issue