%define scl rh-python36
%{?scl:%scl_package %{name}}
%{!?scl:%global pkg_name %{name}}

%define name python-daemon
%define version 2.2.3
%define unmangled_version 2.2.3
%define unmangled_version 2.2.3
%define release 1

Summary: Library to implement a well-behaved Unix daemon process.
%{?scl:Requires: %{scl}-runtime}
%{?scl:BuildRequires: %{scl}-runtime}
Name: %{?scl_prefix}python-daemon
Version: %{version}
Release: %{release}
Source0: python-daemon-%{unmangled_version}.tar.gz
License: Apache-2
Group: Development/Libraries
BuildRoot: %{_tmppath}/python-daemon-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: Ben Finney <ben+python@benfinney.id.au>
Packager: Martin Juhl <m@rtinjuhl.dk>
Url: https://pagure.io/python-daemon/


%description
This library implements the well-behaved daemon specification of
:pep:`3143`, “Standard daemon process library”.

A well-behaved Unix daemon process is tricky to get right, but the
required steps are much the same for every daemon program. A
`DaemonContext` instance holds the behaviour and configured
process environment for the program; use the instance as a context
manager to enter a daemon state.

Simple example of usage::

    import daemon

    from spam import do_main_program

    with daemon.DaemonContext():
        do_main_program()

Customisation of the steps to become a daemon is available by
setting options on the `DaemonContext` instance; see the
documentation for that class for each option.


%prep
%{?scl:scl enable %{scl} - << \EOF}
set -ex
%setup -n python-daemon-%{unmangled_version} -n python-daemon-%{unmangled_version}
%{?scl:EOF}


%build
%{?scl:scl enable %{scl} - << \EOF}
set -ex
python3 setup.py build
%{?scl:EOF}


%install
%{?scl:scl enable %{scl} - << \EOF}
set -ex
python3 setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
%{?scl:EOF}


%clean
%{?scl:scl enable %{scl} - << \EOF}
set -ex
rm -rf $RPM_BUILD_ROOT
%{?scl:EOF}


%files -f INSTALLED_FILES
%defattr(-,root,root)