Remove dontPreferSetupPy & don't remove pyproject.toml ever

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 https://github.com/python-poetry/poetry/issues/2789 will be fixed at some point.
This commit is contained in:
adisbladis 2022-01-18 11:19:43 +12:00
parent 23be9b3cb0
commit 8be11cbe8f
2 changed files with 38 additions and 118 deletions

View file

@ -5,14 +5,6 @@ pipBuildPhase() {
echo "Executing pipBuildPhase" echo "Executing pipBuildPhase"
runHook preBuild 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 mkdir -p dist
echo "Creating a wheel..." echo "Creating a wheel..."
@pythonInterpreter@ -m pip wheel --verbose --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist . @pythonInterpreter@ -m pip wheel --verbose --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist .

View file

@ -50,12 +50,6 @@ self: super:
} }
); );
anyio = super.anyio.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.py --replace 'setup()' 'setup(version="${old.version}")'
'';
});
argcomplete = super.argcomplete.overridePythonAttrs ( argcomplete = super.argcomplete.overridePythonAttrs (
old: rec { old: rec {
buildInputs = (old.buildInputs or [ ]) ++ [ self.importlib-metadata ]; buildInputs = (old.buildInputs or [ ]) ++ [ self.importlib-metadata ];
@ -90,20 +84,8 @@ self: super:
} }
); );
backports-entry-points-selectable = super.backports-entry-points-selectable.overridePythonAttrs (old: { backcall = super.backcall.overridePythonAttrs (old: {
postPatch = '' buildInputs = old.buildInputs or [ ] ++ [ self.flit-core ];
substituteInPlace setup.py --replace \
'setuptools.setup()' \
'setuptools.setup(version="${old.version}")'
'';
});
backports-functools-lru-cache = super.backports-functools-lru-cache.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.py --replace \
'setuptools.setup()' \
'setuptools.setup(version="${old.version}")'
'';
}); });
bcrypt = super.bcrypt.overridePythonAttrs ( bcrypt = super.bcrypt.overridePythonAttrs (
@ -118,12 +100,6 @@ self: super:
} }
); );
black = super.black.overridePythonAttrs (
old: {
dontPreferSetupPy = true;
}
);
borgbackup = super.borgbackup.overridePythonAttrs ( borgbackup = super.borgbackup.overridePythonAttrs (
old: { old: {
BORG_OPENSSL_PREFIX = pkgs.openssl.dev; BORG_OPENSSL_PREFIX = pkgs.openssl.dev;
@ -174,11 +150,13 @@ self: super:
} }
); );
cheroot = super.cheroot.overridePythonAttrs ( cleo = super.cleo.overridePythonAttrs (old: {
old: { buildInputs = old.buildInputs or [ ] ++ [ self.poetry-core ];
dontPreferSetupPy = true; });
}
); clikit = super.clikit.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.poetry-core ];
});
cloudflare = super.cloudflare.overridePythonAttrs ( cloudflare = super.cloudflare.overridePythonAttrs (
old: { old: {
@ -199,10 +177,14 @@ self: super:
buildInputs = (old.buildInputs or [ ]) ++ [ buildInputs = (old.buildInputs or [ ]) ++ [
self.toml self.toml
]; ];
}
);
postPatch = '' crashtest = super.crashtest.overridePythonAttrs (
substituteInPlace setup.py --replace 'setuptools.setup()' 'setuptools.setup(version="${old.version}")' old: {
''; buildInputs = (old.buildInputs or [ ]) ++ [
self.poetry-core
];
} }
); );
@ -419,8 +401,7 @@ self: super:
old: { old: {
postPatch = '' postPatch = ''
substituteInPlace setup.py \ substituteInPlace setup.py \
--replace 'setup_requires="setupmeta"' 'setup_requires=[]' \ --replace 'setup_requires="setupmeta"' 'setup_requires=[]'
--replace 'versioning="devcommit"' 'version="${old.version}"'
''; '';
} }
); );
@ -442,12 +423,6 @@ self: super:
} }
); );
filelock = super.filelock.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.py --replace 'setup()' 'setup(version="${old.version}")'
'';
});
fiona = super.fiona.overridePythonAttrs ( fiona = super.fiona.overridePythonAttrs (
old: { old: {
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.gdal_2 ]; buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.gdal_2 ];
@ -563,6 +538,10 @@ self: super:
} }
); );
html5lib = super.html5lib.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.flit-core ];
});
httplib2 = super.httplib2.overridePythonAttrs (old: { httplib2 = super.httplib2.overridePythonAttrs (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.pyparsing ]; propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.pyparsing ];
}); });
@ -635,20 +614,6 @@ self: super:
importlib-metadata = super.importlib-metadata.overridePythonAttrs ( importlib-metadata = super.importlib-metadata.overridePythonAttrs (
old: { old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ lib.optional self.python.isPy2 self.pathlib2; 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;
} }
); );
@ -670,11 +635,13 @@ self: super:
buildInputs = (old.buildInputs or [ ]) ++ [ buildInputs = (old.buildInputs or [ ]) ++ [
self.toml 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 ( jira = super.jira.overridePythonAttrs (
old: { old: {
inherit (pkgs.python3Packages.jira) patches; inherit (pkgs.python3Packages.jira) patches;
@ -706,12 +673,6 @@ self: super:
} }
); );
jsonpickle = super.jsonpickle.overridePythonAttrs (
old: {
dontPreferSetupPy = true;
}
);
jsonslicer = super.jsonslicer.overridePythonAttrs (old: { jsonslicer = super.jsonslicer.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkgconfig ]; nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkgconfig ];
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.yajl ]; buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.yajl ];
@ -741,9 +702,6 @@ self: super:
buildInputs = (old.buildInputs or [ ]) ++ [ buildInputs = (old.buildInputs or [ ]) ++ [
self.toml self.toml
]; ];
postPatch = ''
substituteInPlace setup.py --replace 'setuptools.setup()' 'setuptools.setup(version="${old.version}")'
'';
} }
); );
@ -768,10 +726,6 @@ self: super:
propagatedBuildInputs = [ pkgs.libvirt ]; propagatedBuildInputs = [ pkgs.libvirt ];
}); });
licensecheck = super.licensecheck.overridePythonAttrs (old: {
dontPreferSetupPy = true;
});
llvmlite = super.llvmlite.overridePythonAttrs ( llvmlite = super.llvmlite.overridePythonAttrs (
old: old:
let let
@ -1087,6 +1041,10 @@ self: super:
''; '';
}); });
pastel = super.pastel.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.poetry-core ];
});
paramiko = super.paramiko.overridePythonAttrs (old: { paramiko = super.paramiko.overridePythonAttrs (old: {
doCheck = false; # requires networking doCheck = false; # requires networking
}); });
@ -1124,12 +1082,6 @@ self: super:
} }
); );
platformdirs = super.platformdirs.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.py --replace 'setup()' 'setup(version="${old.version}")'
'';
});
poetry-core = super.poetry-core.overridePythonAttrs (old: { poetry-core = super.poetry-core.overridePythonAttrs (old: {
# "Vendor" dependencies (for build-system support) # "Vendor" dependencies (for build-system support)
postPatch = '' postPatch = ''
@ -1152,8 +1104,6 @@ self: super:
buildInputs = (old.buildInputs or [ ]) ++ [ buildInputs = (old.buildInputs or [ ]) ++ [
self.toml self.toml
]; ];
# disable the removal of pyproject.toml, required because of setuptools_scm
dontPreferSetupPy = true;
} }
); );
@ -1816,8 +1766,6 @@ self: super:
buildInputs = (old.buildInputs or [ ]) ++ [ buildInputs = (old.buildInputs or [ ]) ++ [
self.toml self.toml
]; ];
# disable the removal of pyproject.toml, required because of setuptools_scm
dontPreferSetupPy = true;
} }
); );
@ -1929,13 +1877,6 @@ self: super:
})) }))
{ }; { };
typeguard = super.typeguard.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.py \
--replace 'setup()' 'setup(version="${old.version}")'
'';
});
typed_ast = super.typed-ast.overridePythonAttrs (old: { typed_ast = super.typed-ast.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
self.pytest-runner self.pytest-runner
@ -2038,21 +1979,7 @@ self: super:
if isWheel then wheelPackage else sourcePackage; if isWheel then wheelPackage else sourcePackage;
zipp = if super.zipp == null then null else zipp = if super.zipp == null then null else
( super.zipp.overridePythonAttrs (
if lib.versionAtLeast super.zipp.version "2.0.0" then
(
super.zipp.overridePythonAttrs (
old:
if (old.format or "pyproject") != "wheel" then {
prePatch = ''
substituteInPlace setup.py --replace \
'setuptools.setup()' \
'setuptools.setup(version="${super.zipp.version}")'
'';
} else old
)
) else super.zipp
).overridePythonAttrs (
old: { old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [
self.toml self.toml
@ -2226,13 +2153,6 @@ 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: { pendulum = super.pendulum.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.poetry ]; buildInputs = (old.buildInputs or [ ]) ++ [ self.poetry ];
# Technically incorrect, but fixes the build error.. # Technically incorrect, but fixes the build error..
@ -2241,6 +2161,10 @@ self: super:
''; '';
}); });
ptyprocess = super.ptyprocess.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.flit-core ];
});
pygraphviz = super.pygraphviz.overridePythonAttrs (old: { pygraphviz = super.pygraphviz.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ]; nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ];
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.graphviz ]; buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.graphviz ];
@ -2274,6 +2198,10 @@ self: super:
buildInputs = (old.buildInputs or [ ]) ++ [ self.pbr ]; buildInputs = (old.buildInputs or [ ]) ++ [ self.pbr ];
}); });
tomlkit = super.tomlkit.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ self.poetry-core ];
});
tomli = super.tomli.overridePythonAttrs (old: { tomli = super.tomli.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.flit-core ]; nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.flit-core ];
}); });