From f6d440db93b9f168f077b9aa86631f02b9230a61 Mon Sep 17 00:00:00 2001 From: Tomas Orsava Date: Wed, 2 Aug 2017 16:50:50 +0200 Subject: [PATCH] Add platform-python macros --- macros.platform-python | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 macros.platform-python diff --git a/macros.platform-python b/macros.platform-python new file mode 100644 index 0000000..684d5c1 --- /dev/null +++ b/macros.platform-python @@ -0,0 +1,38 @@ +%__platform_python /usr/libexec/platform-python +%platform_python_sitelib %(%{__platform_python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") +%platform_python_sitearch %(%{__platform_python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") +%platform_python_version %(%{__platform_python} -c "import sys; sys.stdout.write(sys.version[:3])") +%platform_python_version_nodots %(%{__platform_python} -c "import sys; sys.stdout.write(sys.version[:3].replace('.',''))") +%platform_py_dir %{_builddir}/platform-python-%{name}-%{version}-%{release} + +%platform_py_shbang_opts -s + +# Use the slashes after expand so that the command starts on the same line as +# the macro +%platform_py_build() %{expand:\\\ + CFLAGS="%{optflags}" %{__platform_python} %{py_setup} %{?py_setup_args} build --executable="%{__platform_python} %{platform_py_shbang_opts}" %{?*} + sleep 1 +} + +%platform_py_build_egg() %{expand:\\\ + CFLAGS="%{optflags}" %{__platform_python} %{py_setup} %{?py_setup_args} bdist_egg %{?*} + sleep 1 +} + +%platform_py_build_wheel() %{expand:\\\ + CFLAGS="%{optflags}" %{__platform_python} %{py_setup} %{?py_setup_args} bdist_wheel %{?*} + sleep 1 +} + +%platform_py_install() %{expand:\\\ + CFLAGS="%{optflags}" %{__platform_python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} +} + +%platform_py_install_egg() %{expand:\\\ + mkdir -p %{buildroot}%{platform_python_sitelib} + easy_install-%{platform_python_version} -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{platform_python_version}.egg %{?*} +} + +%platform_py_install_wheel() %{expand:\\\ + pip%{platform_python_version} install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps +}