Marcin Dulak 4ca2ae6
# Warning:
Marcin Dulak 4ca2ae6
# Anyone editing this spec file please make sure the same spec file
Marcin Dulak 4ca2ae6
# works on other fedora and epel releases, which are supported by this software.
Marcin Dulak 4ca2ae6
# No quick Rawhide-only fixes will be allowed.
Marcin Dulak 4ca2ae6
Marcin Dulak ea2f3e9
%if 0%{?fedora}
Marcin Dulak ea2f3e9
%global		with_python3	1
Marcin Dulak ea2f3e9
%else
Marcin Dulak ea2f3e9
%global		with_python3	0
9e48221
%endif
Björn Esser 2ee6266
0d9467c
%global upstream_name ase
0d9467c
0d9467c
Name:			python-ase
Marcin Dulak 3883a1e
Version:		3.16.2
4215fc3
Release:		2%{?dist}
0d9467c
Summary:		Atomic Simulation Environment
0d9467c
0d9467c
0d9467c
# The entire source code is LGPLv2+ except:
0d9467c
# ase/io/fortranfile.py which is MIT
0d9467c
License:		LGPLv2+ and MIT
0d9467c
0d9467c
URL:			https://wiki.fysik.dtu.dk/ase/
Marcin Dulak 3883a1e
Source0:		https://gitlab.com/%{upstream_name}/%{upstream_name}/repository/archive.tar.gz?ref=%{version}#/%{upstream_name}-%{version}.tar.gz
cd13d59
0d9467c
BuildArch:		noarch
0d9467c
Marcin Dulak 3883a1e
%global PKG_TOP $RPM_BUILD_DIR/%{upstream_name}-%{version}
0d9467c
0d9467c
BuildRequires:		python2-devel
9e48221
%if 0%{?with_python3}
9e48221
BuildRequires:		python3-devel
9e48221
%endif # if with_python3
0d9467c
BuildRequires:		gettext
0d9467c
BuildRequires:		desktop-file-utils
0d9467c
c4f2c60
%if 0%{?fedora}
9f01162
BuildRequires:		python2-numpy
c4f2c60
%else
c4f2c60
BuildRequires:		numpy
c4f2c60
%endif
9e48221
%if 0%{?with_python3}
9e48221
BuildRequires:		python3-numpy
9e48221
%endif # if with_python3
0d9467c
72085f5
%global _description\
72085f5
The Atomic Simulation Environment (ASE) is the common part of the simulation\
72085f5
tools developed at CAMd. ASE provides Python modules for manipulating atoms,\
72085f5
analyzing simulations, visualization etc.
72085f5
72085f5
%description %_description
72085f5
72085f5
%package -n python2-ase
72085f5
Summary: %summary
Marcin Dulak ea2f3e9
Requires:		python%{?fedora:2}-matplotlib
72085f5
%{?python_provide:%python_provide python2-ase}
0d9467c
72085f5
%description -n python2-ase %_description
0d9467c
9e48221
%if 0%{?with_python3}
9e48221
%package -n python3-ase
9e48221
Summary:		Atomic Simulation Environment for Python 3
9e48221
Requires:		python3-matplotlib
9e48221
9e48221
%description -n python3-ase
9e48221
The Atomic Simulation Environment (ASE) is the common part of the simulation
9e48221
tools developed at CAMd. ASE provides Python 3 modules for manipulating atoms,
9e48221
analyzing simulations, etc.
9e48221
%endif # with_python3
0d9467c
0d9467c
%prep
Marcin Dulak 3883a1e
%setup -qn %{upstream_name}-%{version}
0d9467c
Marcin Dulak bfc1294
# copy required sources and remove doc directory
Marcin Dulak bfc1294
cp -p doc/static/%{upstream_name}256.png %{upstream_name}.png
Marcin Dulak bfc1294
cp -p doc/%{upstream_name}-gui.desktop %{upstream_name}-gui.desktop
0d9467c
rm -rf doc
0d9467c
9e48221
%if 0%{?with_python3}
9e48221
rm -rf %{py3dir}
9e48221
cp -a . %{py3dir}
9e48221
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
9e48221
%endif # with_python3
9e48221
9e48221
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
9e48221
0d9467c
0d9467c
%build
9e48221
%if 0%{?with_python3}
9e48221
pushd %{py3dir}
9e48221
%{__python3} setup.py build
9e48221
popd
9e48221
%endif # with _python3
9e48221
9e48221
%{__python2} setup.py build
0d9467c
0d9467c
0d9467c
%install
9e48221
9e48221
%if 0%{?with_python3}
9e48221
pushd %{py3dir}
9e48221
%{__python3} setup.py install --skip-build --prefix=%{_prefix} \
9e48221
	   --optimize=1 --root $RPM_BUILD_ROOT
