%global srcurl https://github.com/originell/%{name} %global sum Full access for Python programs to Java class libraries # no python3 for epel7 %if 0%{?fedora} %bcond_without python3 %endif %bcond_without python2 Name: jpype Version: 0.6.1 Release: 1 Summary: %{sum} # Some files come from JDK (jni_md.h) and Python (capsulethunk.h) License: ASL 2.0 and GPLv2 and Python URL: http://%{name}.sf.net Source0: %{srcurl}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz %if %{with python3} BuildRequires: python3-devel python3-setuptools %endif %if %{with python2} BuildRequires: python-devel python-setuptools BuildRequires: python-mock %endif %if %{with python3} BuildRequires: python3-sphinx python3-sphinx_rtd_theme %else # python3 is not available, so fall back to default python BuildRequires: python-sphinx python-sphinx_rtd_theme BuildRequires: fontawesome-fonts-web %endif BuildRequires: java-devel ant %description JPype is an effort to allow python programs full access to java class libraries. This is achieved not through re-implementing Python, as Jython/JPython has done, but rather through interfacing at the native level in both Virtual Machines. %if %{with python2} %package -n python2-%{name} Summary: %{sum} # FIXME as long as python2 is the default, we've to use the prefix Provides: %{name} %{?python_provide:%python_provide python2-%{name}} %description -n python2-%{name} JPype is an effort to allow python programs full access to java class libraries. This is achieved not through re-implementing Python, as Jython/JPython has done, but rather through interfacing at the native level in both Virtual Machines. This is the package with support for Python2. %endif # python2 %if %{with python3} %package -n python3-%{name} Summary: %{sum} %{?python_provide:%python_provide python3-%{name}} # Python3 support was a fork at upstream, https://bugzilla.redhat.com/show_bug.cgi?id=1208701 Obsoletes: %{name}-py3 Provides: %{name}-py3 %description -n python3-%{name} JPype is an effort to allow python programs full access to java class libraries. This is achieved not through re-implementing Python, as Jython/JPython has done, but rather through interfacing at the native level in both Virtual Machines. This is the package with support for Python3. %endif # python3 %package doc Summary: Documentation files for %{name} BuildArch: noarch Requires: js-jquery %description doc %{summary}. %prep %setup -qn%{name}-%{version} # sanify line delimiters find . -name '*.py' -or -name '*.java' -or -name '*.TXT' \ -or -name '*.sh' -or -name '*.xml' -or -name '*.js' \ |xargs sed -i "s|\r||g" # FIXME tests fail to bytecompile with Python 3, https://github.com/originell/jpype/issues/153 #find test -name \*.py |xargs sed -i -r "s|(print) (.*)|\1(\2)|g" # include test files into bytecompiling for distribution cp -pr test/%{name}test . cp -pr test/testsuite.py %{name}test sed -i -r -e "s|packages=.|\0 '%{name}test',|" setup.py # classes folder will exist later after build and installed into tests folder sed -i -r "s|classes|%{name}test/\0|" %{name}test/common.py # omit import for html generation sed -i -e "/import %{name}/d" -e "s|%{name}.__version__|'%{version}'|g" doc/conf.py %build %if %{with python2} %py2_build %endif %if %{with python3} %py3_build %endif # build test classes pushd test ant compile popd # generate html documentation %if %{with python3} sphinx-build-3 -d doctrees doc html %else sphinx-build -d doctrees doc html %endif rm html/.buildinfo # unbundle jquery, https://fedoraproject.org/wiki/Changes/jQuery ln -fs %{_jsdir}/jquery/2/jquery.min.js html/_static/jquery.js %install %if %{with python2} %py2_install cp -pr test/classes %{buildroot}%{python2_sitearch}/%{name}test %endif %if %{with python3} %py3_install cp -pr test/classes %{buildroot}%{python3_sitearch}/%{name}test %endif find %{buildroot} -name '*.so' |xargs chmod 0755 %check # fake module import export PYTHONPATH=.. %if %{with python2} pushd %{buildroot}%{python2_sitearch}/%{name}test %{__python2} testsuite.py %endif %if %{with python3} pushd %{buildroot}%{python3_sitearch}/%{name}test # dirty hack: replace mock with unittest.mock sed -i -r "s|import mock|from unittest \0|" jvmfinder.py %{__python3} testsuite.py %endif %if %{with python2} %files -n python2-%{name} %license LICENSE %doc AUTHORS.rst README.rst %{python2_sitearch}/* %endif %if %{with python3} %files -n python3-%{name} %license LICENSE %doc AUTHORS.rst README.rst %{python3_sitearch}/* %endif %files doc %license LICENSE %doc examples/ html/ %changelog * Thu Sep 10 2015 Raphael Groner - 0.6.1-1 - new upstream release v0.6.1 - make tests work with python3 - deprecation of jpype-py3 - split subpackages for python2 and 3 - use python build and install macros - ease html generation - ship _static documentation files - unbundle jquery - ship tests folder as an import option w/o execution bits - restrict documentation to only some .rst files * Tue Jul 21 2015 Raphael Groner - 0.6.0-2 - include patch of proxy argument issue * Tue Jun 23 2015 Raphael Groner - 0.6.0-1 - based on originally jpype-py3.spec - official jpype 0.6.0 with python3 - more documentation in subpackage * Wed Jun 17 2015 Fedora Release Engineering - 0-0.3.20150202gitca6fc96 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Thu Apr 23 2015 Raphael Groner - 0-0.2.20150202gitca6fc96 - add GPLv2 for bundled source files - remove wrong sitearch macro - make tests work * Thu Apr 02 2015 Raphael Groner - 0-0.1.20150202gitca6fc96 - initial