%bcond_with python2 %global srcname jep %global desc \ Java Embedded Python\ JEP embeds CPython in Java through JNI and is safe to use in a\ heavily threaded environment.\ \ Some benefits of embedding CPython in a JVM:\ Using the native Python interpreter may be much faster than\ alternatives.\ Python is mature, well supported, and well documented.\ Access to high quality Python modules, both native CPython\ extensions and Python-based.\ Compilers and assorted Python tools are as mature as the\ language.\ Python is an interpreted language, enabling scripting of\ established Java code without requiring recompilation.\ Both Java and Python are cross platform, enabling deployment\ to different operating system. Name: python-%{srcname} Version: 3.7.0 Release: 2%{?dist} Summary: Embed Python in Java License: zlib URL: https://github.com/ninia/%{srcname} Source0: %{url}/archive/v%{version}.tar.gz %if %{with python2} BuildRequires: python2-devel BuildRequires: python2-numpy %endif # with python2 BuildRequires: python3-devel BuildRequires: python3-numpy BuildRequires: java-devel Requires: java-headless %description %desc %package -n python2-%{srcname} Summary: Embed Python in Java %{?python_provide:%python_provide python2-%{srcname}} %description -n python2-%{srcname} %desc %package -n python3-%{srcname} Summary: Embed Python in Java %{?python_provide:%python_provide python3-%{srcname}} %description -n python3-%{srcname} %desc %package javadoc Summary: Javadoc files for %{name} BuildArch: noarch %description javadoc %{summary}. %prep %autosetup -c find . -name \*.jar -print -delete mv %{srcname}-%{version} python3 # don't confuse rpmbuild (pushd python3 ; mv -t.. LICENSE AUTHORS release_notes javadoc ) # be more verbose about tests, FIXME ugly hack! sed -i -r 's:TextTestRunner\(:\0verbosity=2:' python3/tests/runtests.py %if %{with python2} cp -a python3 python2 %endif # with python2 %build export JAVA_HOME=%{_prefix}/lib/jvm/java %if %{with python2} pushd python2 CFLAGS="$RPM_OPT_FLAGS" %py2_build popd %endif # with python2 pushd python3 CFLAGS="$RPM_OPT_FLAGS" %py3_build popd %install export JAVA_HOME=%{_prefix}/lib/jvm/java pushd python3 %py3_install popd %if %{with python2} pushd python2 %py2_install popd %endif # install javadoc install -dm755 %{buildroot}%{_javadocdir}/%{name} cp -pr javadoc/* %{buildroot}%{_javadocdir}/%{name} %check export JAVA_HOME=%{_prefix}/lib/jvm/java %if %{with python2} pushd python2 %{__python2} setup.py test popd %endif pushd python3 %{__python3} setup.py test popd %if %{with python2} %files -n python2-%{srcname} %license LICENSE %doc python2/README.rst %doc AUTHORS release_notes/ %{python2_sitearch}/* %endif %files -n python3-%{srcname} %license LICENSE %doc python3/README.rst %doc AUTHORS release_notes/ %{python3_sitearch}/* %{_bindir}/%{srcname} %files javadoc %license LICENSE %{_javadocdir}/%{name}/ %changelog * Sat Sep 02 2017 Raphael Groner - 3.7.0-2 - drop precompiled jar files - be more verbose about tests - add javadoc subpackage - move interpreter script into python3 subpackage - add release_notes folder to documentation - handle readme file properly * Tue Aug 15 2017 Raphael Groner - 3.7.0-1 - initial