Name: python-yara Version: 3.7.0 Summary: Python binding for the YARA pattern matching tool Group: Development/Libraries License: ASL 2.0 URL: http://github.com/VirusTotal/yara-python/ # http://VirusTotal.github.io/yara/ %global srcname yara %global gituser VirusTotal %global gitname %{srcname}-python %global commit 71138553e7cfe7f96e7822898dd8331f3eacef4e %global gitdate 20171110 %global shortcommit %(c=%{commit}; echo ${c:0:7}) # 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: 5%{?dist} Source0: https://github.com/%{gituser}/%{gitname}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz %else Release: 0.1.%{gitdate}git%{shortcommit}%{?dist} Source0: https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz %endif #Build_release BuildRequires: gcc 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 %if 0%{?with_python3} BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-nose BuildRequires: python%{python3_pkgversion}-setuptools %endif # if with_python3 %description Python binding for the YARA pattern matching tool. YARA is a tool aimed at (but not limited to) helping malware researchers to identify and classify malware samples. With YARA you can create descriptions of malware families (or whatever you want to describe) based on textual or binary patterns. Each description, a.k.a rule, consists of a set of strings 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 %{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} %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 #==================================================================== %prep %if 0%{?build_release} > 0 # Build from git release version %autosetup -n %{gitname}-%{version} %else # Build from git commit %autosetup -n %{gitname}-%{commit} %endif #build_release #==================================================================== %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 # 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=^testCompare$|^testModuleData$|^testEntrypoint$|^testIn$|^testIntegerFunctions$|^testCompileFile$' %endif # Find the NOSETEST binary or use false if not present NOSETESTS3=`ls /usr/bin/nosetests-3.* || which false ` PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v "$EXCLUDE" # Run potentially ignored tests separately so we can at least see the results 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 Mar 16 2018 Michal Ambroz - 3.7.0-5 - fix dependencies for building the epel7/epel6 packages * Thu Mar 15 2018 Michal Ambroz - 3.7.0-4 - rebuild with yara 3.7.1 for supported platforms - fix dependencies for building the epel packages * Wed Feb 28 2018 Iryna Shcherbina - 3.7.0-3 - Update Python 2 dependency declarations to new packaging standards (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) * Fri Feb 09 2018 Fedora Release Engineering - 3.7.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild * Wed Nov 15 2017 Michal Ambroz - 3.7.0-1 - bump to yara 3.7.0 release version (#1511921) * Thu Aug 03 2017 Fedora Release Engineering - 3.6.3-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild * Thu Jul 27 2017 Fedora Release Engineering - 3.6.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Mon Jul 17 2017 Michal Ambroz - 3.6.3-2 - fix bogus dates in the changelog - omit failing testCompileFile test for s390/ppc64 * Mon Jul 17 2017 Michal Ambroz - 3.6.3-1 - bump to upstream 3.6.3 release version * Sat Feb 11 2017 Fedora Release Engineering - 3.5.0-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Mon Dec 19 2016 Miro Hrončok - 3.5.0-9 - Rebuild for Python 3.6 * Wed Nov 23 2016 Dan Horák - 3.5.0-8 - fix the arch lists * Tue Aug 16 2016 Michal Ambroz - 3.5.0-7 - adding test exclusions also for armv7hl and ppc64le * Tue Aug 16 2016 Michal Ambroz - 3.5.0-6 - additionally testEntrypoint testIn testIntegerFunctions failing on s390/ppc64 - exclude those tests for build of s390/ppc64 * Tue Aug 16 2016 Michal Ambroz - 3.5.0-5 - testModuleData is failing on arm platform even for python 2.7 - exclude this test for build of arm * Fri Aug 12 2016 Michal Ambroz - 3.5.0-4 - remove unnecessary ldconfig - count with the python3 test values except the 2 known for failing * Thu Aug 11 2016 Michal Ambroz - 3.5.0-3 - change python3 naming to allow epel7 python34 packages * Thu Aug 04 2016 Michal Ambroz - 3.5.0-2 - cosmetics * Thu Aug 04 2016 Michal Ambroz - 3.5.0-1 - with yara 3.5.0 the python yara binding is separate library