Bump version to 0.36.9
[cygport.git] / cygclass / distutils.cygclass
blobc73f3530fcda11363c276879c566895e96533fed
1 ################################################################################
3 # distutils.cygclass - wrapper for various py*-distutils cygclasses
5 # Part of cygport - Cygwin packaging application
6 # Copyright (C) 2006-2020 Cygport authors
7 # Provided by the Cygwin project <https://cygwin.com/>
9 # cygport is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # cygport is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with cygport.  If not, see <https://www.gnu.org/licenses/>.
22 ################################################################################
24 #****ih* Cygclasses/distutils.cygclass
25 #  SYNOPSIS
26 #  inherit distutils
27 #  DESCRIPTION
28 #  Compatibility wrapper for python-distutils.cygclass. python3-distutils.cygclass.
29 #  or pypy-distutils.cygclass.
30 #  INHERITS
31 #  python-distutils.cygclass in most scenarios, OR python3-distutils.cygclass
32 #  if PN begins with "python3-*" or python3.cygclass has already been inherit()ed,
33 #  OR pypy-distutils.cygclass if PN begins with "pypy-*" or pypy.cygclass has
34 #  already been inherit()ed.
35 #  WARNING
36 #  distutils.cygclass can only be used with one of python, python3, or pypy.
37 #  If you wish to build a module for both python and python3 from the same
38 #  source simultaneously, use distutils-multi.cygclass.
39 #****
41 case ${PN} in
42         python-*)
43                 _pyinterp=python
44                 ;;
45         python3-*)
46                 inform "Using Python 3.x ..."
47                 _pyinterp=python3
48                 ;;
49         pypy-*)
50                 inform "Using PyPy ..."
51                 _pyinterp=pypy
52                 ;;
53         *)      if inherited python && ! inherited python3 && ! inherited pypy
54                 then
55                         _pyinterp=python
56                 elif inherited python3 && ! inherited python && ! inherited pypy
57                 then
58                         inform "Using Python 3.x ..."
59                         _pyinterp=python3
60                 elif inherited pypy && ! inherited python && ! inherited python3
61                 then
62                         inform "Using PyPy ..."
63                         _pyinterp=pypy
64                 elif inherited python && inherited python3
65                 then
66                         warning "Both python.cygclass and python3.cygclass have been inherited!"
67                         warning "Perhaps you want to use distutils-multi.cygclass instead?"
68                         error "distutils.cygclass: incompatible use of both python and python3"
69                 else
70                         _pyinterp=python
71                 fi
72 esac
74 inherit ${_pyinterp}-distutils
76 #****iC* distutils.cygclass/distutils_compile
77 #  DESCRIPTION
78 #  Wrapper for python_distutils_compile/python3_distutils_compile/pypy_distutils_compile
79 #****
80 distutils_compile() {
81         ${_pyinterp}_distutils_compile "$@"
84 #****iI* distutils.cygclass/distutils_install
85 #  DESCRIPTION
86 #  Wrapper for python_distutils_install/python3_distutils_install/pypy_distutils_install
87 #****
88 distutils_install() {
89         ${_pyinterp}_distutils_install "$@"
92 readonly -f distutils_compile distutils_install