##
##  python-parse.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_pycparser      2.23
%define       V_configargparse 1.7.1
%define       V_click          8.2.1
%define       V_argh           0.31.3
%define       V_confu          1.9.0
%define       V_parse          1.20.2
%define       V_ply            3.11

#   package information
Name:         python-parse
Summary:      Python Modules for Parsing
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/pycparser/pycparser-%{V_pycparser}.tar.gz
Source1:      https://files.pythonhosted.org/packages/source/C/ConfigArgParse/configargparse-%{V_configargparse}.tar.gz
Source2:      https://files.pythonhosted.org/packages/source/c/click/click-%{V_click}.tar.gz
Source3:      https://files.pythonhosted.org/packages/source/a/argh/argh-%{V_argh}.tar.gz
Source4:      https://files.pythonhosted.org/packages/source/c/confu/confu-%{V_confu}.tar.gz
Source5:      https://files.pythonhosted.org/packages/source/p/parse/parse-%{V_parse}.tar.gz
Source6:      https://files.pythonhosted.org/packages/source/p/ply/ply-%{V_ply}.tar.gz

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

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

%track
    prog python-parse:pycparser = {
        version   = %{V_pycparser}
        url       = https://pypi.python.org/pypi/pycparser
        regex     = pycparser-(__VER__)\.tar\.gz
    }
    prog python-parse:ConfigArgParse = {
        version   = %{V_configargparse}
        url       = https://pypi.python.org/pypi/ConfigArgParse
        regex     = ConfigArgParse-(__VER__)\.tar\.gz
    }
    prog python-parse:click = {
        version   = %{V_click}
        url       = https://pypi.python.org/pypi/click
        regex     = click-(__VER__)\.tar\.gz
    }
    prog python-parse:argh = {
        version   = %{V_argh}
        url       = https://pypi.python.org/pypi/argh
        regex     = argh-(__VER__)\.tar\.gz
    }
    prog python-parse:confu = {
        version   = %{V_confu}
        url       = https://pypi.python.org/pypi/confu
        regex     = confu-(__VER__)\.tar\.gz
    }
    prog python-parse:parse = {
        version   = %{V_parse}
        url       = https://pypi.python.org/pypi/parse
        regex     = parse-(__VER__)\.tar\.gz
    }
    prog python-parse:ply = {
        version   = %{V_ply}
        url       = https://pypi.python.org/pypi/ply
        regex     = ply-(__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

%build

%install
    export PYTHONPATH=$RPM_BUILD_ROOT%{l_prefix}/lib/python%{V_python}/site-packages
    ( cd pycparser-%{V_pycparser}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd configargparse-%{V_configargparse}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd click-%{V_click}
      HOME=`pwd` %{l_prefix}/bin/python \
          -m pip install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix} \
          --ignore-installed \
          --no-deps \
          .
    ) || exit $?
    ( cd argh-%{V_argh}
      HOME=`pwd` %{l_prefix}/bin/python \
          -m pip install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix} \
          --ignore-installed \
          --no-deps \
          .
    ) || exit $?
    ( cd confu-%{V_confu}
      HOME=`pwd` %{l_prefix}/bin/python \
          -m pip install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix} \
          --ignore-installed \
          --no-deps \
          .
    ) || exit $?
    ( cd parse-%{V_parse}
      HOME=`pwd` %{l_prefix}/bin/python \
          -m pip install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix} \
          --ignore-installed \
          --no-deps \
          .
    ) || exit $?
    ( cd ply-%{V_ply}
      %{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

