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.2.0
Release:        6%{?dist}
Summary:        Scientific data 3-dimensional visualizer

Group:          Applications/Engineering
License:        BSD and EPL and LGPLv2+ and LGPLv3+
Source1:        Mayavi.desktop
Source2:        tvtk_doc.desktop
# Removes already generated tvtk class zip file
Patch0:         Mayavi-3.1.0-enthought_tvtk_code_gen_py.patch
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
BuildRequires:  numpy
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


The Mayavi project includes two related packages for 3-dimensional

 * 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

%setup -q -n %{name}-%{version}
%patch0 -p1 -b  enthought_tvtk_code_gen_py
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/ > \
touch -c -r examples/mayavi/ \
mv -f examples/mayavi/ \

sed 's/\r//' examples/mayavi/data/room_vis.wrl > \
touch -c -r examples/mayavi/data/room_vis.wrl \
mv -f  examples/mayavi/data/room_vis.wrl.fixed \

sed 's/\r//' examples/tvtk/ > examples/tvtk/
touch -c -r examples/tvtk/ examples/tvtk/
mv -f examples/tvtk/ examples/tvtk/

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/ examples/mayavi/ \
 examples/mayavi/ examples/mayavi/ \
 examples/mayavi/ examples/tvtk/plugins/ \
 examples/mayavi/ examples/mayavi/ \
 examples/mayavi/ examples/mayavi/ \

CFLAGS="$RPM_OPT_FLAGS" python release build

python install -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/ \
 $RPM_BUILD_ROOT/%{python_sitearch}/enthought/mayavi/scripts/ \

rm $RPM_BUILD_ROOT/%{python_sitearch}/*-nspkg.pth
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/
mv docs/ $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 \
install -p -m 644 ./docs/source/mayavi/images/mayavi2-48x48.png \

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


touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

%doc *.txt docs/*.txt examples/ docs/pdf/*.pdf
%doc docs/pdf/*/*.pdf docs/source

* Fri Jun 26 2009 Rakesh Pandit <> 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 <> 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 <> 3.2.0-4
- Removed wrong scriplets and corrected 'commets' in
-  tvtk_doc.desktop file.

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

* Mon Jun 15 2009 Rakesh Pandit <> 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 <> 3.2.0-2
- Saving timestamp, and fixed indentation

* Fri Jun 12 2009 Rakesh Pandit <> 3.2.0-1
- Updated

* Wed Jun 10 2009 Rakesh Pandit <> 3.1.0-3
- Changed name to Mayavi

* Tue Jan 27 2009 Rakesh Pandit <> 3.1.0-2
- Fixed description.

* Tue Jan 27 2009 Rakesh Pandit <> 3.1.0-1
- Initial package