Add platform-python macros

This commit is contained in:
Tomas Orsava 2017-08-02 16:50:50 +02:00
parent b58450b1f3
commit f6d440db93
1 changed files with 38 additions and 0 deletions

38
macros.platform-python Normal file
View File

@ -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
}