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

Diff of /eclass/distutils.eclass

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

Revision 1.60 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.60 2009/09/05 16:45:35 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
27if [[ -z "${DISTUTILS_DISABLE_PYTHON_DEPENDENCY}" ]]; then
27DEPEND="virtual/python" 28 DEPEND="virtual/python"
28RDEPEND="${DEPEND}" 29 RDEPEND="${DEPEND}"
30fi
29python="python" 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.
30 36
31# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS 37# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS
32# @DESCRIPTION: 38# @DESCRIPTION:
33# Global options passed to setup.py. 39# Global options passed to setup.py.
34 40
56distutils_src_prepare() { 62distutils_src_prepare() {
57 if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then 63 if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then
58 die "${FUNCNAME}() can be used only in src_prepare() phase" 64 die "${FUNCNAME}() can be used only in src_prepare() phase"
59 fi 65 fi
60 66
61 # remove ez_setup stuff to prevent packages 67 # Delete ez_setup files to prevent packages from installing
62 # 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"
63 rm -rf ez_setup* 71 rm -fr ez_setup*
72 if [[ "${ez_setup_py_existence}" == "1" ]]; then
64 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
65} 79}
66 80
67# @FUNCTION: distutils_src_compile 81# @FUNCTION: distutils_src_compile
68# @DESCRIPTION: 82# @DESCRIPTION:
69# The distutils src_compile function, this function is exported 83# The distutils src_compile function, this function is exported
71 if [[ "${EBUILD_PHASE}" != "compile" ]]; then 85 if [[ "${EBUILD_PHASE}" != "compile" ]]; then
72 die "${FUNCNAME}() can be used only in src_compile() phase" 86 die "${FUNCNAME}() can be used only in src_compile() phase"
73 fi 87 fi
74 88
75 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
76 building() { 91 building() {
92 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
93 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
94 }
95 python_execute_function -s building "$@"
96 else
97 building() {
77 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" 98 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@"
78 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" 99 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@"
79 } 100 }
80 python_execute_function building "$@" 101 python_execute_function building "$@"
102 fi
81 else 103 else
82 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" 104 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
83 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed" 105 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
84 fi 106 fi
85} 107}
98 120
99 # Mark the package to be rebuilt after a python upgrade. 121 # Mark the package to be rebuilt after a python upgrade.
100 python_need_rebuild 122 python_need_rebuild
101 123
102 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
103 installation() { 126 installation() {
104 # need this for python-2.5 + setuptools in cases where 127 # need this for python-2.5 + setuptools in cases where
105 # a package uses distutils but does not install anything 128 # a package uses distutils but does not install anything
106 # in site-packages. (eg. dev-java/java-config-2.x) 129 # in site-packages. (eg. dev-java/java-config-2.x)
107 # - liquidx (14/08/2006) 130 # - liquidx (14/08/2006)
108 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())')"
109 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" 132 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}"
110 133
134 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
135 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
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
111 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" 147 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@"
112 "$(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 "$@"
113 } 149 }
114 python_execute_function installation "$@" 150 python_execute_function installation "$@"
151 fi
115 else 152 else
116 # need this for python-2.5 + setuptools in cases where 153 # need this for python-2.5 + setuptools in cases where
117 # a package uses distutils but does not install anything 154 # a package uses distutils but does not install anything
118 # in site-packages. (eg. dev-java/java-config-2.x) 155 # in site-packages. (eg. dev-java/java-config-2.x)
119 # - liquidx (14/08/2006) 156 # - liquidx (14/08/2006)
122 159
123 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" 160 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
124 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed" 161 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
125 fi 162 fi
126 163
127 DDOCS="CHANGELOG KNOWN_BUGS MAINTAINERS PKG-INFO CONTRIBUTORS TODO NEWS" 164 local default_docs
128 DDOCS="${DDOCS} Change* MANIFEST* README* AUTHORS" 165 default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS MANIFEST* NEWS PKG-INFO README* TODO"
129 166
130 local doc 167 local doc
131 for doc in ${DDOCS}; do 168 for doc in ${default_docs}; do
132 [[ -s "$doc" ]] && dodoc $doc 169 [[ -s "${doc}" ]] && dodoc "${doc}"
133 done 170 done
134 171
135 [[ -n "${DOCS}" ]] && dodoc ${DOCS} 172 if [[ -n "${DOCS}" ]]; then
173 dodoc ${DOCS} || die "dodoc failed"
174 fi
136} 175}
137 176
138# @FUNCTION: distutils_pkg_postrm 177# @FUNCTION: distutils_pkg_postrm
139# @DESCRIPTION: 178# @DESCRIPTION:
140# Generic pyc/pyo cleanup script. This function is exported. 179# Generic pyc/pyo cleanup script. This function is exported.

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

  ViewVC Help
Powered by ViewVC 1.1.20