/[gentoo-x86]/eclass/distutils.eclass
Gentoo

Diff of /eclass/distutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.59 Revision 1.62
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.59 2009/08/12 02:24:34 arfrever Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.62 2009/09/09 19:26:00 arfrever Exp $
4 4
5# @ECLASS: distutils.eclass 5# @ECLASS: distutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# <python@gentoo.org> 7# <python@gentoo.org>
8# 8#
22 *) 22 *)
23 EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm 23 EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm
24 ;; 24 ;;
25esac 25esac
26 26
27# @ECLASS-VARIABLE: PYTHON_SLOT_VERSION 27if [[ -z "${DISTUTILS_DISABLE_PYTHON_DEPENDENCY}" ]]; then
28# @DESCRIPTION:
29# This helps make it possible to add extensions to python slots.
30# Normally only a -py21- ebuild would set PYTHON_SLOT_VERSION.
31if [ "${PYTHON_SLOT_VERSION}" = "2.1" ] ; then
32 DEPEND="=dev-lang/python-2.1*"
33 python="python2.1"
34elif [ "${PYTHON_SLOT_VERSION}" = "2.3" ] ; then
35 DEPEND="=dev-lang/python-2.3*"
36 python="python2.3"
37else
38 DEPEND="virtual/python" 28 DEPEND="virtual/python"
39 python="python" 29 RDEPEND="${DEPEND}"
40fi 30fi
31python="python"
32
33# @ECLASS-VARIABLE: DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES
34# @DESCRIPTION:
35# Set this to use separate source directories for each enabled version of Python.
36
37# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS
38# @DESCRIPTION:
39# Global options passed to setup.py.
41 40
42# @ECLASS-VARIABLE: DOCS 41# @ECLASS-VARIABLE: DOCS
43# @DESCRIPTION: 42# @DESCRIPTION:
44# Additional DOCS 43# Additional DOCS
45 44
63distutils_src_prepare() { 62distutils_src_prepare() {
64 if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then 63 if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then
65 die "${FUNCNAME}() can be used only in src_prepare() phase" 64 die "${FUNCNAME}() can be used only in src_prepare() phase"
66 fi 65 fi
67 66
68 # remove ez_setup stuff to prevent packages 67 # Delete ez_setup files to prevent packages from installing
69 # from installing setuptools on their own 68 # setuptools on their own.
69 local ez_setup_py_existence
70 [[ -f ez_setup.py ]] && ez_setup_py_existence="1"
70 rm -rf ez_setup* 71 rm -fr ez_setup*
72 if [[ "${ez_setup_py_existence}" == "1" ]]; then
71 echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py 73 echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py
74 fi
75
76 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
77 python_copy_sources
78 fi
72} 79}
73 80
74# @FUNCTION: distutils_src_compile 81# @FUNCTION: distutils_src_compile
75# @DESCRIPTION: 82# @DESCRIPTION:
76# The distutils src_compile function, this function is exported 83# The distutils src_compile function, this function is exported
78 if [[ "${EBUILD_PHASE}" != "compile" ]]; then 85 if [[ "${EBUILD_PHASE}" != "compile" ]]; then
79 die "${FUNCNAME}() can be used only in src_compile() phase" 86 die "${FUNCNAME}() can be used only in src_compile() phase"
80 fi 87 fi
81 88
82 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 89 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
90 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
83 building() { 91 building() {
84 echo "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" "$@" 92 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
85 "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" "$@" 93 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
86 } 94 }
95 python_execute_function -s building "$@"
96 else
97 building() {
98 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@"
99 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@"
100 }
87 python_execute_function building "$@" 101 python_execute_function building "$@"
102 fi
88 else 103 else
89 echo ${python} setup.py build "$@" 104 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
90 ${python} setup.py build "$@" || die "Building failed" 105 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
91 fi 106 fi
92} 107}
93 108
94# @FUNCTION: distutils_src_install 109# @FUNCTION: distutils_src_install
95# @DESCRIPTION: 110# @DESCRIPTION:
105 120
106 # Mark the package to be rebuilt after a python upgrade. 121 # Mark the package to be rebuilt after a python upgrade.
107 python_need_rebuild 122 python_need_rebuild
108 123
109 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 124 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
125 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
110 installation() { 126 installation() {
111 # need this for python-2.5 + setuptools in cases where 127 # need this for python-2.5 + setuptools in cases where
112 # a package uses distutils but does not install anything 128 # a package uses distutils but does not install anything
113 # in site-packages. (eg. dev-java/java-config-2.x) 129 # in site-packages. (eg. dev-java/java-config-2.x)
114 # - liquidx (14/08/2006) 130 # - liquidx (14/08/2006)
115 pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" 131 pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
116 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" 132 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}"
117 133
118 echo "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" 134 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
119 "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" 135 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
120 } 136 }
137 python_execute_function -s installation "$@"
138 else
139 installation() {
140 # need this for python-2.5 + setuptools in cases where
141 # a package uses distutils but does not install anything
142 # in site-packages. (eg. dev-java/java-config-2.x)
143 # - liquidx (14/08/2006)
144 pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
145 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}"
146
147 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@"
148 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@"
149 }
121 python_execute_function installation "$@" 150 python_execute_function installation "$@"
151 fi
122 else 152 else
123 # need this for python-2.5 + setuptools in cases where 153 # need this for python-2.5 + setuptools in cases where
124 # a package uses distutils but does not install anything 154 # a package uses distutils but does not install anything
125 # in site-packages. (eg. dev-java/java-config-2.x) 155 # in site-packages. (eg. dev-java/java-config-2.x)
126 # - liquidx (14/08/2006) 156 # - liquidx (14/08/2006)
127 pylibdir="$(${python} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" 157 pylibdir="$(${python} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
128 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" 158 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}"
129 159
130 echo ${python} setup.py install --root="${D}" --no-compile "$@" 160 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
131 ${python} setup.py install --root="${D}" --no-compile "$@" || die "Installation failed" 161 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
132 fi 162 fi
133 163
134 DDOCS="CHANGELOG KNOWN_BUGS MAINTAINERS PKG-INFO CONTRIBUTORS TODO NEWS" 164 local default_docs
135 DDOCS="${DDOCS} Change* MANIFEST* README* AUTHORS" 165 default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS MANIFEST* NEWS PKG-INFO README* TODO"
136 166
137 local doc 167 local doc
138 for doc in ${DDOCS}; do 168 for doc in ${default_docs}; do
139 [[ -s "$doc" ]] && dodoc $doc 169 [[ -s "${doc}" ]] && dodoc "${doc}"
140 done 170 done
141 171
142 [[ -n "${DOCS}" ]] && dodoc ${DOCS} 172 if [[ -n "${DOCS}" ]]; then
173 dodoc ${DOCS} || die "dodoc failed"
174 fi
143} 175}
144 176
145# @FUNCTION: distutils_pkg_postrm 177# @FUNCTION: distutils_pkg_postrm
146# @DESCRIPTION: 178# @DESCRIPTION:
147# Generic pyc/pyo cleanup script. This function is exported. 179# Generic pyc/pyo cleanup script. This function is exported.

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.62

  ViewVC Help
Powered by ViewVC 1.1.20