Blob Blame History Raw
%global gitcommit 2c2a79d85508c8988b6d4ecfd4d0f55cff35ef11
%global gitdate 20150408
%global shortcommit %(c=%{gitcommit}; echo ${c:0:7})

Name:           python-igor
Version:        0.2
Release:        4.%{gitdate}git%{shortcommit}%{?dist}
Summary:        Parser for Igor Binary Waves (.ibw) and Packed Experiment (.pxp) files

# igor-0.2/igor/igorpy.py is PD, the restis LGPLv3+
License:        LGPLv3+ and Public Domain

URL:            http://blog.tremily.us/posts/igor/
Source0:        https://github.com/wking/igor/archive/%{gitcommit}.tar.gz#/igor-%{shortcommit}.tar.gz

# Python 2 compatible patches: https://github.com/wking/igor/pull/1
Patch001:       0001-Do-not-print-dictionaries-in-test-output.patch
# Python 3 only patches
Patch002:       0002-OSError-is-used-under-Python-3.patch
Patch003:       0003-Add-b-prefixes-for-Python-3.patch
Patch004:       0004-Add-b-prefixes-everywhere-in-test-output.patch
Patch005:       0005-Remove-u-prefix-and-L-suffix-which-do-not-appear-und.patch

BuildArch:      noarch
BuildRequires:  /usr/bin/rename
BuildRequires:  python2-devel
BuildRequires:  numpy
BuildRequires:  python-matplotlib
BuildRequires:  python-nose

BuildRequires:  python3-devel
BuildRequires:  python3-numpy
BuildRequires:  python3-matplotlib
BuildRequires:  python3-nose

%description
Python parsers for Igor Binary Waves (.ibw) and Packed Experiment
(.pxp) files written by WaveMetrics’ IGOR Pro software.

Note that this package is unrelated to igor (Automated distribution
life-cycle testing).

%package -n python2-igor
Summary:        %{summary}
Requires:       numpy
Requires:       python-matplotlib
%{?python_provide:%python_provide python2-igor}

%description -n python2-igor
Python parsers for Igor Binary Waves (.ibw) and Packed Experiment
(.pxp) files written by WaveMetrics’ IGOR Pro software.

Note that this package is unrelated to igor (Automated distribution
life-cycle testing).

%package -n python3-igor
Summary:        %{summary}
Requires:       python3-numpy
Requires:       python3-matplotlib
%{?python_provide:%python_provide python3-igor}

%description -n python3-igor
Python parsers for Igor Binary Waves (.ibw) and Packed Experiment
(.pxp) files written by WaveMetrics’ IGOR Pro software.

Note that this package is unrelated to igor (Automated distribution
life-cycle testing).

%prep
%autosetup -n igor-%{gitcommit} -N
%patch1 -p1

mkdir _python3
cp -av bin igor test README *.*  _python3/
pushd _python3
# Apply tests to adapt formatting to Python 3
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
popd

%build
%py2_build
pushd _python3
%py3_build
popd

%install
%py2_install
pushd _python3
%py3_install
popd

rename '.py' '' %{buildroot}%{_bindir}/*

%check
nosetests-%{python2_version} --with-doctest --doctest-tests igor test
pushd _python3
nosetests-%{python3_version} --with-doctest --doctest-tests igor test
popd

%global _docdir_fmt %{name}

# make sure that we got the python version right in the header
head -n1 %{buildroot}%{_bindir}/igorbinarywave | grep %{__python2} -q
head -n1 %{buildroot}%{_bindir}/igorpackedexperiment | grep %{__python2} -q

%files -n python2-igor
%{python2_sitelib}/*
%license COPYING.LESSER
%doc README
# Use python2 versions for now, python3 version has had much less testing.
# At some point in the future, we should switch to python3.
%{_bindir}/igorbinarywave
%{_bindir}/igorpackedexperiment

%files -n python3-igor
%{python3_sitelib}/*
%license COPYING.LESSER
%doc README

%changelog
* Mon Feb 29 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.2-4.20150408git2c2a79d
- Update License and add link to upstream pull request

* Sun Feb 28 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.2-3.20150408git2c2a79d
- Update to latest git snapshot
- Add nose to BR, fix Provides
- Patch tests to pass under Python 3

* Fri Feb 19 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.2-1
- Initial packaging