File uranium.spec of Package uranium
#
# spec file for package uranium
#
# Copyright (c) 2022 SUSE LLC
#
# 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/
#
%define UM_1_minor 6
%{?primary_python:%define pythons %primary_python}
%{?sle15_python_module_pythons}
Name: uranium
%define sversion 4.13.1
Version: 4.13.1
Release: 0
Summary: Python framework for Desktop applications
License: LGPL-3.0-only
Group: Development/Languages/Python
URL: https://github.com/Ultimaker/Uranium
Source0: https://github.com/Ultimaker/Uranium/archive/%{sversion}.tar.gz#/%{name}-%{version}.tar.gz
# X-OPENSUSE-FIX fix cmake install directory.
Patch1: fix-cmake-install.patch
BuildRequires: cmake
#BuildRequires: gcc-c++
# for tests:
BuildRequires: %{python_module Arcus >= %{version}}
BuildRequires: %{python_module Twisted}
BuildRequires: %{python_module cryptography}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module qt5}
BuildRequires: %{python_module scipy}
BuildRequires: %{python_module shapely}
# END for tests
%if 0%{?suse_version} >= 1550
# Automatic provides are not generated in Leap 15.x
Requires: %{python_flavor}-arcus
Requires: %{python_flavor}-cryptography
Requires: %{python_flavor}-shapely
%else
Requires: %{python_flavor}-Arcus
Requires: %{python_flavor}-cryptography
Requires: %{python_flavor}-Shapely
%endif
Recommends: %{python_flavor}-numpy-stl
BuildArch: noarch
# No 32bit support in cura-engine anymore
ExcludeArch: %ix86 %arm
# Registered in UM/Qt/Bindings/Bindings.py
Provides: qt5qmlimport(UM.1) = %{UM_1_minor}
Provides: %{python_flavor}-%{name} = %{version}-%{release}
%if "%{python_flavor}" == "python3"
Conflicts: python310-%{name}
Conflicts: python311-%{name}
Conflicts: python312-%{name}
%else
Conflicts: python3-%{name}
%endif
%description
A Python framework for building Desktop applications.
%prep
%autosetup -p1 -n Uranium-%sversion
# Sanity check
UM_1_LARGEST_MINOR=$(\
sed -e '/qmlRegister\(Singleton\)\?Type/ { s/.*"UM",.*1, *\([0-9]\+\).*/\1/ p } ; d' \
UM/Qt/Bindings/Bindings.py | sort -g -u | tail -n 1 )
test "${UM_1_LARGEST_MINOR}" -eq "%{UM_1_minor}" || exit 1
%build
# Hack, remove LIB_SUFFIX for 64bit, which is correct as uranium is pure python (i.e. noarch)
%cmake -DLIB_SUFFIX="" \
-DPYTHON_EXECUTABLE=/usr/bin/python%{python_version} \
-DCMAKE_MODULES_INSTALL_DIR=%{_datadir}/cmake/Modules
%cmake_build
%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
%check
%python_expand $python -m pip freeze
# TestHttpRequestManager has threading issues, see https://github.com/Ultimaker/Uranium/issues/594
%pytest -v -k 'not TestHttpRequestManager.py'
%files -f %{name}.lang
%license LICENSE
%doc docs README.md
%{_prefix}/lib/uranium
%{python_sitelib}/UM
%{_datadir}/uranium
%{_datadir}/cmake/Modules/UraniumTranslationTools.cmake
%changelog