9e48221
popd
Marcin Dulak 7d635d7
# Rename Python 3 scripts
Marcin Dulak ea2f3e9
pushd $RPM_BUILD_ROOT/%{_bindir}
Marcin Dulak ea2f3e9
for file in `find . -name "ase*"`; do
Marcin Dulak ea2f3e9
  mv -fv ${file} `basename $file`3
9e48221
done
Marcin Dulak ea2f3e9
popd
9e48221
# remove ase-gui3 (not working)
9e48221
rm -f $RPM_BUILD_ROOT/%{_bindir}/ase-gui3
9e48221
# remove .mo files
9e48221
find $RPM_BUILD_ROOT%{python3_sitelib}/%{upstream_name} -type f -name "*.mo" | xargs rm
9e48221
%endif # with_python3
9e48221
9e48221
Björn Esser 2ee6266
%{__python2} setup.py install --skip-build --prefix=%{_prefix} \
Marcin Dulak ea2f3e9
           --optimize=1 --root $RPM_BUILD_ROOT
Marcin Dulak ea2f3e9
# Rename Python 2 scripts
Marcin Dulak ea2f3e9
pushd $RPM_BUILD_ROOT/%{_bindir}
Marcin Dulak ea2f3e9
for file in `find . -name "ase*" | grep -v 3`; do
Marcin Dulak ea2f3e9
  mv -fv ${file} `basename $file`2
Marcin Dulak ea2f3e9
done
Marcin Dulak ea2f3e9
popd
Marcin Dulak ea2f3e9
# Link Python 2 scripts
Marcin Dulak ea2f3e9
pushd $RPM_BUILD_ROOT/%{_bindir}
Marcin Dulak ea2f3e9
for file in `find . -name "ase*2"`; do
Marcin Dulak ea2f3e9
  ln -sv ${file} `echo $file | rev | cut -c 2- | rev`
