File uranium.spec of Package uranium

#
# spec file for package uranium
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           uranium
Version:        3.6.0
Release:        0
Summary:        Python framework for Desktop applications
License:        LGPL-3.0-only
Group:          Development/Languages/Python
Url:            http://github.com/Ultimaker/Uranium
Source0:        Uranium-%{version}.tar.xz
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  python3-devel >= 3.4.0
Recommends:     python3-numpy-stl
BuildArch:      noarch

%description
A Python framework for building Desktop applications.

%prep
%setup -q -n Uranium-%version

%build
CFLAGS="%{optflags}"
export CFLAGS
sed -i 's/PythonInterp 3.5.0/PythonInterp 3.4.0/' CMakeLists.txt
# Hack, remove LIB_SUFFIX for 64bit, which is correct as uranium is pure python (i.e. noarch)
%cmake -DLIB_SUFFIX=""
%make_jobs

%install
pushd build
%make_install
# uranium uses i18n instead of locale for the path to translation files,
# thus we cannot use %%find_lang
popd
find %{buildroot}%{_datadir}/%{name} -name %{name}.po* -delete
echo '%defattr(644,root,root,755)' > %{name}.lang
find %{buildroot}%{_datadir}/%{name} -name %{name}.mo | sed '
  s:'%{buildroot}'::; s:\(.*/i18n/\)\([^/]\+\)\(.*mo\):%lang(\2) \1\2\3:' \
  >> %{name}.lang
find %{buildroot}%{_datadir}/%{name} -type d -path \*i18n\* | sed '
  s:'%{buildroot}'::; s:\(.*/i18n.*\):%dir \1:' \
  >> %{name}.lang
# uranium uses a versioned dirname (e.g. cmake-3.9), rename to standard name
mv %{buildroot}/%{_datadir}/cmake* %{buildroot}/%{_datadir}/cmake
# create python cache or cura won't start
python3 -m compileall %buildroot%{python3_sitearch}/UM/

%files -f %{name}.lang
%license LICENSE
%doc docs README.md
%{_prefix}/lib/uranium
%{python3_sitelib}/UM
%{_datadir}/uranium
%{_datadir}/cmake/Modules/UraniumTranslationTools.cmake

%changelog
openSUSE Build Service is sponsored by