Name: PyMca
Version: 5.8.9
Release: %autorelease
Summary: X-ray Fluorescence Toolkit
License: GPLv2+
URL: http://pymca.sourceforge.net/
# https://github.com/vasole/pymca
%if 0
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:
./getsources.sh [%{version}]
%endif
Source0: pymca-%{version}-filtered.tar.xz
Source1: PyMca.desktop
Source2: edfviewer.desktop
Source3: elementsinfo.desktop
Source4: mca2edf.desktop
Source5: peakidentifier.desktop
Source6: pymcabatch.desktop
Source7: pymcapostbatch.desktop
Source8: pymcaroitool.desktop
BuildRequires: gcc
BuildRequires: desktop-file-utils
BuildRequires: ImageMagick
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3dist(cython)
BuildRequires: python3dist(numpy)
BuildRequires: python3dist(h5py)
BuildRequires: python3dist(pyqt5)
BuildRequires: python3dist(fisx)
BuildRequires: python3dist(matplotlib)
BuildRequires: python3-matplotlib-qt5
BuildRequires: mesa-libGL-devel
BuildRequires: mesa-libGLU-devel
BuildRequires: qhull-devel
BuildRequires: glibc-langpack-pl
Requires: hicolor-icon-theme
Requires: %{name}-data = %{version}-%{release}
# Dependency on the graphical toolkit is not autogenerated because many different
# ones are supported, https://bugzilla.redhat.com/show_bug.cgi?id=2084297.
Requires: python3dist(pyqt5)
Requires: python3-matplotlib-qt5
%description
PyMCA provides a graphical interface for multi-channel analyzer 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
%description data
This package contains photon interaction data/elements data for %{name}.
%prep
%autosetup -p1 -n pymca-%{version}
# Fix wrong shebang of pymcapostbatch.
sed -i "s|!python|!%python3|g" PyMca5/scripts/pymcapostbatch
%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}/libqhull" \
QHULL_LIBS="-lqhull" \
SPECFILE_USE_GNU_SOURCE=1 \
PYMCA_DATA_DIR=/usr/share/PyMca \
PYMCA_DOC_DIR=/usr/share/doc/PyMca \
%py3_build
%install
PYMCA_DATA_DIR=/usr/share/PyMca \
PYMCA_DOC_DIR=/usr/share/doc/PyMca \
%py3_install
# 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}
# Merge applications into one software center item
mkdir -p %{buildroot}%{_datadir}/appdata
cat >%{buildroot}%{_datadir}/appdata/edfviewer.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Richard Hughes <richard@hughsie.com> -->
<component type="desktop">
<metadata_license>CC0-1.0</metadata_license>
<id>edfviewer.desktop</id>
<metadata>
<value key="X-Merge-With-Parent">PyMca.desktop</value>
</metadata>
</component>
EOF
cat >%{buildroot}%{_datadir}/appdata/elementsinfo.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Richard Hughes <richard@hughsie.com> -->
<component type="desktop">
<metadata_license>CC0-1.0</metadata_license>
<id>elementsinfo.desktop</id>
<metadata>
<value key="X-Merge-With-Parent">PyMca.desktop</value>
</metadata>
</component>
EOF
cat >%{buildroot}%{_datadir}/appdata/mca2edf.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Richard Hughes <richard@hughsie.com> -->
<component type="desktop">
<metadata_license>CC0-1.0</metadata_license>
<id>mca2edf.desktop</id>
<metadata>
<value key="X-Merge-With-Parent">PyMca.desktop</value>
</metadata>
</component>
EOF
cat >%{buildroot}%{_datadir}/appdata/peakidentifier.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Richard Hughes <richard@hughsie.com> -->
<component type="desktop">
<metadata_license>CC0-1.0</metadata_license>
<id>peakidentifier.desktop</id>
<metadata>
<value key="X-Merge-With-Parent">PyMca.desktop</value>
</metadata>
</component>
EOF
cat >%{buildroot}%{_datadir}/appdata/pymcabatch.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Richard Hughes <richard@hughsie.com> -->
<component type="desktop">
<metadata_license>CC0-1.0</metadata_license>
<id>pymcabatch.desktop</id>
<metadata>
<value key="X-Merge-With-Parent">PyMca.desktop</value>
</metadata>
</component>
EOF
cat >%{buildroot}%{_datadir}/appdata/pymcapostbatch.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Richard Hughes <richard@hughsie.com> -->
<component type="desktop">
<metadata_license>CC0-1.0</metadata_license>
<id>pymcapostbatch.desktop</id>
<metadata>
<value key="X-Merge-With-Parent">PyMca.desktop</value>
</metadata>
</component>
EOF
cat >%{buildroot}%{_datadir}/appdata/pymcaroitool.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Richard Hughes <richard@hughsie.com> -->
<component type="desktop">
<metadata_license>CC0-1.0</metadata_license>
<id>pymcaroitool.desktop</id>
<metadata>
<value key="X-Merge-With-Parent">PyMca.desktop</value>
</metadata>
</component>
EOF
# 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.
find %{buildroot}%{python3_sitearch}/PyMca5/ -type f -exec chmod 644 {} +
find %{buildroot}%{python3_sitearch}/PyMca5/ -name *.so -exec chmod 755 {} +
# Get rid of /usr/bin/env in libraries.
find %{buildroot}%{python3_sitearch}/PyMca5 -type f -name '*.py' \
-exec sed -i '/\/usr\/bin\/env/d' {} + \
-exec touch -r setup.py {} +
%check
PYTHONPATH=%{buildroot}%{python3_sitearch} \
PYMCA_DATA_DIR=%{buildroot}/usr/share/PyMca \
PYMCA_DOC_DIR=%{buildroot}/usr/share/doc/PyMca \
QT_QPA_PLATFORM=offscreen \
LC_ALL=pl_PL.utf8 \
%python3 PyMca5/tests/TestAll.py
# Test results are ingored. In F34 rawhide mock:
# ERROR: testHdf5Uri (ConfigDictTest.testConfigDict)
# FAIL: testNxExtStringAttribute (NexusUtilsTest.testNexusUtils)
# FAIL: testNxExtStringDataset (NexusUtilsTest.testNexusUtils)
# FAIL: testNxStringDataset (NexusUtilsTest.testNexusUtils)
%files
%license LICENSE.GPL
%doc changelog.txt README.rst
%{_bindir}/edfviewer
%{_bindir}/elementsinfo
%{_bindir}/mca2edf
%{_bindir}/peakidentifier
%{_bindir}/pymca*
%{_bindir}/rgbcorrelator
%{_datadir}/appdata/*.appdata.xml
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*x*/apps/%{name}.png
%{_mandir}/man1/*.1*
%{python3_sitearch}/PyMca5/
%{python3_sitearch}/PyMca5-%{version}-py%{python3_version}.egg-info
%exclude %{_pkgdocdir}
%files data
%{_datadir}/%{name}/
%{_pkgdocdir}/
%changelog
%autochangelog