File home-assistant-frontend.spec of Package home-assistant-frontend
#
# spec file for package home-assistant-frontend
#
# 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 http://bugs.opensuse.org/
#
%define build_tar_ball 0
%{?!python_module:%define python_module() python-%{**} python311-%{**}}
%define skip_python2 1
%define pythons python313
Name: home-assistant-frontend
Version: 20250903.3
Release: 0
Summary: Evil package
License: Apache License
%if %{build_tar_ball}
Source: frontend-%{version}.tar.xz
%else
Source: _service
%endif
Patch1: workaround-mkdir-failure.patch
BuildRequires: npm
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
#Requires: python-ua-parser
BuildArch: noarch
Provides: %{pythons}-home-assistant-frontend = %version
# keep python39 as last version of rename
Obsoletes: python39-home-assistant-frontend < 20191014.0
%description
Evil hacked package...
WARNING: it is impossible to review the content of that package.
But it is an upstream problem. And other HA systems are done similar :/
%prep
%if %{build_tar_ball}
%setup -q -n frontend-%{version}
%else
mv %_sourcedir/frontend-%version %_builddir/%name-%version
%setup -q -D -T 0
%endif
# workaround parallel creating and removing build/ dir
#%patch1 -p1
mkdir -p build/mdi
%build
# reduce memory needs
#sed -i 's,^#!/usr/bin.*,#!/usr/bin/node --max-old-space-size=4096,' node_modules/.bin/gulp || exit 1
# workaround a bug writing broken gulp file
#sed -i "s,^require.*,require('gulp-cli')();," node_modules/.bin/gulp || exit 1
# do not attempt to update translations via network
export SKIP_FETCH_NIGHTLY_TRANSLATIONS=1
#./script/build_frontend || exit 1
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes -s %{buildroot}/%{$python_sitelib}
%files
%{python_sitelib}/*