Python2 binary package has been removed

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-10-12 16:04:06 +02:00
commit 18f492bf0c

View file

@ -1,6 +1,6 @@
Name: python-yara
Version: 3.8.1
%global rel 2
%global rel 3
Summary: Python binding for the YARA pattern matching tool
Group: Development/Libraries
License: ASL 2.0
@ -17,32 +17,17 @@ URL: http://github.com/VirusTotal/yara-python/
# Build also the python3 package
%if 0%{?fedora} || ( 0%{?rhel} && 0%{?rhel} >= 7 )
%global with_python3 1
%global with_check 1
%endif
# Introduce the python macros on older platforms if needed
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
%if 0%{?fedora} <= 21
%{!?py2_build: %global py2_build %{__python2} setup.py build --executable="%{__python2} -s"}
%{!?py2_install: %global py2_install %{__python2} setup.py install -O1 --skip-build --root %{buildroot}}
%{!?py3_build: %global py3_build %{__python3} setup.py build --executable="%{__python3} -s"}
%{!?py3_install: %global py3_install %{__python3} setup.py install -O1 --skip-build --root %{buildroot}}
%endif
# Build source is github release=1 or git commit=0
%global build_release 1
%if 0%{?build_release} > 0
Release: %{rel}%{?dist}
Release: %{rel}%{?dist}.1
Source0: https://github.com/%{gituser}/%{gitname}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
%else
Release: %{rel}.%{gitdate}git%{shortcommit}%{?dist}
Release: %{rel}.%{gitdate}git%{shortcommit}%{?dist}.1
Source0: https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
%endif #Build_release
@ -51,19 +36,12 @@ BuildRequires: pkgconfig(yara)
BuildRequires: libtool
BuildRequires: yara-devel
BuildRequires: python2
BuildRequires: python2-devel
BuildRequires: python2-setuptools
# html doc generation
BuildRequires: python2-sphinx
%if 0%{?with_check}
BuildRequires: python2-nose
%endif
BuildRequires: python3-sphinx
%if 0%{?with_python3}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-nose
BuildRequires: python%{python3_pkgversion}-setuptools
%endif # if with_python3
@ -78,20 +56,6 @@ and a Boolean expression which determine its logic.
#====================================================================
%package -n python2-%{srcname}
Summary: Python2 binding for the YARA pattern matching tool
Group: Development/Libraries
%{?python_provide:%python_provide python2-%{srcname}}
# Provide also the upstream original name yara-python
%description -n python2-%{srcname}
YARA for Python2 - This is a Python extension that gives access to YARA's
powerful features from Python scripts.
%if 0%{?with_python3}
%package -n python%{python3_pkgversion}-%{srcname}
Summary: Python3 binding for the YARA pattern matching tool
Group: Development/Libraries
@ -102,7 +66,6 @@ Group: Development/Libraries
%description -n python%{python3_pkgversion}-%{srcname}
YARA for Python3 - This is a Python extension that gives access to YARA's
powerful features from Python scripts.
%endif # with_python3
#====================================================================
@ -120,57 +83,23 @@ powerful features from Python scripts.
#====================================================================
%build
%py2_build "--dynamic-linking"
%if 0%{?with_python3}
%py3_build "--dynamic-linking"
%endif # with_python3
#====================================================================
%install
%py2_install
%if 0%{?with_python3}
%py3_install
%endif # with_python3
#====================================================================
%check
%if 0%{?with_check}
#python2
EXCLUDE=""
# Test for python-2.7 fails on testModuleData testcase on arm platform
%ifarch %{arm}
EXCLUDE='--exclude=^testModuleData$'
%endif
# Yara is not prepared to run on s390 - more tests failing on s390
# http://s390.koji.fedoraproject.org/kojifiles/work/tasks/9135/2399135/build.log
# https://github.com/VirusTotal/yara-python/issues/25
# 3.6.3 - testCompileFile started failing - https://kojipkgs.fedoraproject.org//work/tasks/9619/20589619/build.log
# https://github.com/VirusTotal/yara-python/issues/54
%ifarch s390 s390x %{power64}
EXCLUDE='--exclude=^testModuleData$|^testEntrypoint$|^testIn$|^testIntegerFunctions$|^testCompileFile$'
%endif
# Find the NOSETEST binary or use false if not present
NOSETESTS2=`ls /usr/bin/nosetests-2.* || ls /usr/bin/nosetests || which false `
PYTHONPATH=%{buildroot}/%{python2_sitearch}/ "$NOSETESTS2" -v "$EXCLUDE"
# Run potentially ignored tests separately so we can at least see the results
PYTHONPATH=%{buildroot}/%{python2_sitearch}/ "$NOSETESTS2" -v ./tests.py:TestYara.testModuleData \
./tests.py:TestYara.testEntrypoint ./tests.py:TestYara.testIn ./tests.py:TestYara.testIntegerFunctions || true
# ==============================================================================
# Tests for python3 always fail on testModuleData testcase
# Tests for python3 randomly fail on testCompare testcase
# reporting to upstream - https://github.com/VirusTotal/yara-python/issues/21
# temporarily run the failing tests but ignore the results for those 2
%if 0%{?with_python3}
EXCLUDE='--exclude=^testCompare$|^testModuleData$'
# Yara is not prepared to run on s390 - more tests failing on s390
@ -190,28 +119,24 @@ PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v "$EXCLUDE"
PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v ./tests.py:TestYara.testCompare \
./tests.py:TestYara.testModuleData ./tests.py:TestYara.testEntrypoint \
./tests.py:TestYara.testIn ./tests.py:TestYara.testIntegerFunctions || true
%endif # with_python3
%endif # with_check
#====================================================================
%files -n python2-%{srcname}
%license LICENSE
%doc README.rst
%{python2_sitearch}/%{srcname}*
%if 0%{?with_python3}
%files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE
%doc README.rst
%{python3_sitearch}/%{srcname}*
%endif # with_python3
#====================================================================
%changelog
* Fri Oct 12 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.8.1-3
- Python2 binary package has been removed
See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
* Mon Aug 27 2018 Michal Ambroz <rebus at, seznam.cz> - 3.8.1-2
- rebuild with yara 3.8.1 override