##
##  python-util.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package versions
%define       V_python         3.14
%define       V_utils          1.0.2
%define       V_zope_component 7.0
%define       V_zope_interface 8.0.1
%define       V_zope_event     6.0
%define       V_zope_hookable  7.0
%define       V_attrs          25.4.0
%define       V_constantly     23.10.4
%define       V_automat        25.4.16
%define       V_monk           0.13.2
%define       V_pluginbase     1.0.1

#   package information
Name:         python-util
Summary:      Python Modules for Utility Functionalities
URL:          http://www.python.org/
Vendor:       Python Community
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        BASE
Group:        Language
License:      GPL
Version:      %{V_python}
Release:      20251012

#   list of sources
Source0:      https://files.pythonhosted.org/packages/source/u/utils/utils-%{V_utils}.tar.gz
Source1:      https://files.pythonhosted.org/packages/source/z/zope.component/zope_component-%{V_zope_component}.tar.gz
Source2:      https://files.pythonhosted.org/packages/source/z/zope.interface/zope_interface-%{V_zope_interface}.tar.gz
Source3:      https://files.pythonhosted.org/packages/source/z/zope.event/zope_event-%{V_zope_event}.tar.gz
Source4:      https://files.pythonhosted.org/packages/source/z/zope.hookable/zope_hookable-%{V_zope_hookable}.tar.gz
Source5:      https://files.pythonhosted.org/packages/source/a/attrs/attrs-%{V_attrs}.tar.gz
Source6:      https://files.pythonhosted.org/packages/source/c/constantly/constantly-%{V_constantly}.tar.gz
Source7:      https://files.pythonhosted.org/packages/source/A/Automat/automat-%{V_automat}.tar.gz
Source8:      https://files.pythonhosted.org/packages/source/m/monk/monk-%{V_monk}.tar.gz
Source9:      https://files.pythonhosted.org/packages/source/p/pluginbase/pluginbase-%{V_pluginbase}.tar.gz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, python >= %{V_python}
PreReq:       OpenPKG, openpkg >= 20160101, python >= %{V_python}

%description
    This is a set of Python extension modules for utility
    functionalities.

%track
    prog python-util:utils = {
        version   = %{V_utils}
        url       = https://pypi.python.org/pypi/utils
        regex     = utils-(__VER__)\.tar\.gz
    }
    prog python-util:zope_component = {
        version   = %{V_zope_component}
        url       = https://pypi.python.org/pypi/zope.component
        regex     = zope_component-(__VER__)\.tar\.gz
    }
    prog python-util:zope_interface = {
        version   = %{V_zope_interface}
        url       = https://pypi.python.org/pypi/zope.interface
        regex     = zope_interface-(__VER__)\.tar\.gz
    }
    prog python-util:zope_event = {
        version   = %{V_zope_event}
        url       = https://pypi.python.org/pypi/zope.event
        regex     = zope_event-(__VER__)\.tar\.gz
    }
    prog python-util:zope_hookable = {
        version   = %{V_zope_hookable}
        url       = https://pypi.python.org/pypi/zope.hookable
        regex     = zope_hookable-(__VER__)\.tar\.gz
    }
    prog python-util:attrs = {
        version   = %{V_attrs}
        url       = https://pypi.python.org/pypi/attrs
        regex     = attrs-(__VER__)\.tar\.gz
    }
    prog python-util:constantly = {
        version   = %{V_constantly}
        url       = https://pypi.python.org/pypi/constantly
        regex     = constantly-(__VER__)\.tar\.gz
    }
    prog python-util:automat = {
        version   = %{V_automat}
        url       = https://pypi.python.org/pypi/Automat
        regex     = automat-(__VER__)\.tar\.gz
    }
    prog python-util:monk = {
        version   = %{V_monk}
        url       = https://pypi.python.org/pypi/Automat
        regex     = monk-(__VER__)\.tar\.gz
    }
    prog python-util:pluginbase = {
        version   = %{V_pluginbase}
        url       = https://pypi.python.org/pypi/pluginbase
        regex     = pluginbase-(__VER__)\.tar\.gz
    }

%prep
    %setup -q -c
    %setup -q -T -D -a 1
    %setup -q -T -D -a 2
    %setup -q -T -D -a 3
    %setup -q -T -D -a 4
    %setup -q -T -D -a 5
    %setup -q -T -D -a 6
    %setup -q -T -D -a 7
    %setup -q -T -D -a 8
    %setup -q -T -D -a 9

%build

%install
    export PYTHONPATH=$RPM_BUILD_ROOT%{l_prefix}/lib/python%{V_python}/site-packages
    ( cd utils-%{V_utils}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd zope_component-%{V_zope_component}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd zope_interface-%{V_zope_interface}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd zope_event-%{V_zope_event}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd zope_hookable-%{V_zope_hookable}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd attrs-%{V_attrs}
      HOME=`pwd` %{l_prefix}/bin/python \
          -m pip install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix} \
          --ignore-installed \
          --no-deps \
          .
    ) || exit $?
    ( cd constantly-%{V_constantly}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd automat-%{V_automat}
      HOME=`pwd` %{l_prefix}/bin/python \
          -m pip install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix} \
          --ignore-installed \
          --no-deps \
          .
    ) || exit $?
    ( cd monk-%{V_monk}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd pluginbase-%{V_pluginbase}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

