##
##  python-sys.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_psutil            7.1.0
%define       V_setproctitle      1.3.7
%define       V_cffi              2.0.0
%define       V_funcsigs          1.0.2
%define       V_six               1.17.0
%define       V_shutilwhich       1.1.0
%define       V_watchdog          6.0.0
%define       V_pybind11          3.0.1
%define       V_typing_extensions 4.4.0

#   package information
Name:         python-sys
Summary:      Python Modules for System 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:      20251008

#   list of sources
Source0:      https://files.pythonhosted.org/packages/source/p/psutil/psutil-%{V_psutil}.tar.gz
Source1:      https://files.pythonhosted.org/packages/source/s/setproctitle/setproctitle-%{V_setproctitle}.tar.gz
Source2:      https://files.pythonhosted.org/packages/source/c/cffi/cffi-%{V_cffi}.tar.gz
Source3:      https://files.pythonhosted.org/packages/source/f/funcsigs/funcsigs-%{V_funcsigs}.tar.gz
Source4:      https://files.pythonhosted.org/packages/source/s/six/six-%{V_six}.tar.gz
Source5:      https://files.pythonhosted.org/packages/source/s/shutilwhich/shutilwhich-%{V_shutilwhich}.tar.gz
Source6:      https://files.pythonhosted.org/packages/source/w/watchdog/watchdog-%{V_watchdog}.tar.gz
Source7:      https://files.pythonhosted.org/packages/source/p/pybind11/pybind11-%{V_pybind11}.tar.gz
Source8:      https://files.pythonhosted.org/packages/source/t/typing-extensions/typing_extensions-%{V_typing_extensions}.tar.gz

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

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

%track
    prog python-sys:psutil = {
        version   = %{V_psutil}
        url       = https://pypi.python.org/pypi/psutil
        regex     = psutil-(__VER__)\.tar\.gz
    }
    prog python-sys:setproctitle = {
        version   = %{V_setproctitle}
        url       = https://pypi.python.org/pypi/setproctitle
        regex     = setproctitle-(__VER__)\.tar\.gz
    }
    prog python-sys:cffi = {
        version   = %{V_cffi}
        url       = https://pypi.python.org/pypi/cffi
        regex     = cffi-(__VER__)\.tar\.gz
    }
    prog python-sys:funcsigs = {
        version   = %{V_funcsigs}
        url       = https://pypi.python.org/pypi/funcsigs
        regex     = funcsigs-(__VER__)\.tar\.gz
    }
    prog python-sys:six = {
        version   = %{V_six}
        url       = https://pypi.python.org/pypi/six
        regex     = six-(__VER__)\.tar\.gz
    }
    prog python-sys:shutilwhich = {
        version   = %{V_shutilwhich}
        url       = https://pypi.python.org/pypi/shutilwhich
        regex     = shutilwhich-(__VER__)\.tar\.gz
    }
    prog python-sys:watchdog = {
        version   = %{V_watchdog}
        url       = https://pypi.python.org/pypi/watchdog
        regex     = watchdog-(__VER__)\.tar\.gz
    }
    prog python-sys:pybind11 = {
        version   = %{V_pybind11}
        url       = https://pypi.python.org/pypi/pybind11
        regex     = pybind11-(__VER__)\.tar\.gz
    }
    prog python-sys:typing-extensions = {
        version   = %{V_typing_extensions}
        url       = https://pypi.python.org/pypi/typing-extensions
        regex     = typing-extensions-(__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
    chmod -R a+rx shutilwhich-%{V_shutilwhich}

%build

%install
    export PYTHONPATH=$RPM_BUILD_ROOT%{l_prefix}/lib/python%{V_python}/site-packages
    ( cd psutil-%{V_psutil}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd setproctitle-%{V_setproctitle}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd cffi-%{V_cffi}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd funcsigs-%{V_funcsigs}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd six-%{V_six}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd shutilwhich-%{V_shutilwhich}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd watchdog-%{V_watchdog}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd pybind11-%{V_pybind11}
      HOME=`pwd` %{l_prefix}/bin/python \
          -m pip install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix} \
          --ignore-installed \
          --no-deps \
          .
    ) || exit $?
    ( cd typing_extensions-%{V_typing_extensions}
      HOME=`pwd` %{l_prefix}/bin/python \
          -m pip install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix} \
          --ignore-installed \
          --no-deps \
          .
    ) || exit $?
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

