Add initial support for python3

This commit is contained in:
Michal Srb 2014-08-20 13:21:50 +02:00
parent 52d1df3980
commit 1a590c32ef

View File

@ -1,37 +1,61 @@
%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif
Name: javapackages-tools
Version: 4.0.0
Release: 0%{?dist}
Version: 4.2.0
Release: 1%{?dist}
Summary: Macros and scripts for Java packaging support
License: BSD
URL: https://fedorahosted.org/javapackages/
URL: https://git.fedorahosted.org/git/javapackages.git
Source0: https://fedorahosted.org/released/javapackages/javapackages-%{version}.tar.xz
BuildArch: noarch
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-lxml
BuildRequires: python3-setuptools
BuildRequires: python3-nose
BuildRequires: python3-six
BuildRequires: python3-PyXB = 1.2.4
%else
BuildRequires: python2-devel
BuildRequires: python-lxml
BuildRequires: python-setuptools
BuildRequires: python-nose
BuildRequires: python-six
BuildRequires: PyXB = 1.2.4
%endif
BuildRequires: asciidoc
BuildRequires: xmlto
BuildRequires: python-lxml
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-formencode
BuildRequires: scl-utils-build
BuildRequires: python-nose
BuildRequires: dia
BuildRequires: PyXB >= 1.2.3
BuildRequires: javapackages-tools >= 4.0.0
BuildRequires: xmvn-resolve >= 2.0.0
Requires: coreutils
Requires: libxslt
Requires: lua
Requires: python
%if 0%{?with_python3}
Requires: python3-javapackages = %{version}-%{release}
Requires: python3
%else
Requires: python-javapackages = %{version}-%{release}
Requires: python
%endif
Provides: jpackage-utils = %{version}-%{release}
Obsoletes: jpackage-utils < %{version}-%{release}
Provides: mvn(com.sun:tools)
Provides: mvn(sun.jdk:jconsole)
%description
This package provides macros and scripts to support Java packaging.
@ -88,14 +112,29 @@ Requires: xmvn-connector-ivy >= 2
This package implements local mode fow Apache Ivy, which allows
artifact resolution using XMvn resolver.
%if 0%{?with_python3}
%package -n python3-javapackages
Summary: Module for handling various files for Java packaging
Requires: python3-PyXB = 1.2.4
Requires: python-lxml
Obsoletes: python-javapackages < %{version}-%{release}
%description -n python3-javapackages
Module for handling, querying and manipulating of various files for Java
packaging in Linux distributions
%else # python2
%package -n python-javapackages
Summary: Module for handling various files for Java packaging
Requires: PyXB >= 1.2.3
Requires: PyXB = 1.2.4
Requires: python-lxml
Obsoletes: python3-javapackages < %{version}-%{release}
%description -n python-javapackages
Module for handling, querying and manipulating of various files for Java
packaging in Linux distributions
%endif
%package -n fedora-review-plugin-java
Summary: fedora-review plugin for checking Java packaging guidelines
@ -131,11 +170,23 @@ This package provides non-essential macros and scripts to support Java packaging
%prep
%setup -q -n javapackages-%{version}
%if 0%{?with_python3}
find . -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python3}|'
find ./depgenerators -name '*.req' | xargs sed -i '1s|^#!.*python|#!%{__python3}|'
find ./depgenerators -name '*.prov' | xargs sed -i '1s|^#!.*python|#!%{__python3}|'
%endif # with_python3
%build
%configure
./build
pushd python
%{__python} setup.py build
%if 0%{?with_python3}
%{__python3} setup.py build
%else
%{__python2} setup.py build
%endif
popd
%install
@ -143,12 +194,19 @@ popd
sed -e 's/.[17]$/&.gz/' -e 's/.py$/&*/' -i files-*
pushd python
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
%if 0%{?with_python3}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
%else
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
%endif
popd
%check
./check
%if 0%{?with_python3}
./check 3
%else
./check 2
%endif
%files -f files-common
%doc LICENSE
@ -159,9 +217,15 @@ popd
%files -n ivy-local -f files-ivy
%if 0%{?with_python3}
%files -n python3-javapackages
%doc LICENSE
%{python3_sitelib}/javapackages*
%else # python2
%files -n python-javapackages
%doc LICENSE
%{python_sitelib}/javapackages*
%endif
%files -n fedora-review-plugin-java
%{_datadir}/fedora-review/plugins/*
@ -170,6 +234,9 @@ popd
%doc LICENSE
%changelog
* Thu Jul 24 2014 Michal Srb <msrb@redhat.com> - 4.2.0-1
- Update to upstream version 4.2.0
* Wed Apr 16 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.0-6
- Add explicit maven-local requires on java-1.8.0-openjdk-devel