Blob Blame History Raw
# sitelib for noarch packages, sitearch for others (remove the unneeded one)
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

Name:           Mayavi
Version:        3.3.0
Release:        1%{?dist}
Summary:        Scientific data 3-dimensional visualizer

Group:          Applications/Engineering
License:        BSD and EPL and LGPLv2+ and LGPLv3+
URL:            http://pypi.python.org/pypi/Mayavi/
Source0:        http://www.enthought.com/repo/ETS/%{name}-%{version}.tar.gz
Source1:        Mayavi.desktop
Source2:        tvtk_doc.desktop
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  python-setuptools, python-setupdocs, python-sphinx
BuildRequires:  vtk-python, desktop-file-utils
%if 0%{?fedora} >= 11
BuildRequires:  numpy-f2py
%else
BuildRequires:  numpy
%endif
Requires:       numpy, vtk-python
Requires:       wxPython
Requires:       python-AppTools
Requires:       python-EnthoughtBase
Requires:       python-EnvisageCore
Requires:       python-EnvisagePlugins
Requires:       python-Traits >= 3.1.0
Requires:       python-TraitsGUI
Requires:       python-TraitsBackendQt >= 3.1.0

%description

The Mayavi project includes two related packages for 3-dimensional
visualization:

 * Mayavi2: A tool for easy and interactive visualization of data.
 * TVTK: A Traits-based wrapper for the Visualization Toolkit, a
popular open-source visualization library.
These operate at different levels of abstraction. TVTK manipulates
visualization objects, while Mayavi2 lets you operate on your data,
and then see the results. Most users either use the Mayavi user
interface or program to its scripting interface; you probably don't
need to interact with TVTK unless you want to create a new Mayavi
module.

%prep
%setup -q -n %{name}-%{version}
rm -rf Mayavi.egg-info

# removes .buildinfo files
find enthought/mayavi/html/ enthought/tvtk/html/ -name \.buildinfo \
 -type f -print | xargs rm -f -

# Fixed license naming
sed 's/icon_/image_/g' image_LICENSE.txt > image_LICENSE.txt.fixed
touch -c -r image_LICENSE.txt image_LICENSE.txt.fixed
mv -f image_LICENSE.txt.fixed image_LICENSE.txt

# wrong-file-end-of-line-encoding
sed 's/\r//' examples/mayavi/data/room_vis.wrl > \
 examples/mayavi/data/room_vis.wrl.fixed
touch -c -r examples/mayavi/data/room_vis.wrl \
 examples/mayavi/data/room_vis.wrl.fixed
mv -f  examples/mayavi/data/room_vis.wrl.fixed \
 examples/mayavi/data/room_vis.wrl

sed 's/\r//' examples/tvtk/dscene.py > examples/tvtk/dscene.py.fixed
touch -c -r examples/tvtk/dscene.py examples/tvtk/dscene.py.fixed
mv -f examples/tvtk/dscene.py.fixed examples/tvtk/dscene.py

sed 's/\r//' image_LICENSE_Nuvola.txt > image_LICENSE_Nuvola.txt.fixed
touch -c -r image_LICENSE_Nuvola.txt image_LICENSE_Nuvola.txt.fixed
mv -f image_LICENSE_Nuvola.txt.fixed image_LICENSE_Nuvola.txt

sed 's/\r//' image_LICENSE_OOo.txt > image_LICENSE_OOo.txt.fixed
touch -c -r image_LICENSE_OOo.txt image_LICENSE_OOo.txt.fixed
mv -f image_LICENSE_OOo.txt.fixed image_LICENSE_OOo.txt

sed 's/\r//' image_LICENSE_Eclipse.txt > image_LICENSE_Eclipse.txt.fixed
touch -c -r image_LICENSE_Eclipse.txt image_LICENSE_Eclipse.txt.fixed
mv -f image_LICENSE_Eclipse.txt.fixed image_LICENSE_Eclipse.txt

# file-not-utf8
iconv -f iso8859-1 -t utf-8 image_LICENSE_OOo.txt > image_LICENSE_OOo.txt.conv \
 && touch -c -r image_LICENSE_OOo.txt image_LICENSE_OOo.txt.conv \
 && mv -f image_LICENSE_OOo.txt.conv image_LICENSE_OOo.txt
iconv -f iso8859-1 -t utf-8 image_LICENSE_Eclipse.txt > image_LICENSE_Eclipse.txt.conv \
 && touch -c -r image_LICENSE_Eclipse.txt image_LICENSE_Eclipse.txt.conv \
 && mv -f image_LICENSE_Eclipse.txt.conv image_LICENSE_Eclipse.txt
