From 69e6ddf1d840d0d39005d559774626982c974bd1 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 3 Oct 2021 10:56:21 -0700
Subject: [PATCH v3 12/17] prereq: Move sed expression from
 regress-python3-mangle.mk into its own file.

---
 src/pl/plpython/regress-python3-mangle.mk  | 17 ++---------------
 src/pl/plpython/regress-python3-mangle.sed | 13 +++++++++++++
 2 files changed, 15 insertions(+), 15 deletions(-)
 create mode 100644 src/pl/plpython/regress-python3-mangle.sed

diff --git a/src/pl/plpython/regress-python3-mangle.mk b/src/pl/plpython/regress-python3-mangle.mk
index a785818a172..a5c155e73de 100644
--- a/src/pl/plpython/regress-python3-mangle.mk
+++ b/src/pl/plpython/regress-python3-mangle.mk
@@ -14,21 +14,8 @@ REGRESS := $(foreach test,$(REGRESS),$(if $(filter $(test),$(REGRESS_PLPYTHON3_M
 pgregress-python3-mangle:
 	$(MKDIR_P) sql/python3 expected/python3 results/python3
 	for file in $(patsubst %,$(srcdir)/sql/%.sql,$(REGRESS_PLPYTHON3_MANGLE)) $(patsubst %,$(srcdir)/expected/%*.out,$(REGRESS_PLPYTHON3_MANGLE)); do \
-	  sed \
-	      -e "s/<type 'exceptions\.\([[:alpha:]]*\)'>/<class '\1'>/g" \
-	      -e "s/<type 'long'>/<class 'int'>/g" \
-	      -e "s/\([0-9][0-9]*\)L/\1/g" \
-	      -e 's/\([ [{]\)u"/\1"/g' \
-	      -e "s/\([ [{]\)u'/\1'/g" \
-	      -e "s/def next/def __next__/g" \
-	      -e "s/LANGUAGE plpythonu/LANGUAGE plpython3u/g" \
-	      -e "s/LANGUAGE plpython2u/LANGUAGE plpython3u/g" \
-	      -e "s/EXTENSION plpythonu/EXTENSION plpython3u/g" \
-	      -e "s/EXTENSION plpython2u/EXTENSION plpython3u/g" \
-	      -e "s/EXTENSION \([^ ]*\)_plpythonu/EXTENSION \1_plpython3u/g" \
-	      -e "s/EXTENSION \([^ ]*\)_plpython2u/EXTENSION \1_plpython3u/g" \
-	      -e 's/installing required extension "plpython2u"/installing required extension "plpython3u"/g' \
-	    $$file >`echo $$file | sed 's,^.*/\([^/][^/]*/\)\([^/][^/]*\)$$,\1python3/\2,'` || exit; \
+	  sed -f $(top_srcdir)/src/pl/plpython/regress-python3-mangle.sed $$file > \
+	    `echo $$file | sed 's,^.*/\([^/][^/]*/\)\([^/][^/]*\)$$,\1python3/\2,'` || exit; \
 	done
 
 check installcheck: pgregress-python3-mangle
diff --git a/src/pl/plpython/regress-python3-mangle.sed b/src/pl/plpython/regress-python3-mangle.sed
new file mode 100644
index 00000000000..d2fde24e0bf
--- /dev/null
+++ b/src/pl/plpython/regress-python3-mangle.sed
@@ -0,0 +1,13 @@
+s/<type 'exceptions\.\([[:alpha:]]*\)'>/<class '\1'>/g
+s/<type 'long'>/<class 'int'>/g
+s/\([0-9][0-9]*\)L/\1/g
+s/\([ [{]\)u"/\1"/g
+s/\([ [{]\)u'/\1'/g
+s/def next/def __next__/g
+s/LANGUAGE plpythonu/LANGUAGE plpython3u/g
+s/LANGUAGE plpython2u/LANGUAGE plpython3u/g
+s/EXTENSION plpythonu/EXTENSION plpython3u/g
+s/EXTENSION plpython2u/EXTENSION plpython3u/g
+s/EXTENSION \([^ ]*\)_plpythonu/EXTENSION \1_plpython3u/g
+s/EXTENSION \([^ ]*\)_plpython2u/EXTENSION \1_plpython3u/g
+s/installing required extension "plpython2u"/installing required extension "plpython3u"/g
-- 
2.23.0.385.gbc12974a89

