%if 0%{?rhel} && 0%{?rhel} <= 6
# Failsafe backport of Python2-macros for RHEL <= 6
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?python_version: %global python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")}
%{!?__python2: %global __python2 %{__python}}
%{!?python2_sitelib: %global python2_sitelib %{python_sitelib}}
%{!?python2_sitearch: %global python2_sitearch %{python_sitearch}}
%{!?python2_version: %global python2_version %{python_version}}
%endif
%if 0%{?fedora} > 12
%global with_python3 1
%endif
%global upstream_name ase
%global upstream_commit 88f25faf32519e6e191d1e702b0554d2e5f43399
Name: python-ase
Version: 3.11.0
Release: 20%{?dist}
Summary: Atomic Simulation Environment
%{?el5:Group: Applications/Scientific}
# The entire source code is LGPLv2+ except:
# ase/io/fortranfile.py which is MIT
License: LGPLv2+ and MIT
URL: https://wiki.fysik.dtu.dk/ase/
Source0: https://gitlab.com/%{upstream_name}/%{upstream_name}/repository/archive.tar.gz?ref=%{version}#/%{upstream_name}-%{version}-%{upstream_commit}.tar.gz
%{?el5:BuildRoot: %(mktemp -ud %{_tmppath}/%{upstream_name}-%{version}-%{upstream_commit}-%{release}-XXXXXX)}
BuildArch: noarch
%global PKG_TOP $RPM_BUILD_DIR/%{upstream_name}-%{version}-%{upstream_commit}
BuildRequires: python2-devel
%if 0%{?with_python3}
BuildRequires: python3-devel
%endif # if with_python3
BuildRequires: gettext
BuildRequires: desktop-file-utils
BuildRequires: numpy
%if 0%{?with_python3}
BuildRequires: python3-numpy
%endif # if with_python3
%if 0%{?rhel} && 0%{?rhel} <= 6
Requires: pygtk2
%endif
Requires: python-matplotlib
%description
The Atomic Simulation Environment (ASE) is the common part of the simulation
tools developed at CAMd. ASE provides Python modules for manipulating atoms,
analyzing simulations, visualization etc.
%if 0%{?with_python3}
%package -n python3-ase
Summary: Atomic Simulation Environment for Python 3
Requires: python3-matplotlib
%description -n python3-ase
The Atomic Simulation Environment (ASE) is the common part of the simulation
tools developed at CAMd. ASE provides Python 3 modules for manipulating atoms,
analyzing simulations, etc.
%endif # with_python3
%prep
%setup -qn %{upstream_name}-%{version}-%{upstream_commit}
# copy required sources and remove doc directory
cp -p doc/static/%{upstream_name}256.png %{upstream_name}.png
cp -p doc/%{upstream_name}-gui.desktop %{upstream_name}-gui.desktop
rm -rf doc
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
%build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with _python3
%{__python2} setup.py build
%install
%{?el5:rm -rf $RPM_BUILD_ROOT}
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --prefix=%{_prefix} \
--optimize=1 --root $RPM_BUILD_ROOT
popd
# Rename Python 3 binaries
for file in `find $RPM_BUILD_ROOT/%{_bindir}/ -name "ase-*"`; do
mv -f ${file} $RPM_BUILD_ROOT/%{_bindir}/`basename $file`3
done
# remove ase-gui3 (not working)
rm -f $RPM_BUILD_ROOT/%{_bindir}/ase-gui3
# remove .mo files
find $RPM_BUILD_ROOT%{python3_sitelib}/%{upstream_name} -type f -name "*.mo" | xargs rm
%endif # with_python3
%{__python2} setup.py install --skip-build --prefix=%{_prefix} \
--optimize=1 --root $RPM_BUILD_ROOT
# doc would go under $RPM_BUILD_ROOT%%{_datadir}/%%{name}
# if only we get rid of povray dependency one could build doc with:
# cd $RPM_BUILD_ROOT%%{_datadir}/%%{name}/doc&& sphinx-build . _build
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install \
--dir $RPM_BUILD_ROOT%{_datadir}/applications \
%if (0%{?fedora} && 0%{?fedora} < 20) || (0%{?rhel} && 0%{?rhel} < 7)
--vendor "%{upstream_name}" \
%endif
%{upstream_name}-gui.desktop
mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
install -p -m 644 %{upstream_name}.png $RPM_BUILD_ROOT%{_datadir}/pixmaps
# we store translations in ase/gui/po/*/*/ag.mo
# but /usr/lib/rpm/find-lang.sh wants locale (Fedora) or share/locale (el6)
mkdir $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name}/gui/share
cp -rp $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name}/gui/po $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name}/gui/share/locale
%find_lang ag
rm -rf $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name}/gui/share
sed -i "s|share/locale|po|g" %{PKG_TOP}/ag.lang
# create list of all installed dirs/files(exclude *.mo) and concat with ag.lang
find $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name} -type d | xargs -I _file echo "%dir _file" > %{PKG_TOP}/d2.list
find $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name} -type f ! -name "*.mo" > %{PKG_TOP}/f2.list
cat %{PKG_TOP}/ag.lang %{PKG_TOP}/d2.list %{PKG_TOP}/f2.list > %{PKG_TOP}/files2.list
# trim the $RPM_BUILD_ROOT
sed -i "s|$RPM_BUILD_ROOT||g" %{PKG_TOP}/files2.list
%if 0%{?with_python3}
# create list of all installed dirs/files(exclude *.mo) for Python 3
find $RPM_BUILD_ROOT%{python3_sitelib}/%{upstream_name} -type d | xargs -I _file echo "%dir _file" > %{PKG_TOP}/d3.list
find $RPM_BUILD_ROOT%{python3_sitelib}/%{upstream_name} -type f ! -name "*.mo" > %{PKG_TOP}/f3.list
cat %{PKG_TOP}/d3.list %{PKG_TOP}/f3.list > %{PKG_TOP}/files3.list
# trim the $RPM_BUILD_ROOT
sed -i "s|$RPM_BUILD_ROOT||g" %{PKG_TOP}/files3.list
%endif # with_python3
%check
%if 0%{?with_python3}
pushd %{py3dir}
export PYTHONPATH=`pwd`/build/lib
export PATH=`pwd`/build/scripts-%{python3_version}:${PATH}
mkdir testase && cd testase
LC_ALL=C.UTF-8 %{__python3} -c "from ase.test import test; test(verbosity=2, display=False)"
cd -
popd
%endif # with_python3
export PYTHONPATH=`pwd`/build/lib
export PATH=`pwd`/build/scripts-%{python2_version}:${PATH}
mkdir testase && cd testase
LC_ALL=C.UTF-8 %{__python2} -c "from ase.test import test; test(verbosity=2, display=False)"
cd -
%clean
%{?el5:rm -rf $RPM_BUILD_ROOT}
%files -f files2.list
%defattr(-,root,root,-)
%doc COPYING* LICENSE README*
%{_bindir}/ase-*
%if 0%{?with_python3}
%exclude %{_bindir}/ase-*3
%endif # with_python3
%{?!el5:%{python2_sitelib}/*.egg-info}
%{_datadir}/applications/%{upstream_name}-gui.desktop
%{_datadir}/pixmaps/%{upstream_name}.png
%if 0%{?with_python3}
%files -n python3-ase -f files3.list
%defattr(-,root,root,-)
%doc COPYING* LICENSE README*
%{_bindir}/ase-*3
%{python3_sitelib}/*.egg-info
%endif # with_python3
%changelog
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.11.0-20
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Sat Jun 18 2016 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.11.0-19
- upstream moved to gitlab
* Wed Feb 17 2016 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.10.0-18
- upstream 3.10.1, no more upstream_svn
- LC_ALL=C.UTF-8 needed by the tests
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.9.1.4567-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.9.1.4567-16
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Wed Jul 22 2015 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.9.1.4567-15
- upstream 3.9.1.4567
- files-attr
* Fri May 29 2015 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.9.0.4465-14
- python3, build log files removed
- upstream 3.9.0.4465
* Fri Oct 31 2014 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.8.1.3440-13
- larger icon - https://bugzilla.redhat.com/show_bug.cgi?id=1157516
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.8.1.3440-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sat May 03 2014 Björn Esser <bjoern.esser@gmail.com> - 3.8.1.3440-11
- failsafe backport of Python2-macros for RHEL <= 6
* Fri Jan 17 2014 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.8.1.3440-10
- https://bugzilla.redhat.com/show_bug.cgi?id=1044199
- https://bugzilla.redhat.com/show_bug.cgi?id=1044200
* Tue Dec 10 2013 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.8.1.3440-9
- upstream patch for launching ase-gui without terminal (gtk-launch ase-gui)
- desktop file in svn
* Sat Nov 30 2013 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.8.1.3440-8
- fix Exec in ase-gui.desktop
- remove MANIFEST.in from %%doc
- PATH modified for tests to include scripts dir
* Fri Nov 22 2013 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.8.1.3440-7
- new upstream version, old patches removed
* Thu Sep 19 2013 Björn Esser <bjoern.esser@gmail.com> - 3.7.1.3184-6
- Devendorized!
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.7.1.3184-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Tue Jun 25 2013 Marcin Dulak <Marcin.Dulak@gmail.com> 3.7.1.3184-4
- fix bug #976886 c#9
* Sun Jun 23 2013 Marcin Dulak <Marcin.Dulak@gmail.com> 3.7.1.3184-3
- builds on el5
- remove doc
- %%{upstream_name}.png goes to %%{_datadir}/pixmaps
- fix bug #976886 c#4
* Sat Jun 22 2013 Marcin Dulak <Marcin.Dulak@gmail.com> 3.7.1.3184-2
- include desktop file
- partly fix bug#976886#c1 and #c2
* Fri Jun 21 2013 Marcin Dulak <Marcin.Dulak@gmail.com> 3.7.1.3184-1
- trimmed for Fedora/RHEL
* Mon May 6 2013 Marcin Dulak <Marcin.Dulak@fysik.dtu.dk> 3.6.1-2
- include docs
* Mon Jun 11 2012 Marcin Dulak <Marcin.Dulak@fysik.dtu.dk> 3.6.0-1
- restructured for build.opensuse.org and Fedora based on campos-ase3.spec
* Tue Apr 27 2010 Marcin Dulak <Marcin.Dulak@fysik.dtu.dk>
- common Requires for EL, Fedora, openSUSE
- perform testase.py when building
- removed dependecy in python-lxml
* Wed Jun 18 2008 Marcin Dulak <Marcin.Dulak@fysik.dtu.dk>
- FC 9: set -- ${variable} converts dashes of $1 into underlines so use $2
* Mon Jun 16 2008 Marcin Dulak <Marcin.Dulak@fysik.dtu.dk>
- initial version