iconv -f iso8859-1 -t utf-8 README-mayavi.txt > README-mayavi.txt.conv \
 && touch -c -r README-mayavi.txt README-mayavi.txt.conv \
 && mv -f README-mayavi.txt.conv README-mayavi.txt
iconv -f iso8859-1 -t utf-8 docs/THANKS.txt > docs/THANKS.txt.conv \
 && touch -c -r docs/THANKS.txt docs/THANKS.txt.conv \
 && mv -f docs/THANKS.txt.conv docs/THANKS.txt

# spurious-executable-perm
chmod -x examples/mayavi/nongui.py \
 examples/tvtk/plugins/test.py \
 enthought/mayavi/tests/data/cellsnd.ascii.inp

%build
CFLAGS="$RPM_OPT_FLAGS" python setup.py release build


%install
rm -rf $RPM_BUILD_ROOT
python setup.py install -v -O1 --skip-build --root $RPM_BUILD_ROOT
sed -i 's/\.dev$//g' $RPM_BUILD_ROOT/%{python_sitearch}/%{name}-%{version}-*.egg-info/requires.txt

# non-executable-script
chmod +x $RPM_BUILD_ROOT/%{python_sitearch}/enthought/mayavi/tests/runtests.py \
 $RPM_BUILD_ROOT/%{python_sitearch}/enthought/mayavi/scripts/mayavi2.py \
 $RPM_BUILD_ROOT/%{python_sitearch}/enthought/tvtk/setup.py

rm $RPM_BUILD_ROOT/%{python_sitearch}/*-nspkg.pth
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/
mv docs/mayavi2.man $RPM_BUILD_ROOT/%{_mandir}/man1/%{name}.1
desktop-file-install --dir=${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE1}
desktop-file-install --dir=${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE2}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/
install -p -m 644 ./docs/source/mayavi/images/mayavi2-48x48.png \
 $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/mayavi2.png
install -p -m 644 ./docs/source/mayavi/images/mayavi2-48x48.png \
 $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/tvtk_doc.png 

# removes .buildinfo files
find docs/source/ \( -name \.static -o -name \.templates \) \
 -type d -print | xargs rm -rf -


%clean
rm -rf $RPM_BUILD_ROOT


%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
%defattr(-,root,root,-)
%doc *.txt docs/*.txt examples/
%doc docs/source
%{_bindir}/mayavi2
%{_bindir}/tvtk_doc
%{python_sitearch}/enthought/*
%{python_sitearch}/*.egg-info
%{_mandir}/man1/%{name}.1.gz
%{_datadir}/applications/%{name}.desktop
%{_datadir}/applications/tvtk_doc.desktop
%{_datadir}/icons/hicolor/48x48/apps/tvtk_doc.png
%{_datadir}/icons/hicolor/48x48/apps/mayavi2.png


%changelog
* Sun Jan 31 2010 Rakesh Pandit <rakesh@fedoraproject.org> 3.3.0-1
- Updated to 3.2.0

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Fri Jun 26 2009 Rakesh Pandit <rakesh@fedoraproject.org> 3.2.0-6
- Fixed BR, and removed .template & .static directories from docs/source
- Included missing icon from .desktop

* Fri Jun 26 2009 Rakesh Pandit <rakesh@fedoraproject.org> 3.2.0-5
- Using mayavi2-48x48.png has icons for both .desktop files
- Added Categories to .desktop files

* Thu Jun 25 2009 Rakesh Pandit <rakesh@fedoraproject.org> 3.2.0-4
- Removed wrong scriplets and corrected 'commets' in
-  tvtk_doc.desktop file.

* Wed Jun 24 2009 Rakesh Pandit <rakesh@fedoraproject.org> 3.2.0-3
- Fixed license issue and group tag
- Added a .desktop file

* Mon Jun 15 2009 Rakesh Pandit <rakesh@fedoraproject.org> 3.2.0-3
- included man page, adjusted description, removed useless BR's,
- fixed owned directory issue, cleaned up spec

* Fri Jun 12 2009 Rakesh Pandit <rakesh@fedoraproject.org> 3.2.0-2
- Saving timestamp, and fixed indentation

* Fri Jun 12 2009 Rakesh Pandit <rakesh@fedoraproject.org> 3.2.0-1
- Updated

* Wed Jun 10 2009 Rakesh Pandit <rakesh@fedoraproject.org> 3.1.0-3
- Changed name to Mayavi

* Tue Jan 27 2009 Rakesh Pandit <rakesh@fedoraproject.org> 3.1.0-2
- Fixed description.

* Tue Jan 27 2009 Rakesh Pandit <rakesh@fedoraproject.org> 3.1.0-1
- Initial package