Blob Blame History Raw
%global commit 2054fd441a79aa926afc062b17a27e1db52fab54
%global shortcommit %(c=%{commit}; echo ${c:0:7})

Name:           Mayavi
Version:        4.3.2
Release:        0.1.20140421git%{shortcommit}%{?dist}
Summary:        Scientific data 3-dimensional visualizer
Group:          Applications/Engineering
License:        BSD and EPL and LGPLv2+ and LGPLv2 and LGPLv3
URL:            http://code.enthought.com/projects/mayavi/
#Source0:        http://www.enthought.com/repo/ets/mayavi-%{version}.tar.gz
Source0:        https://github.com/enthought/mayavi/archive/%{commit}/mayavi-%{version}-%{shortcommit}.tar.gz
Source1:        mayavi2.desktop
BuildRequires:  python2-devel
BuildRequires:  python-setuptools
# For HTML docs
BuildRequires:  python-sphinx
BuildRequires:  xorg-x11-server-Xvfb
# For tests
BuildRequires:  python-traits
BuildRequires:  numpy, vtk-python, desktop-file-utils 
Requires:       vtk-python
Requires:       python-apptools
Requires:       python-traitsui
Requires:       python-envisage
# Does not appear to work with Qt pyface backend, so requires wx
# https://bugzilla.redhat.com/show_bug.cgi?id=1008392
Requires:       python-pyface-wx

%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.


%package doc
Summary:        Documentation for %{name}

%description doc
Documentation for %{name}.


%prep
%setup -q -n mayavi-%{commit}

rm -rf *.egg-info

# fix wrong-file-end-of-line-encoding
for file in *.txt examples/mayavi/data/room_vis.wrl examples/tvtk/dscene.py \
 examples/mayavi/interactive/wx_mayavi_embed*.py ; do
 sed "s|\r||g" $file > $file.new && \
 touch -r $file $file.new && \
 mv $file.new $file
done

# file-not-utf8
for file in *.txt docs/*.txt; do
 iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \
 touch -r $file $file.new && \
 mv $file.new $file
done

# remove shebang
for file in mayavi/scripts/*.py; do
 sed '/^#!\//, 1d' $file > $file.new && \
 touch -r $file $file.new && \
 mv $file.new $file
done

# remove exec permission
find examples -type f -exec chmod 0644 {} ";"
chmod 0644 mayavi/tests/data/cellsnd.ascii.inp

%build
# Need xvfb-run for html doc building
CFLAGS="$RPM_OPT_FLAGS" xvfb-run python setup.py build

%install
python setup.py install --skip-build --root $RPM_BUILD_ROOT

# remove useless files
rm -f $RPM_BUILD_ROOT%{python_sitearch}/tvtk/setup.py*
find $RPM_BUILD_ROOT%{python_sitearch} -name \.buildinfo \
 -type f -print | xargs rm -f -

# fix wrong-file-end-of-line-encoding
for file in $RPM_BUILD_ROOT%{python_sitearch}/mayavi/html/_downloads/wx_mayavi*.py; do
 sed "s|\r||g" $file > $file.new && \
 touch -r $file $file.new && \
 mv $file.new $file
done

# non-executable-script
chmod +x $RPM_BUILD_ROOT%{python_sitearch}/mayavi/tests/runtests.py

mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1/
cp -p docs/mayavi2.man $RPM_BUILD_ROOT/%{_mandir}/man1/mayavi2.1

desktop-file-install --dir=${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE1}
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

%check
# This isn't working yet
libdir=`echo build/lib.*`
ln tvtk/tvtk_classes.zip ${libdir}/tvtk/
# Mayavi tests appear to hang running under xvfb-run
PYTHONPATH=${libdir} mayavi/scripts/mayavi2 -t || :

%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 *.txt docs/*.txt
%dir %{python_sitearch}/mayavi
%dir %{python_sitearch}/tvtk
%{python_sitearch}/mayavi/[_a-gi-z]*
%{python_sitearch}/tvtk/[_a-gi-z]*
%{python_sitearch}/*.egg-info
%{_bindir}/mayavi2
%{_bindir}/tvtk_doc
%{_mandir}/man1/mayavi2.1.*
%{_datadir}/applications/mayavi2.desktop
%{_datadir}/icons/hicolor/48x48/apps/mayavi2.png

%files doc
%doc *.txt docs/*.txt examples/
%doc %{python_sitearch}/mayavi/html
%doc %{python_sitearch}/tvtk/html


%changelog
* Fri May 9 2014 Orion Poplawski <orion@cora.nwra.com> - 4.3.2-0.1.20140421git2054fd4
- Update to latest git snapshot for VTK 6 support

* Thu Mar 13 2014 Orion Poplawski <orion@cora.nwra.com> - 4.3.1-1
- Update to 4.3.1
- Split docs into separate subpackage

* Thu Sep 19 2013 Orion Poplawski <orion@cora.nwra.com> - 4.3.0-8
- Update to current git to build against vtk 6

* Wed Sep 18 2013 Orion Poplawski <orion@cora.nwra.com> - 4.3.0-7
- Add patch to fix vtkQt class loading issue (bug #1008392)

* Mon Sep 16 2013 Orion Poplawski <orion@cora.nwra.com> - 4.3.0-6
- Require python-pyface-wx (bug #1008392)

* Tue Aug 06 2013 Orion Poplawski <orion@cora.nwra.com> - 4.3.0-5
- Drop BR on python-setupdocs, no longer used

* Fri Aug 02 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.3.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed May 22 2013 Orion Poplawski <orion@cora.nwra.com> - 4.3.0-3
- Use lowercase names in BR

* Mon May 13 2013 Orion Poplawski <orion@cora.nwra.com> - 4.3.0-2
- Change requires to python-envisage

* Fri May 10 2013 Orion Poplawski <orion@cora.nwra.com> - 4.3.0-1
- Update to 4.3.0

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.2.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.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri May 25 2012 Orion Poplawski <orion@cora.nwra.com> - 4.2.0-1
- Update to 4.2.0
- Add BR python-sphinx and patch to set new html build location
- Drop %%defattr()
 
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Jan 05 2011 Rakesh Pandit <rakesh@fedoraproject.org> 3.4.0-1
- Updated to 3.4.0

* Fri Aug 13 2010 Chen Lei <supercyper@163.com> 3.3.2-1
- Update spec to match latest guidelines w.r.t %%clean
- Remove explict dependency on python-TraitsBackendQt.spec
- Rename man page(Mayavi -> mayavi2)
- Remove docs src
- Remove tvtk_doc.desktop to avoid confusion
- Fix timestampes for example files

* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 3.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* 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