##
##  python-www.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.13
%define       V_cheetah3      3.1.0
%define       V_genshi        0.7.7
%define       V_html5lib      1.1
%define       V_django        5.2.5
%define       V_meld3         0.6.5
%define       V_requests      2.32.5
%define       V_werkzeug      3.1.3
%define       V_tornado       4.5.1
%define       V_bottle        0.13.4

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

#   list of sources
Source0:      https://pypi.python.org/packages/source/C/Cheetah3/Cheetah3-%{V_cheetah3}.tar.gz
Source1:      https://files.pythonhosted.org/packages/source/G/Genshi/Genshi-%{V_genshi}.tar.gz
Source2:      https://github.com/html5lib/html5lib-python/archive/%{V_html5lib}.tar.gz
Source3:      https://github.com/django/django/archive/%{V_django}.tar.gz
Source4:      http://www.plope.com/software/meld3/meld3-%{V_meld3}.tar.gz
Source5:      https://files.pythonhosted.org/packages/source/r/requests/requests-%{V_requests}.tar.gz
Source6:      https://files.pythonhosted.org/packages/source/W/Werkzeug/werkzeug-%{V_werkzeug}.tar.gz
Source7:      https://pypi.python.org/packages/source/t/tornado/tornado-%{V_tornado}.tar.gz
Source8:      https://pypi.python.org/packages/source/b/bottle/bottle-%{V_bottle}.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 WWW.

%track
    prog python-www:cheetah3 = {
        version   = %{V_cheetah3}
        url       = https://pypi.org/project/Cheetah3/
        regex     = Cheetah-(__VER__)\.tar\.gz
    }
    prog python-www:genshi = {
        version   = %{V_genshi}
        url       = http://genshi.edgewall.org/wiki/Download
        regex     = Genshi-(__VER__)\.tar\.gz
    }
    prog python-www:html5lib = {
        version   = %{V_html5lib}
        url       = https://github.com/html5lib/html5lib-python/releases
        regex     = (__VER__)\.tar\.gz
    }
    prog python-www:django = {
        version   = %{V_django}
        url       = http://www.djangoproject.com/download/
        regex     = Django-(__VER__)\.tar\.gz
    }
    prog python-www:meld3 = {
        version   = %{V_meld3}
        url       = http://www.plope.com/software/meld3/
        regex     = meld3-(__VER__)\.tar\.gz
    }
    prog python-www:requests = {
        version   = %{V_requests}
        url       = https://pypi.python.org/pypi/requests
        regex     = requests-(__VER__)\.tar\.gz
    }
    prog python-www:werkzeug = {
        version   = %{V_werkzeug}
        url       = https://pypi.python.org/pypi/Werkzeug
        regex     = werkzeug-(__VER__)\.tar\.gz
    }
    prog python-www:tornado = {
        version   = %{V_tornado}
        url       = http://www.tornadoweb.org/en/stable/
        regex     = tornado-(__VER__)\.tar\.gz
    }
    prog python-www:bottle = {
        version   = %{V_bottle}
        url       = https://pypi.python.org/pypi/bottle
        regex     = bottle-(__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

%build

%install
    export PYTHONPATH=$RPM_BUILD_ROOT%{l_prefix}/lib/python%{V_python}/site-packages
    ( cd Cheetah3-%{V_cheetah3}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd Genshi-%{V_genshi}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd html5lib-python-%{V_html5lib}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd django-%{V_django}
      HOME=`pwd` %{l_prefix}/bin/python \
          -m pip install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix} \
          --ignore-installed \
          --no-deps \
          .
    ) || exit $?
    ( cd meld3-%{V_meld3}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd requests-%{V_requests}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd werkzeug-%{V_werkzeug}
      HOME=`pwd` %{l_prefix}/bin/python \
          -m pip install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix} \
          --ignore-installed \
          --no-deps \
          .
    ) || exit $?
    ( cd tornado-%{V_tornado}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd bottle-%{V_bottle}
      %{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

