Skip to content

Commit

Permalink
Remove dontPreferSetupPy & don't remove pyproject.toml ever
Browse files Browse the repository at this point in the history
It seems like this bandaid to avoid some build-system related overrides causes more problems than it fixes.
Let's just deal with reality up-front and hope that python-poetry/poetry#2789 will be fixed at some point.
  • Loading branch information
adisbladis committed Jan 18, 2022
1 parent 6f31c4e commit 7c141b7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 56 deletions.
8 changes: 0 additions & 8 deletions hooks/pip-build-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ pipBuildPhase() {
echo "Executing pipBuildPhase"
runHook preBuild

# Prefer using setup.py to avoid build-system dependencies if we have a setup.py
if [ -z "${dontPreferSetupPy-}" ]; then
if test -e setup.py && test -e pyproject.toml; then
echo "Removing pyproject.toml..."
rm -f pyproject.toml
fi
fi

mkdir -p dist
echo "Creating a wheel..."
@pythonInterpreter@ -m pip wheel --verbose --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist .
Expand Down
87 changes: 39 additions & 48 deletions overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ self: super:

anyio = super.anyio.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.py --replace 'setup()' 'setup(version="${old.version}")'
substituteInPlace setup.py --replace 'setup()' 'setup(version=${old.version}")'
'';
});

Expand Down Expand Up @@ -90,6 +90,10 @@ self: super:
}
);

backcall = super.backcall.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.flit-core ];
});

backports-entry-points-selectable = super.backports-entry-points-selectable.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.py --replace \
Expand Down Expand Up @@ -118,12 +122,6 @@ self: super:
}
);

black = super.black.overridePythonAttrs (
old: {
dontPreferSetupPy = true;
}
);

borgbackup = super.borgbackup.overridePythonAttrs (
old: {
BORG_OPENSSL_PREFIX = pkgs.openssl.dev;
Expand Down Expand Up @@ -174,11 +172,13 @@ self: super:
}
);

cheroot = super.cheroot.overridePythonAttrs (
old: {
dontPreferSetupPy = true;
}
);
cleo = super.cleo.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.poetry-core ];
});

clikit = super.clikit.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.poetry-core ];
});

cloudflare = super.cloudflare.overridePythonAttrs (
old: {
Expand All @@ -199,10 +199,14 @@ self: super:
buildInputs = (old.buildInputs or [ ]) ++ [
self.toml
];
}
);

postPatch = ''
substituteInPlace setup.py --replace 'setuptools.setup()' 'setuptools.setup(version="${old.version}")'
'';
crashtest = super.crashtest.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [
self.poetry-core
];
}
);

Expand Down Expand Up @@ -563,6 +567,10 @@ self: super:
}
);

html5lib = super.html5lib.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.flit-core ];
});

httplib2 = super.httplib2.overridePythonAttrs (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.pyparsing ];
});
Expand Down Expand Up @@ -636,22 +644,12 @@ self: super:
old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ lib.optional self.python.isPy2 self.pathlib2;

# disable the removal of pyproject.toml, required because of setuptools_scm
dontPreferSetupPy = true;

postPatch = old.postPatch or "" + (lib.optionalString ((old.format or "") != "wheel") ''
substituteInPlace setup.py --replace 'setuptools.setup()' 'setuptools.setup(version="${old.version}")'
'');
}
);

importlib-resources = super.importlib-resources.overridePythonAttrs (
old: {
# disable the removal of pyproject.toml, required because of setuptools_scm
dontPreferSetupPy = true;
}
);

intreehooks = super.intreehooks.overridePythonAttrs (
old: {
doCheck = false;
Expand All @@ -670,11 +668,13 @@ self: super:
buildInputs = (old.buildInputs or [ ]) ++ [
self.toml
];
# disable the removal of pyproject.toml, required because of setuptools_scm
dontPreferSetupPy = true;
}
);

jeepney = super.jeepney.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.flit-core ];
});

jira = super.jira.overridePythonAttrs (
old: {
inherit (pkgs.python3Packages.jira) patches;
Expand Down Expand Up @@ -706,12 +706,6 @@ self: super:
}
);

jsonpickle = super.jsonpickle.overridePythonAttrs (
old: {
dontPreferSetupPy = true;
}
);

jsonslicer = super.jsonslicer.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkgconfig ];
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.yajl ];
Expand Down Expand Up @@ -768,10 +762,6 @@ self: super:
propagatedBuildInputs = [ pkgs.libvirt ];
});

licensecheck = super.licensecheck.overridePythonAttrs (old: {
dontPreferSetupPy = true;
});

llvmlite = super.llvmlite.overridePythonAttrs (
old:
let
Expand Down Expand Up @@ -1087,6 +1077,10 @@ self: super:
'';
});

pastel = super.pastel.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.poetry-core ];
});

paramiko = super.paramiko.overridePythonAttrs (old: {
doCheck = false; # requires networking
});
Expand Down Expand Up @@ -1152,8 +1146,6 @@ self: super:
buildInputs = (old.buildInputs or [ ]) ++ [
self.toml
];
# disable the removal of pyproject.toml, required because of setuptools_scm
dontPreferSetupPy = true;
}
);

Expand Down Expand Up @@ -1816,8 +1808,6 @@ self: super:
buildInputs = (old.buildInputs or [ ]) ++ [
self.toml
];
# disable the removal of pyproject.toml, required because of setuptools_scm
dontPreferSetupPy = true;
}
);

Expand Down Expand Up @@ -2226,20 +2216,17 @@ self: super:
}
);

lazy-object-proxy = super.lazy-object-proxy.overridePythonAttrs (
old: {
# disable the removal of pyproject.toml, required because of setuptools_scm
dontPreferSetupPy = true;
}
);

pendulum = super.pendulum.overridePythonAttrs (old: {
# Technically incorrect, but fixes the build error..
preInstall = lib.optionalString stdenv.isLinux ''
mv --no-clobber ./dist/*.whl $(echo ./dist/*.whl | sed s/'manylinux_[0-9]*_[0-9]*'/'manylinux1'/)
'';
});

ptyprocess = super.ptyprocess.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.flit-core ];
});

pygraphviz = super.pygraphviz.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ];
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.graphviz ];
Expand Down Expand Up @@ -2273,6 +2260,10 @@ self: super:
buildInputs = (old.buildInputs or [ ]) ++ [ self.pbr ];
});

tomlkit = super.tomlkit.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.poetry-core ];
});

tomli = super.tomli.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.flit-core ];
});
Expand Down

0 comments on commit 7c141b7

Please sign in to comment.