# Linking issue, temporarily disabled.
# %if 0%{?fedora} >= 22 || 0%{?rhel} >= 8
# %global with_python3 1
# %else
%global with_python3 0
# %endif
Name: PyMca
Version: 4.7.3
Release: 2%{?dist}
Summary: PyMca X-ray Fluorescence Toolkit
License: GPLv2+
URL: http://pymca.sourceforge.net/
# Original source: http://downloads.sourceforge.net/sourceforge/pymca/pymca%{version}-src.tgz
# However it bundles a copy of the "sift" module which implements a patented algorithm.
# The algorithm can be used for non-commercial research purposes ONLY. Per:
# http://fedoraproject.org/wiki/Packaging:SourceURL#When_Upstream_uses_Prohibited_Code
# we must remove them before uploading.
# rm -frv PyMca/sift
Source0: pymca%{version}-src-clean.tgz
Source1: PyMca.desktop
Source2: edfviewer.desktop
Source3: elementsinfo.desktop
Source4: mca2edf.desktop
Source5: peakidentifier.desktop
Source6: pymcabatch.desktop
Source7: pymcapostbatch.desktop
Source8: pymcaroitool.desktop
Patch0: 0001-PyMca-4.7.3-set-Fedora-specific-paths.patch
BuildRequires: desktop-file-utils
BuildRequires: ImageMagick
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-numpy
BuildRequires: python3-PyQt4
%else
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: numpy
BuildRequires: PyQt4
%endif
BuildRequires: mesa-libGL-devel
BuildRequires: mesa-libGLU-devel
BuildRequires: PyQwt
BuildRequires: qhull-devel
Requires: hicolor-icon-theme
%if 0%{?with_python3}
Requires: python3-numpy
Requires: python3-PyQt4
%else
Requires: numpy
Requires: PyQt4
%endif
Requires: PyQwt
Requires: %{name}-data = %{version}-%{release}
%description
PyMCA provides a graphical interface for multi-channel analyser spectra
visualization and analysis. PyMca can display spectra from a file or directly
from SPEC during acquisitions.
%package data
Summary: Data files for %{name}
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
%description data
This package contains photon interaction data/elements data for %{name}.
%prep
%setup -q
%patch0 -p1
# Drop bundled qhull.
rm -frv third-party/
# Patch for the craps qhull brings in.
sed -i -e 's|"geom.h"|<geom.h>|' \
-e 's|"libqhull.h"|<qhull.h>|' \
-e 's|"poly.h"|<poly.h>|' \
-e 's|"qset.h"|<qset.h>|' \
PyMca/Object3D/Object3DQhull/Object3DQhull.c
# Fix wrong shebang of pymcapostbatch.
%if 0%{?with_python3}
sed -i "s|!python|!%{__python3}|g" PyMca/scripts/pymcapostbatch
%else
sed -i "s|!python|!%{__python2}|g" PyMca/scripts/pymcapostbatch
%endif
%build
# Need to define manually. Note using pkg-config to export the cflags
# is not identified by the setup.py script as it requires non-blank
# stdin for both CFLAGS/LDFLAGS, so we manually define the CFLAGS.
QHULL_CFLAGS="-I%{_includedir}/qhull" \
QHULL_LIBS="-lqhull" \
SPECFILE_USE_GNU_SOURCE=1 \
%if 0%{?with_python3}
%{__python3} setup.py build
%else
%{__python2} setup.py build
%endif
%install
%if 0%{?with_python3}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
%else
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
%endif
# Install desktop file.
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{S:1}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{S:2}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{S:3}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{S:4}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{S:5}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{S:6}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{S:7}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{S:8}
# Convert to various sizes, via the 256x256 source.
for size in 192x192 128x128 96x96 72x72 64x64 48x48 40x40 36x36 32x32 26x26 24x24 22x22 16x16 ; do
install -pdm755 \
%{buildroot}%{_datadir}/icons/hicolor/${size}/apps
convert -resize ${size} icons/PyMca_256x256.png \
%{buildroot}%{_datadir}/icons/hicolor/${size}/apps/%{name}.png
done
# Get rid of spurious executable rights.
%if 0%{?with_python3}
find %{buildroot}%{python3_sitearch}/PyMca/ -type f -exec chmod 644 {} +
find %{buildroot}%{python3_sitearch}/PyMca/ -name *.so -exec chmod 755 {} +
%else
find %{buildroot}%{python2_sitearch}/PyMca/ -type f -exec chmod 644 {} +
find %{buildroot}%{python2_sitearch}/PyMca/ -name *.so -exec chmod 755 {} +
%endif
# Get rid of /usr/bin/env in libraries.
%if 0%{?with_python3}
for lib in %{buildroot}%{python3_sitearch}/PyMca/*.py; do
sed '/\/usr\/bin\/env/d' $lib > $lib.new &&
touch -r $lib $lib.new &&
mv $lib.new $lib
done
%else
for lib in %{buildroot}%{python2_sitearch}/PyMca/*.py; do
sed '/\/usr\/bin\/env/d' $lib > $lib.new &&
touch -r $lib $lib.new &&
mv $lib.new $lib
done
%endif
%check
%if 0%{?with_python3}
PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} PyMca/tests/TestAll.py
%else
PYTHONPATH=%{buildroot}%{python2_sitearch} %{__python2} PyMca/tests/TestAll.py
%endif
%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%postun
if [ $1 -eq 0 ] ; then
touch --no-create %{_datadir}/icons/hicolor &>/dev/null
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files
%doc changelog.txt LICENSE.GPL README
%{_bindir}/edfviewer
%{_bindir}/elementsinfo
%{_bindir}/mca2edf
%{_bindir}/peakidentifier
%{_bindir}/pymca*
%{_bindir}/rgbcorrelator
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*x*/apps/%{name}.png
%{_mandir}/man1/*.1*
%if 0%{?with_python3}
%{python3_sitearch}/PyMca/
%{python3_sitearch}/PyMca-%{version}-py%{python3_version}.egg-info
%else
%{python2_sitearch}/PyMca/
%{python2_sitearch}/PyMca-%{version}-py%{python2_version}.egg-info
%endif
%exclude %{_pkgdocdir}/
%files data
%{_datadir}/%{name}/
%{_pkgdocdir}/
%changelog
* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.7.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Fri Jul 04 2014 Christopher Meng <rpm@cicku.me> - 4.7.3-1
- Update to 4.7.3
* Wed Jun 18 2014 Yaakov Selkowitz <yselkowi@redhat.com> - 4.5.0-6
- Fix FTBFS with -Werror=format-security (#1105919)
- Cleanup spec
* Fri Jun 06 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.5.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Fri Aug 02 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.5.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.5.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Sat Mar 24 2012 Jussi Lehtola <jussilehtola@fedoraproject.org> - 4.5.0-1
- Update to 4.5.0.
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.4.1-5.p1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Thu Jul 14 2011 Jussi Lehtola <jussilehtola@fedoraproject.org> - 4.4.1-4.p1
- Fix binary permissions (BZ #721149).
* Fri Feb 25 2011 Jussi Lehtola <jussilehtola@fedoraproject.org> - 4.4.1-3.p1
- Update to 4.4.1p1.
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.4.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Fri Dec 10 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 4.4.1-1
- Update to 4.4.1.
* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 4.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
* Sat Jun 19 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 4.4.0-1
- Update to 4.4.0.
* Fri Oct 30 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 4.3.0-4
- Keep time stamps also on binfiles.
* Fri Oct 30 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 4.3.0-3
- Added BR: python-devel.
- Added desktop file.
* Fri Oct 30 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 4.3.0-2
- Keep time stamps during sed of libraries.
- Changed BR: python-setuptools-devel to python-setuptools-devel.
* Thu Oct 08 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 4.3.0-1
- First release.