Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%else
%global with_python3 0
%endif

Name:           python-firehose
Version:        0.2
Release:        3%{?dist}
Summary:        Library for working with output from static code analyzers

License:        LGPLv2+
URL:            https://github.com/fedora-static-analysis/firehose
Source0:        https://pypi.python.org/packages/source/f/firehose/firehose-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python-six
BuildRequires:  libxml2
# ^^^: for xmllint
BuildRequires:  python-mock
# ^^^: used during selftests
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-six
BuildRequires:  python3-mock
# ^^^: used during selftests
%endif

Requires:  python-six

%description
"firehose" is a Python package intended for managing the results from
code analysis tools (e.g. compiler warnings, static analysis, linters,
etc).

It currently provides parsers for the output of gcc, clang-analyzer and
cppcheck.  These parsers convert the results into a common data model of
Python objects, with methods for lossless roundtrips through a provided
XML format.  There is also a JSON equivalent.


%if 0%{?with_python3}
%package -n python3-firehose
Summary:        Library for working with output from static code analyzers
Group:          Applications/System

Requires:  python3-six

%description -n python3-firehose
"firehose" is a Python package intended for managing the results from
code analysis tools (e.g. compiler warnings, static analysis, linters,
etc).

It currently provides parsers for the output of gcc, clang-analyzer and
cppcheck.  These parsers convert the results into a common data model of
Python objects, with methods for lossless roundtrips through a provided
XML format.  There is also a JSON equivalent.
%endif # with_python3


%prep
%setup -q -n firehose-%{version}

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif # with_python3


%build
%{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3


%install
%{__python} setup.py install --skip-build --root %{buildroot}

# Mark various scripts that have shebangs as executable:
chmod +x %{buildroot}/%{python_sitelib}/firehose/parsers/cppcheck.py
chmod +x %{buildroot}/%{python_sitelib}/firehose/parsers/gcc.py



%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
chmod +x %{buildroot}/%{python3_sitelib}/firehose/parsers/cppcheck.py
chmod +x %{buildroot}/%{python3_sitelib}/firehose/parsers/gcc.py
popd
%endif # with_python3


%check
%{__python} -m unittest discover -v
%if 0%{?with_python3}
pushd %{py3dir}
%{__python} -m unittest discover -v
popd
%endif # with_python3


%files
%doc README.rst lgpl-2.1.txt examples firehose.rng
%{python_sitelib}/firehose
%{python_sitelib}/firehose-%{version}-py2.?.egg-info


%if 0%{?with_python3}
%files -n python3-firehose
%doc README.rst lgpl-2.1.txt examples firehose.rng
%{python3_sitelib}/firehose
%{python3_sitelib}/firehose-%{version}-py3.?.egg-info
%endif # with_python3


%changelog
* Thu Jun  6 2013 David Malcolm <dmalcolm@redhat.com> - 0.2-3
- remove redundant clean of the buildroot

* Fri May 31 2013 David Malcolm <dmalcolm@redhat.com> - 0.2-2
- add BR on python-mock and python3-mock (for selftests)

* Mon Mar 25 2013 David Malcolm <dmalcolm@redhat.com> - 0.2-1
- initial packaging