File econnman.spec of Package econnman

# spec file for package econnman
# Copyright (c) 2018 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

Name:           econnman
Version:        1.1
Release:        0
Summary:        EFL user interface for connman
License:        GPL-3.0-only
Group:          Productivity/Networking/System
Patch0:         desktop.patch
BuildRequires:  automake
BuildRequires:  pkgconfig
BuildRequires:  python3
BuildRequires:  pkgconfig(edje) >= 1.8.0
# SECTION Check list of dependencies
BuildRequires:  adwaita-icon-theme
BuildRequires:  connman
BuildRequires:  python3-efl
Requires:       connman
Requires:       python3
Requires:       python3-efl
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  update-desktop-files

EFL user interface for connman (Connection Manager).

%setup -q
%patch0 -p1

# Default python executable
for _file in $(grep -rl '^\#\!'); do
  find -name ${_file##*/} -type f -exec sed -i '/^\#\!/s/python/python3/' {} +

[ ! -e configure ] && NOCONFIGURE=1 ./
export PYTHON=%{_bindir}/python3
make %{?_smp_mflags}


# Fix: Icon file not found
for _file in $(find %{buildroot} -name \*.desktop); do
    _icon=$(sed -ne '/^Icon/s/[^=]*=//p' -ne '/^Icon/s/\..*//p' $_file)
    if ! find %{buildroot} -name "${_icon##*/}.??g" | grep -q .; then
        for _icon in $(find %{_datadir}/icons -name network-wired.png | sort -r | head -n1); do
          install -Dm0644 "$_icon" "%{buildroot}%{_datadir}/pixmaps/${_icon##*/}"
          sed -i '/^Icon/s/[^=]*$/network-wired/' $_file
        "$_icon file exists" 2> /dev/null

%if 0%{?suse_version}
%suse_update_desktop_file -r %{name} Enlightenment Network Settings
%suse_update_desktop_file -u -r %{name} Enlightenment Network Settings

%license COPYING