# Warning: # Anyone editing this spec file please make sure the same spec file # works on other fedora and epel releases, which are supported by this software. # No quick Rawhide-only fixes will be allowed. %if 0%{?fedora} %global with_python3 1 %else %global with_python3 0 %endif %global upstream_name ase Name: python-ase Version: 3.16.2 Release: 2%{?dist} Summary: Atomic Simulation Environment # 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}.tar.gz BuildArch: noarch %global PKG_TOP $RPM_BUILD_DIR/%{upstream_name}-%{version} BuildRequires: python2-devel %if 0%{?with_python3} BuildRequires: python3-devel %endif # if with_python3 BuildRequires: gettext BuildRequires: desktop-file-utils %if 0%{?fedora} BuildRequires: python2-numpy %else BuildRequires: numpy %endif %if 0%{?with_python3} BuildRequires: python3-numpy %endif # if with_python3 %global _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. %description %_description %package -n python2-ase Summary: %summary Requires: python%{?fedora:2}-matplotlib %{?python_provide:%python_provide python2-ase} %description -n python2-ase %_description %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} # 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 %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --skip-build --prefix=%{_prefix} \ --optimize=1 --root $RPM_BUILD_ROOT popd # Rename Python 3 scripts pushd $RPM_BUILD_ROOT/%{_bindir} for file in `find . -name "ase*"`; do mv -fv ${file} `basename $file`3 done popd # 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 # Rename Python 2 scripts pushd $RPM_BUILD_ROOT/%{_bindir} for file in `find . -name "ase*" | grep -v 3`; do mv -fv ${file} `basename $file`2 done popd # Link Python 2 scripts pushd $RPM_BUILD_ROOT/%{_bindir} for file in `find . -name "ase*2"`; do ln -sv ${file} `echo $file | rev | cut -c 2- | rev` done popd # 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`/bin:${PATH} # the tests assume Python 3 scripts are named the same as Python 2 scripts mkdir testase && cd testase LC_ALL=C.UTF-8 %{__python3} -m ase test --verbose cd - popd %endif # with_python3 export PYTHONPATH=`pwd`/build/lib export PATH=`pwd`/bin:${PATH} mkdir testase && cd testase LC_ALL=C.UTF-8 %{__python2} -m ase test --verbose cd - %files -n python2-ase -f files2.list %defattr(-,root,root,-) %doc COPYING* LICENSE README* %{_bindir}/ase* %if 0%{?with_python3} %exclude %{_bindir}/ase*3 %endif # with_python3 %{_datadir}/applications/%{upstream_name}-gui.desktop %{_datadir}/pixmaps/%{upstream_name}.png %{python2_sitelib}/*.egg-info %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 Jun 19 2018 Miro Hrončok - 3.16.2-2 - Rebuilt for Python 3.7 * Fri Jun 08 2018 Marcin Dulak - 3.16.2-1 - new upstream release - no more git commit in tar directory name * Sat Apr 07 2018 Marcin Dulak - 3.16.0-1 - new upstream release - clean rhel5 leftovers - drop rhel6 support: Python 2.7 is required - drop rhel7 support: Numpy 1.9 is required - link Python 2 scripts as defaults * Mon Mar 26 2018 Iryna Shcherbina - 3.13.0-5 - Update Python 2 dependency declarations to new packaging standards (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) * Fri Feb 09 2018 Fedora Release Engineering - 3.13.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild * Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 3.13.0-3 - Python 2 binary package renamed to python2-ase See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 * Thu Jul 27 2017 Fedora Release Engineering - 3.13.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Mon Feb 13 2017 Marcin Dulak - 3.13.0-1 - new, upstream * Sat Feb 11 2017 Fedora Release Engineering - 3.12.0-24 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Mon Dec 19 2016 Miro Hrončok - 3.12.0-23 - Rebuild for Python 3.6 * Tue Nov 08 2016 Marcin Dulak - 3.12.0-22 - new way of running tests * Sat Nov 05 2016 Marcin Dulak - 3.12.0-21 - new upstream release * Mon Sep 26 2016 Dominik Mierzejewski - 3.11.0-21 - rebuilt for matplotlib-2.0.0 * Tue Jul 19 2016 Fedora Release Engineering - 3.11.0-20 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages * Sat Jun 18 2016 Marcin Dulak - 3.11.0-19 - upstream moved to gitlab * Wed Feb 17 2016 Marcin Dulak - 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 - 3.9.1.4567-17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Tue Nov 10 2015 Fedora Release Engineering - 3.9.1.4567-16 - Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 * Wed Jul 22 2015 Marcin Dulak - 3.9.1.4567-15 - upstream 3.9.1.4567 - files-attr * Fri May 29 2015 Marcin Dulak - 3.9.0.4465-14 - python3, build log files removed - upstream 3.9.0.4465 * Fri Oct 31 2014 Marcin Dulak - 3.8.1.3440-13 - larger icon - https://bugzilla.redhat.com/show_bug.cgi?id=1157516 * Sat Jun 07 2014 Fedora Release Engineering - 3.8.1.3440-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Sat May 03 2014 Björn Esser - 3.8.1.3440-11 - failsafe backport of Python2-macros for RHEL <= 6 * Fri Jan 17 2014 Marcin Dulak - 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 - 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 - 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 - 3.8.1.3440-7 - new upstream version, old patches removed * Thu Sep 19 2013 Björn Esser - 3.7.1.3184-6 - Devendorized! * Sun Aug 04 2013 Fedora Release Engineering - 3.7.1.3184-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild * Tue Jun 25 2013 Marcin Dulak 3.7.1.3184-4 - fix bug #976886 c#9 * Sun Jun 23 2013 Marcin Dulak 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 3.7.1.3184-2 - include desktop file - partly fix bug#976886#c1 and #c2 * Fri Jun 21 2013 Marcin Dulak 3.7.1.3184-1 - trimmed for Fedora/RHEL * Mon May 6 2013 Marcin Dulak 3.6.1-2 - include docs * Mon Jun 11 2012 Marcin Dulak 3.6.0-1 - restructured for build.opensuse.org and Fedora based on campos-ase3.spec * Tue Apr 27 2010 Marcin Dulak - common Requires for EL, Fedora, openSUSE - perform testase.py when building - removed dependecy in python-lxml * Wed Jun 18 2008 Marcin Dulak - FC 9: set -- ${variable} converts dashes of $1 into underlines so use $2 * Mon Jun 16 2008 Marcin Dulak - initial version