%global with_python3 1 %global upname llvmmath # Filter out -g, it makes checks segfault %global llvmflags %(echo %{optflags} | sed -e 's/-g//g' ) Name: python-%{upname} Version: 0.1.1 Release: 2%{?dist} Summary: LLVM math library in Python License: BSD URL: https://pypi.python.org/pypi/llvmmath Source0: http://pypi.python.org/packages/source/l/%{upname}/%{upname}-%{version}.tar.gz Patch0: llvmmath-flags.patch BuildRequires: python2-devel BuildRequires: python-llvmpy numpy BuildRequires: clang Requires: numpy python-llvmpy # python-llvmpy missing in arm ExcludeArch: %{arm} # we don't want to provide private python extension libs %global __provides_exclude_from ^(%{python_sitearch}|%{python3_sitearch})/.*\\.so$ %description The purpose of this project is to provide portable math functions, many of which are in C99 and not available on all platforms. It is based on NumPy's umath and tries to support all floating point and complex types. %if 0%{?with_python3} %package -n python3-%{upname} Summary: LLVM math library in Python BuildRequires: python3-devel BuildRequires: python3-llvmpy python3-numpy BuildRequires: clang Requires: python3-numpy python3-llvmpy %description -n python3-%{upname} The purpose of this project is to provide portable math functions, many of which are in C99 and not available on all platforms. It is based on NumPy's umath and tries to support all floating point and complex types. %endif # with_python3 %prep %setup -q -n %{upname}-%{version} %patch0 -p1 rm -rf %{upname}.egg-info sed -i -e "1d" llvmmath/generator/conv_template.py %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' %endif # with_python3 find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|' %build CFLAGS="%{optflags}" CLANGFLAGS="%{llvmflags}" %{__python} setup.py build # Documentation requires sphinxjp.themecore # skip %if 0%{?with_python3} pushd %{py3dir} CFLAGS="%{optflags}" CLANGFLAGS="%{llvmflags}" %{__python3} setup.py build # Documentation requires sphinxjp.themecore # skip popd %endif # with_python3 %install %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --skip-build --root %{buildroot} popd %endif # with_python3 %{__python} setup.py install --skip-build --root %{buildroot} find %{buildroot} -name "*.so" | xargs chmod 755 %check pushd %{buildroot}%{python_sitearch} %{__python} -c "import sys;import llvmmath;sys.exit(llvmmath.test());" popd %if 0%{?with_python3} pushd %{buildroot}%{python3_sitearch} # Seems broken, is llvmpy or llvmmath? %{__python3} -c "import sys;import llvmmath;sys.exit(llvmmath.test());" popd %endif # with_python3 %files %doc docs README.md requirements.txt %{python_sitearch}/* %if 0%{?with_python3} %files -n python3-%{upname} %doc docs README.md requirements.txt %{python3_sitearch}/* %endif # with_python3 %changelog * Tue Oct 01 2013 Sergio Pascual - 0.1.1-2 - Patch to load clang flags from CLANGFLAGS - Filter out -g from CLANGFLAGS, it makes tests segfault - Exclude arch arm (python-llvmpy missing) * Tue Sep 24 2013 Sergio Pascual - 0.1.1-1 - Initial spec file