################################################################################
#
# python3-wheel.cygclass - for building Wheels for Python 3
#
# Part of cygport - Cygwin packaging application
# Copyright (C) 2006-2020 Cygport authors
# Provided by the Cygwin project <https://cygwin.com/>
#
# cygport is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cygport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cygport.  If not, see <https://www.gnu.org/licenses/>.
#
################################################################################

#****h* Cygclasses/python3-wheel.cygclass
#  DESCRIPTION
#  Wheels are the standard for installing Python libraries and programs.  The
#  build is defined by a PEP 518 conformant source tree, or by a top-level
#  setup.cfg or setup.py file in the source directory, which controls the
#  installation of files and the building of C Python extensions.  Many such
#  packages are hosted on the Python Package Index (PyPI).
#
#  This cygclass handles the building of wheel-based Python 3 packages for a
#  single python version, for use by packages which which are primarily programs
#  and not modules.
#
#  Python module packages which support multiple Python versions should use
#  the python-wheel.cygclass instead.
#
#  EXAMPLE
#    inherit python3-wheel
#    
#    NAME="git-review"
#    VERSION=1.25.0
#    RELEASE=1
#    CATEGORY="Devel"
#    SUMMARY="Git command for Gerrit submissions"
#    DESCRIPTION="git-review is a tool that helps submitting git branches to
#    Gerrit for review."
#    HOMEPAGE="https://opendev.org/opendev/git-review"
#    LICENSE="Apache-2.0"
#    SRC_URI="https://tarballs.opendev.org/openstack/git-review/${NAME}-${VERSION}.tar.gz"
#    
#    ARCH=noarch
#    
#    REQUIRES="git"
#  INHERITS
#  python3.cygclass, python-wheel.cygclass
#  REQUIRES
#  python3, python3-pip
#****
inherit python3

#****v* python3-wheel.cygclass/PYTHON_WHEEL_VERSIONS
#  DEFINITION
PYTHON_WHEEL_VERSIONS=${PYTHON3_VERSION}
#****
inherit python-wheel

#****C* python3-wheel.cygclass/python3_wheel_compile
#  SYNOPSIS
#  python3_wheel_compile [OPTIONS]
#  DESCRIPTION
#  Runs the setup.py 'bdist_wheel' command, to which any arguments are passed.
#****
python3_wheel_compile() { python_wheel_compile "${@}" ; }

#****I* python3-wheel.cygclass/python3_wheel_install
#  SYNOPSIS
#  python3_wheel_install [OPTIONS]
#  DESCRIPTION
#  Installs the previously built wheel into $D with 'pip3 install'.
#****
python3_wheel_install() { python_wheel_install ; }

#****o* python3-wheel.cygclass/src_compile (python3-wheel)
#  DEFINITION
src_compile() {
	lndirs
	cd ${B}
	python3_wheel_compile
}
#****

#****o* python3-wheel.cygclass/src_install (python3-wheel)
#  DEFINITION
src_install() {
	cd ${B}
	python3_wheel_install
}
#****

readonly -f python3_wheel_compile python3_wheel_install