Marcin Dulak ea2f3e9
done
Marcin Dulak ea2f3e9
popd
0d9467c
0d9467c
# doc would go under $RPM_BUILD_ROOT%%{_datadir}/%%{name}
0d9467c
# if only we get rid of povray dependency one could build doc with:
dad48a3
# cd $RPM_BUILD_ROOT%%{_datadir}/%%{name}/doc&& sphinx-build . _build
0d9467c
0d9467c
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
0d9467c
desktop-file-install \
0d9467c
--dir $RPM_BUILD_ROOT%{_datadir}/applications \
Björn Esser 76f5a0d
%if (0%{?fedora} && 0%{?fedora} < 20) || (0%{?rhel} && 0%{?rhel} < 7)
Björn Esser 76f5a0d
--vendor "%{upstream_name}" \
Björn Esser 76f5a0d
%endif
Marcin Dulak bfc1294
%{upstream_name}-gui.desktop
0d9467c
0d9467c
mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
45adf77
install -p -m 644 %{upstream_name}.png $RPM_BUILD_ROOT%{_datadir}/pixmaps
0d9467c
0d9467c
# we store translations in ase/gui/po/*/*/ag.mo
0d9467c
# but /usr/lib/rpm/find-lang.sh wants locale (Fedora) or share/locale (el6)
Björn Esser 2ee6266
mkdir $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name}/gui/share
Björn Esser 2ee6266
cp -rp $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name}/gui/po $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name}/gui/share/locale
0d9467c
%find_lang ag
Björn Esser 2ee6266
rm -rf $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name}/gui/share
0d9467c
sed -i "s|share/locale|po|g" %{PKG_TOP}/ag.lang
0d9467c
0d9467c
# create list of all installed dirs/files(exclude *.mo) and concat with ag.lang
9e48221
find $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name} -type d | xargs -I _file echo "%dir _file" > %{PKG_TOP}/d2.list
Marcin Dulak bfc1294
find $RPM_BUILD_ROOT%{python2_sitelib}/%{upstream_name} -type f ! -name "*.mo" > %{PKG_TOP}/f2.list
9e48221
cat %{PKG_TOP}/ag.lang %{PKG_TOP}/d2.list %{PKG_TOP}/f2.list > %{PKG_TOP}/files2.list
9e48221
# trim the $RPM_BUILD_ROOT
9e48221
sed -i "s|$RPM_BUILD_ROOT||g" %{PKG_TOP}/files2.list
9e48221
9e48221
9e48221
%if 0%{?with_python3}
9e48221
# create list of all installed dirs/files(exclude *.mo) for Python 3
9e48221
find $RPM_BUILD_ROOT%{python3_sitelib}/%{upstream_name} -type d | xargs -I _file echo "%dir _file" > %{PKG_TOP}/d3.list
9e48221
find $RPM_BUILD_ROOT%{python3_sitelib}/%{upstream_name} -type f ! -name "*.mo"  > %{PKG_TOP}/f3.list
9e48221
cat %{PKG_TOP}/d3.list %{PKG_TOP}/f3.list > %{PKG_TOP}/files3.list
0d9467c
# trim the $RPM_BUILD_ROOT
9e48221
sed -i "s|$RPM_BUILD_ROOT||g" %{PKG_TOP}/files3.list
9e48221
%endif # with_python3
0d9467c
0d9467c
0d9467c
%check
9e48221
%if 0%{?with_python3}
9e48221
pushd %{py3dir}
9e48221
export PYTHONPATH=`pwd`/build/lib
Marcin Dulak ea2f3e9
export PATH=`pwd`/bin:${PATH}  # the tests assume Python 3 scripts are named the same as Python 2 scripts
9e48221
mkdir testase && cd testase
Marcin Dulak ea2f3e9
LC_ALL=C.UTF-8 %{__python3} -m ase test --verbose
9e48221
cd -
9e48221
popd
9e48221
%endif # with_python3
9e48221
0d9467c
export PYTHONPATH=`pwd`/build/lib
Marcin Dulak ea2f3e9
export PATH=`pwd`/bin:${PATH}
9e48221
mkdir testase && cd testase
Marcin Dulak ea2f3e9
LC_ALL=C.UTF-8 %{__python2} -m ase test --verbose
0d9467c
cd -
0d9467c
0d9467c
72085f5
%files -n python2-ase -f files2.list
975db4e
%defattr(-,root,root,-)
Marcin Dulak bfc1294
%doc COPYING* LICENSE README*
Marcin Dulak ea2f3e9
%{_bindir}/ase*
9e48221
%if 0%{?with_python3}
Marcin Dulak ea2f3e9
%exclude %{_bindir}/ase*3
9e48221
%endif # with_python3
0d9467c
%{_datadir}/applications/%{upstream_name}-gui.desktop
0d9467c
%{_datadir}/pixmaps/%{upstream_name}.png
Marcin Dulak ea2f3e9
%{python2_sitelib}/*.egg-info
0d9467c
9e48221
%if 0%{?with_python3}
9e48221
%files -n python3-ase -f files3.list
975db4e
%defattr(-,root,root,-)
Marcin Dulak bfc1294
%doc COPYING* LICENSE README*
Marcin Dulak ea2f3e9
%{_bindir}/ase*3
9e48221
%{python3_sitelib}/*.egg-info
9e48221
%endif # with_python3
0d9467c
0d9467c
%changelog
4215fc3
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.16.2-2
4215fc3
- Rebuilt for Python 3.7
4215fc3
Marcin Dulak 3883a1e
* Fri Jun 08 2018 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.16.2-1
Marcin Dulak 3883a1e
- new upstream release
Marcin Dulak 3883a1e
- no more git commit in tar directory name
Marcin Dulak 3883a1e
Marcin Dulak ea2f3e9
* Sat Apr 07 2018 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.16.0-1
Marcin Dulak ea2f3e9
- new upstream release
Marcin Dulak ea2f3e9
- clean rhel5 leftovers
Marcin Dulak ea2f3e9
- drop rhel6 support: Python 2.7 is required
Marcin Dulak ea2f3e9
- drop rhel7 support: Numpy 1.9 is required
Marcin Dulak ea2f3e9
- link Python 2 scripts as defaults
Marcin Dulak ea2f3e9
9f01162
* Mon Mar 26 2018 Iryna Shcherbina <ishcherb@redhat.com> - 3.13.0-5
9f01162
- Update Python 2 dependency declarations to new packaging standards
9f01162
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
9f01162
fdd5c2b
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.13.0-4
fdd5c2b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
fdd5c2b
72085f5
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.13.0-3
72085f5
- Python 2 binary package renamed to python2-ase
72085f5
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
72085f5
677eb45
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.13.0-2
677eb45
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
677eb45
Marcin Dulak 16b51b4
* Mon Feb 13 2017 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.13.0-1
Marcin Dulak 16b51b4
- new, upstream
Marcin Dulak 16b51b4
9a07e5d
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.12.0-24
9a07e5d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
9a07e5d
754026d
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.12.0-23
754026d
- Rebuild for Python 3.6
754026d
Marcin Dulak f517389
* Tue Nov 08 2016 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.12.0-22
Marcin Dulak f517389
- new way of running tests
Marcin Dulak f517389
Marcin Dulak 9e4a352
* Sat Nov 05 2016 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.12.0-21
Marcin Dulak 9e4a352
- new upstream release
Marcin Dulak 9e4a352
Dominik 'Rathann' Mierzejewski 1a2efe0
* Mon Sep 26 2016 Dominik Mierzejewski <rpm@greysector.net> - 3.11.0-21
Dominik 'Rathann' Mierzejewski 1a2efe0
- rebuilt for matplotlib-2.0.0
Dominik 'Rathann' Mierzejewski 1a2efe0
dbe0c2c
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.11.0-20
dbe0c2c
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
dbe0c2c
Marcin Dulak bfc1294
* Sat Jun 18 2016 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.11.0-19
Marcin Dulak bfc1294
- upstream moved to gitlab
Marcin Dulak bfc1294
Marcin Dulak bfc1294
* Wed Feb 17 2016 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.10.0-18
Marcin Dulak bfc1294
- upstream 3.10.1, no more upstream_svn
Marcin Dulak bfc1294
- LC_ALL=C.UTF-8 needed by the tests
Marcin Dulak bfc1294
a4afee0
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.9.1.4567-17
a4afee0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
a4afee0
c0295af
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.9.1.4567-16
c0295af
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
c0295af
975db4e
* Wed Jul 22 2015 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.9.1.4567-15
975db4e
- upstream 3.9.1.4567
975db4e
- files-attr
31fabdb
9e48221
* Fri May 29 2015 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.9.0.4465-14
9e48221
- python3, build log files removed
9e48221
- upstream 3.9.0.4465
9e48221
baf9ad5
* Fri Oct 31 2014 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.8.1.3440-13
baf9ad5
- larger icon - https://bugzilla.redhat.com/show_bug.cgi?id=1157516
baf9ad5
933235e
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.8.1.3440-12
933235e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
933235e
Björn Esser 2ee6266
* Sat May 03 2014 Björn Esser <bjoern.esser@gmail.com> - 3.8.1.3440-11
Björn Esser 2ee6266
- failsafe backport of Python2-macros for RHEL <= 6
Björn Esser 2ee6266
45adf77
* Fri Jan 17 2014 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.8.1.3440-10
45adf77
- https://bugzilla.redhat.com/show_bug.cgi?id=1044199
45adf77
- https://bugzilla.redhat.com/show_bug.cgi?id=1044200
45adf77
cd13d59
* Tue Dec 10 2013 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.8.1.3440-9
cd13d59
- upstream patch for launching ase-gui without terminal (gtk-launch ase-gui)
cd13d59
- desktop file in svn
cd13d59
dad48a3
* Sat Nov 30 2013 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.8.1.3440-8
dad48a3
- fix Exec in ase-gui.desktop
dad48a3
- remove MANIFEST.in from %%doc 
dad48a3
- PATH modified for tests to include scripts dir
dad48a3
a70f791
* Fri Nov 22 2013 Marcin Dulak <Marcin.Dulak@gmail.com> - 3.8.1.3440-7
a70f791
- new upstream version, old patches removed
a70f791
Björn Esser 9f175bd
* Thu Sep 19 2013 Björn Esser <bjoern.esser@gmail.com> - 3.7.1.3184-6
Björn Esser 9f175bd
- Devendorized!
Björn Esser 9f175bd
978a251
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.7.1.3184-5
978a251
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
978a251
0d9467c
* Tue Jun 25 2013 Marcin Dulak <Marcin.Dulak@gmail.com> 3.7.1.3184-4
0d9467c
- fix bug #976886 c#9
0d9467c
0d9467c
* Sun Jun 23 2013 Marcin Dulak <Marcin.Dulak@gmail.com> 3.7.1.3184-3
0d9467c
- builds on el5
0d9467c
- remove doc
0d9467c
- %%{upstream_name}.png goes to %%{_datadir}/pixmaps
0d9467c
- fix bug #976886 c#4
0d9467c
0d9467c
* Sat Jun 22 2013 Marcin Dulak <Marcin.Dulak@gmail.com> 3.7.1.3184-2
0d9467c
- include desktop file
0d9467c
- partly fix bug#976886#c1 and #c2
0d9467c
0d9467c
* Fri Jun 21 2013 Marcin Dulak <Marcin.Dulak@gmail.com> 3.7.1.3184-1
0d9467c
- trimmed for Fedora/RHEL
0d9467c
0d9467c
* Mon May 6 2013 Marcin Dulak <Marcin.Dulak@fysik.dtu.dk> 3.6.1-2
0d9467c
- include docs
0d9467c
0d9467c
* Mon Jun 11 2012 Marcin Dulak <Marcin.Dulak@fysik.dtu.dk> 3.6.0-1
0d9467c
- restructured for build.opensuse.org and Fedora based on campos-ase3.spec
0d9467c
0d9467c
* Tue Apr 27 2010 Marcin Dulak <Marcin.Dulak@fysik.dtu.dk>
0d9467c
- common Requires for EL, Fedora, openSUSE
0d9467c
- perform testase.py when building
0d9467c
- removed dependecy in python-lxml
0d9467c
0d9467c
* Wed Jun 18 2008 Marcin Dulak <Marcin.Dulak@fysik.dtu.dk>
0d9467c
- FC 9: set -- ${variable} converts dashes of $1 into underlines so use $2
0d9467c
0d9467c
* Mon Jun 16 2008 Marcin Dulak <Marcin.Dulak@fysik.dtu.dk>
0d9467c
- initial version