File pythonmacrohelper.diff of Package rpm

--- ./macros.in.orig	2018-05-09 14:04:44.465451246 +0000
+++ ./macros.in	2018-05-09 14:05:22.321352187 +0000
@@ -1002,9 +1002,9 @@ done \
 #------------------------------------------------------------------------------
 # Useful python macros for determining python version and paths
 #
-%python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())")
-%python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")
-%python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")
+%python_sitelib %(%{__python} %{_rpmconfigdir}/python-macro-helper sitelib)
+%python_sitearch %(%{__python} %{_rpmconfigdir}/python-macro-helper sitearch)
+%python_version %(%{__python} %{_rpmconfigdir}/python-macro-helper version)
 
 # More useful perl macros (from Raul Dias <rsd@swi.com.br>)
 #
--- ./scripts/Makefile.am.orig	2018-05-09 14:03:15.389684331 +0000
+++ ./scripts/Makefile.am	2018-05-09 14:06:47.653128897 +0000
@@ -17,6 +17,7 @@ EXTRA_DIST = \
 	find-requires.php find-provides.php \
 	find-requires.ksyms find-provides.ksyms \
 	find-php-provides find-php-requires \
+	python-macro-helper \
 	mono-find-requires mono-find-provides \
 	ocaml-find-requires.sh ocaml-find-provides.sh \
 	pkgconfigdeps.sh libtooldeps.sh appdata.prov \
@@ -34,6 +35,7 @@ rpmconfig_SCRIPTS = \
 	find-lang.sh \
 	perl.prov perl.req perldeps.pl pythondeps.sh osgideps.pl \
 	find-requires.ksyms find-provides.ksyms \
+	python-macro-helper \
 	mono-find-requires mono-find-provides \
 	pkgconfigdeps.sh libtooldeps.sh \
 	ocaml-find-requires.sh ocaml-find-provides.sh \
--- ./scripts/python-macro-helper.orig	2018-05-09 14:10:37.892526422 +0000
+++ ./scripts/python-macro-helper	2018-05-09 14:09:57.340632538 +0000
@@ -0,0 +1,26 @@
+
+from distutils.sysconfig import get_python_lib
+from platform import python_version_tuple
+import sys
+
+
+if __name__ == "__main__":
+
+    if len(sys.argv) < 2:
+        sys.stderr.write("Usage: %s <command>\n" % sys.argv[0])
+        sys.exit(1)
+    
+    if sys.argv[1] == "version":
+        sys.stdout.write(".".join(python_version_tuple()[:2]))
+        sys.exit(0)
+
+    if sys.argv[1] == "sitelib":
+        sys.stdout.write(get_python_lib())
+        sys.exit(0)
+
+    if sys.argv[1] == "sitearch":
+        sys.stdout.write(get_python_lib(1))
+        sys.exit(0)
+
+    sys.stderr.write("Unknown command: %s\n" % sys.argv[1])
+    sys.exit(1)
openSUSE Build Service is sponsored by