treewide: --replace -> --replace-fail

Hardening the packages I maintain.
We use `--replace-fail` in every case except for `python3Packages.remi`, which does a glob `--replace-quiet` to reduce warnings
This commit is contained in:
Peder Bergebakken Sundt 2024-04-21 20:04:29 +02:00
parent b8af6d814d
commit 7151eeec48
14 changed files with 26 additions and 26 deletions

View File

@ -40,7 +40,7 @@ ps.buildPythonApplication rec {
postPatch = ''
# disable coverage testing
substituteInPlace pyproject.toml \
--replace "addopts = [" "addopts_ = ["
--replace-fail "addopts = [" "addopts_ = ["
'';
pythonRemoveDeps = [

View File

@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
postPatch = ''
for fname in lib/{simulation,simset}.c; do
substituteInPlace "$fname" \
--replace \
--replace-fail \
'#include "../../lib/cim.h"' \
'#include "../lib/cim.h"'
done

View File

@ -74,7 +74,7 @@ stdenv.mkDerivation rec {
# ( https://github.com/IntelRealSense/meta-intel-realsense/issues/20 )
postInstall = ''
substituteInPlace $out/lib/cmake/realsense2/realsense2Targets.cmake \
--replace "\''${_IMPORT_PREFIX}/include" "$dev/include"
--replace-fail "\''${_IMPORT_PREFIX}/include" "$dev/include"
'' + lib.optionalString enablePython ''
cp ../wrappers/python/pyrealsense2/__init__.py $out/${pythonPackages.python.sitePackages}/pyrealsense2
'';

View File

@ -31,13 +31,13 @@ buildPythonPackage rec {
postPatch = ''
substituteInPlace pytest.ini \
--replace \
--replace-fail \
"--cov" \
"#--cov"
# configure correct version, which fails due to missing .git
substituteInPlace versioneer.py birch/_version.py \
--replace '"0+unknown"' '"${version}"'
--replace-fail '"0+unknown"' '"${version}"'
'';
nativeBuildInputs = [

View File

@ -42,7 +42,7 @@ buildPythonPackage rec {
preCheck = ''
substituteInPlace pyproject.toml \
--replace \
--replace-fail \
'"--cov' \
'#"--cov'
'';

View File

@ -25,7 +25,7 @@ buildPythonPackage rec {
postPatch = ''
# default to store ffmpeg
substituteInPlace ffmpy.py \
--replace 'executable="ffmpeg",' 'executable="${ffmpeg-headless}/bin/ffmpeg",'
--replace-fail 'executable="ffmpeg",' 'executable="${ffmpeg-headless}/bin/ffmpeg",'
# The tests test a mock that does not behave like ffmpeg. If we default to the nix-store ffmpeg they fail.
for fname in tests/*.py; do

View File

@ -25,13 +25,13 @@ buildPythonPackage rec {
postPatch = ''
# move cache location from nix store to home
substituteInPlace pymongo_inmemory/context.py \
--replace \
--replace-fail \
'CACHE_FOLDER = path.join(path.dirname(__file__), "..", ".cache")' \
'CACHE_FOLDER = os.environ.get("XDG_CACHE_HOME", os.environ["HOME"] + "/.cache") + "/pymongo-inmemory"'
# fix a broken assumption arising from the above fix
substituteInPlace pymongo_inmemory/_utils.py \
--replace \
--replace-fail \
'os.mkdir(current_path)' \
'os.makedirs(current_path)'
'';

View File

@ -45,7 +45,7 @@ buildPythonPackage rec {
# the commit does not apply as a patch when cherry picked, hence the substituteInPlace
postPatch = ''
substituteInPlace tests/unit/test_meshes.py \
--replace \
--replace-fail \
"bm = trimesh.load('tests/data/WaterBottle.glb').dump()[0]" \
'bm = trimesh.load("tests/data/WaterBottle.glb").geometry["WaterBottle"]'
'';

View File

@ -23,7 +23,7 @@ buildPythonPackage rec {
postPatch = ''
substituteInPlace pyunpack/__init__.py \
--replace \
--replace-fail \
'_exepath("patool")' \
'"${lib.getBin patool}/bin/.patool-wrapped"'
'';

View File

@ -23,19 +23,19 @@ buildPythonPackage rec {
preCheck = ''
# for some reason, REMI already deal with these using try blocks, but they fail
substituteInPlace test/test_widget.py \
--replace \
--replace-fail \
"from html_validator import " \
"from .html_validator import "
substituteInPlace test/test_examples_app.py \
--replace \
--replace-fail \
"from mock_server_and_request import " \
"from .mock_server_and_request import " \
--replace \
--replace-fail \
"from html_validator import " \
"from .html_validator import "
# Halves number of warnings
substituteInPlace test/test_*.py \
--replace \
--replace-quiet \
"self.assertEquals(" \
"self.assertEqual("
'';

View File

@ -30,13 +30,13 @@ buildPythonPackage rec {
postPatch = ''
substituteInPlace pytest.ini \
--replace \
--replace-fail \
"--cov" \
"#--cov"
# configure correct version, which fails due to missing .git
substituteInPlace versioneer.py strct/_version.py \
--replace '"0+unknown"' '"${version}"'
--replace-fail '"0+unknown"' '"${version}"'
'';
nativeBuildInputs = [

View File

@ -28,27 +28,27 @@ stdenvNoCC.mkDerivation rec {
postPatch = ''
substituteInPlace pokemonsay.sh \
--replace \
--replace-fail \
'INSTALL_PATH=''${HOME}/.bin/pokemonsay' \
"" \
--replace \
--replace-fail \
'POKEMON_PATH=''${INSTALL_PATH}/pokemons' \
'POKEMON_PATH=${placeholder "out"}/share/pokemonsay' \
--replace \
--replace-fail \
'$(find ' \
'$(${findutils}/bin/find ' \
--replace \
--replace-fail \
'$(basename ' \
'$(${coreutils}/bin/basename ' \
--replace \
--replace-fail \
'cowsay -f ' \
'${cowsay}/bin/cowsay -f ' \
--replace \
--replace-fail \
'cowthink -f ' \
'${cowsay}/bin/cowthink -f '
substituteInPlace pokemonthink.sh \
--replace \
--replace-fail \
'./pokemonsay.sh' \
"${placeholder "out"}/bin/pokemonsay"
'';

View File

@ -34,7 +34,7 @@ buildPythonApplication rec {
# remove legacy endpoints, we use --multi now
postPatch = ''
substituteInPlace setup.py \
--replace '"mremote' '#"mremote'
--replace-fail '"mremote' '#"mremote'
'';
propagatedBuildInputs = [

View File

@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
runHook preBuild
substituteInPlace rmate \
--replace \
--replace-fail \
'echo "hostname"' \
'echo "${hostname}/bin/hostname"'
patsh -f rmate -s ${builtins.storeDir}