/[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.61
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.61 2009/09/07 02:34:10 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#
26 26
27DEPEND="virtual/python" 27DEPEND="virtual/python"
28RDEPEND="${DEPEND}" 28RDEPEND="${DEPEND}"
29python="python" 29python="python"
30 30
31# @ECLASS-VARIABLE: DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES
32# @DESCRIPTION:
33# Set this to use separate source directories for each enabled version of Python.
34
31# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS 35# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS
32# @DESCRIPTION: 36# @DESCRIPTION:
33# Global options passed to setup.py. 37# Global options passed to setup.py.
34 38
35# @ECLASS-VARIABLE: DOCS 39# @ECLASS-VARIABLE: DOCS
56distutils_src_prepare() { 60distutils_src_prepare() {
57 if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then 61 if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then
58 die "${FUNCNAME}() can be used only in src_prepare() phase" 62 die "${FUNCNAME}() can be used only in src_prepare() phase"
59 fi 63 fi
60 64
61 # remove ez_setup stuff to prevent packages 65 # Delete ez_setup files to prevent packages from installing
62 # from installing setuptools on their own 66 # setuptools on their own.
67 local ez_setup_py_existence
68 [[ -f ez_setup.py ]] && ez_setup_py_existence="1"
63 rm -rf ez_setup* 69 rm -fr ez_setup*
70 if [[ "${ez_setup_py_existence}" == "1" ]]; then
64 echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py 71 echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py
72 fi
73
74 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
75 python_copy_sources
76 fi
65} 77}
66 78
67# @FUNCTION: distutils_src_compile 79# @FUNCTION: distutils_src_compile
68# @DESCRIPTION: 80# @DESCRIPTION:
69# The distutils src_compile function, this function is exported 81# The distutils src_compile function, this function is exported
71 if [[ "${EBUILD_PHASE}" != "compile" ]]; then 83 if [[ "${EBUILD_PHASE}" != "compile" ]]; then
72 die "${FUNCNAME}() can be used only in src_compile() phase" 84 die "${FUNCNAME}() can be used only in src_compile() phase"
73 fi 85 fi
74 86
75 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 87 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
88 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
76 building() { 89 building() {
90 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
91 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
92 }
93 python_execute_function -s building "$@"
94 else
95 building() {
77 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" 96 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@"
78 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" 97 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@"
79 } 98 }
80 python_execute_function building "$@" 99 python_execute_function building "$@"
100 fi
81 else 101 else
82 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" 102 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
83 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed" 103 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
84 fi 104 fi
85} 105}
98 118
99 # Mark the package to be rebuilt after a python upgrade. 119 # Mark the package to be rebuilt after a python upgrade.
100 python_need_rebuild 120 python_need_rebuild
101 121
102 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 122 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
123 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
103 installation() { 124 installation() {
104 # need this for python-2.5 + setuptools in cases where 125 # need this for python-2.5 + setuptools in cases where
105 # a package uses distutils but does not install anything 126 # a package uses distutils but does not install anything
106 # in site-packages. (eg. dev-java/java-config-2.x) 127 # in site-packages. (eg. dev-java/java-config-2.x)
107 # - liquidx (14/08/2006) 128 # - liquidx (14/08/2006)
108 pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" 129 pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
109 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" 130 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}"
110 131
132 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
133 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
134 }
135 python_execute_function -s installation "$@"
136 else
137 installation() {
138 # need this for python-2.5 + setuptools in cases where
139 # a package uses distutils but does not install anything
140 # in site-packages. (eg. dev-java/java-config-2.x)
141 # - liquidx (14/08/2006)
142 pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
143 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}"
144
111 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" 145 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 "$@" 146 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@"
113 } 147 }
114 python_execute_function installation "$@" 148 python_execute_function installation "$@"
149 fi
115 else 150 else
116 # need this for python-2.5 + setuptools in cases where 151 # need this for python-2.5 + setuptools in cases where
117 # a package uses distutils but does not install anything 152 # a package uses distutils but does not install anything
118 # in site-packages. (eg. dev-java/java-config-2.x) 153 # in site-packages. (eg. dev-java/java-config-2.x)
119 # - liquidx (14/08/2006) 154 # - liquidx (14/08/2006)

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

  ViewVC Help
Powered by ViewVC 1.1.20