1 ################################################################################
3 # distutils-multi.cygclass - for building modules for both Python 2.x and 3.x
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-multi.cygclass
26 # inherit distutils-multi
28 # This cygclass provides a shortcut for building a module for both Python2 and
29 # Python3 from one source package. While not required, this saves the time involved
30 # with maintaining separate builds for each, and also saves bandwidth by avoiding
31 # the duplicate source tarball.
33 # Sources built in this fashion should be divided into two binary packages, one
34 # for each Python version, as so:
35 # PKG_NAMES="python-foo python3-foo"
36 # python_foo_CONTENTS="usr/bin/ ${PYTHON_SITELIB#/} usr/share/doc/"
37 # python3_foo_CONTENTS=${PYTHON3_SITELIB#/}
39 # * Some modules include scripts which are installed into /usr/bin. With very
40 # few exceptions, these scripts are unversioned; this cygclass installs in such
41 # a way that they will use the Python2 interpreter, and therefore should be
42 # packaged with the 2.x module.
43 # * Not all Python module sources are compatible with 2.x and 3.x simultaneously.
44 # Those that are not may have a separate source tarball for each version, which
45 # should be treated as completely separate packages.
47 # python-distutils.cygclass, python3-distutils.cygclass.
50 inherit python-distutils python3-distutils
52 #****io* distutils-multi.cygclass/src_compile (distutils-multi)
54 # Creates separate build trees for each version of Python and runs the distutils
55 # build steps for each.
61 python_distutils_compile
66 python3_distutils_compile
69 #****io* distutils-multi.cygclass/src_install (distutils-multi)
71 # Runs the distutils install steps for each version of Python. The distro
72 # default version of Python (currently 2.x) is run last so that unversioned
73 # scripts use the default version.
77 python3_distutils_install
79 rm -f $(find ${D}/usr/bin/ ! -name "*${PYTHON3_VERSION}*")
82 python_distutils_install