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

Diff of /eclass/python-distutils-ng.eclass

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

Revision 1.24 Revision 1.25
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 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/Attic/python-distutils-ng.eclass,v 1.24 2012/05/24 18:18:11 floppym Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/python-distutils-ng.eclass,v 1.25 2012/05/26 09:46:23 mgorny Exp $
4 4
5# @ECLASS: python-distutils-ng 5# @ECLASS: python-distutils-ng
6# @MAINTAINER: 6# @MAINTAINER:
7# Python herd <python@gentoo.org> 7# Python herd <python@gentoo.org>
8# @AUTHOR: 8# @AUTHOR:
190 esac 190 esac
191 191
192 unset PYTHONDONTWRITEBYTECODE 192 unset PYTHONDONTWRITEBYTECODE
193 [[ -n "${PYTHON_DISABLE_COMPILATION}" ]] && compile_flags="--no-compile" 193 [[ -n "${PYTHON_DISABLE_COMPILATION}" ]] && compile_flags="--no-compile"
194 "${PYTHON}" setup.py install ${compile_flags} --root="${D}" || die 194 "${PYTHON}" setup.py install ${compile_flags} --root="${D}" || die
195}
196
197# @FUNCTION: python-distutils-ng_rewrite_hashbang
198# @USAGE: script_file_name implementation
199# @DESCRIPTION:
200# Rewrite #! line in named script, dies if #! line is not for Python or missing.
201python-distutils-ng_rewrite_hashbang() {
202 [[ -n "${1}" ]] || die "Missing file name"
203 [[ -n "${2}" ]] || die "Missing implementation"
204 local file_name="${1}"
205 local binary="$(_python-distutils-ng_get_binary_for_implementation "${2}")"
206 [[ $(head -n 1 "${file_name}") == '#!'*(python|jython|pypy-c)* ]] || \
207 die "Missing or invalid #! line in ${file_name}"
208 sed -i -e "1c#!${binary}" "${file_name}" || die
195} 209}
196 210
197# @FUNCTION: python-distutils-ng_redoscript 211# @FUNCTION: python-distutils-ng_redoscript
198# @USAGE: script_file_path [destination_directory] 212# @USAGE: script_file_path [destination_directory]
199# @DESCRIPTION: 213# @DESCRIPTION:
272 insinto "${destination_directory}" 286 insinto "${destination_directory}"
273 if [[ "${enabled_impls}" = "1" ]]; then 287 if [[ "${enabled_impls}" = "1" ]]; then
274 einfo "Installing ${source_file} for single implementation (${default_impl}) in ${destination_directory}" 288 einfo "Installing ${source_file} for single implementation (${default_impl}) in ${destination_directory}"
275 newins "${source_file}" "${destination_file}" 289 newins "${source_file}" "${destination_file}"
276 fperms 755 "${destination_directory}/${destination_file}" 290 fperms 755 "${destination_directory}/${destination_file}"
277 sed -i \ 291 python-distutils-ng_rewrite_hashbang "${D}${destination_directory}/${destination_file}" "${default_impl}"
278 -e "1i#!$(_python-distutils-ng_get_binary_for_implementation "${impl}")" \
279 "${D}${destination_directory}/${destination_file}" || die
280 else 292 else
281 einfo "Installing ${source_file} for multiple implementations (default: ${default_impl}) in ${destination_directory}" 293 einfo "Installing ${source_file} for multiple implementations (default: ${default_impl}) in ${destination_directory}"
282 for impl in ${PYTHON_COMPAT}; do 294 for impl in ${PYTHON_COMPAT}; do
283 use "python_targets_${impl}" ${PYTHON_COMPAT} || continue 295 use "python_targets_${impl}" ${PYTHON_COMPAT} || continue
284 296
285 newins "${source_file}" "${destination_file}-${impl}" 297 newins "${source_file}" "${destination_file}-${impl}"
286 fperms 755 "${destination_directory}/${destination_file}-${impl}" 298 fperms 755 "${destination_directory}/${destination_file}-${impl}"
287 sed -i \ 299 python-distutils-ng_rewrite_hashbang "${D}${destination_directory}/${destination_file}-${impl}" "${impl}"
288 -e "1i#!$(_python-distutils-ng_get_binary_for_implementation "${impl}")" \
289 "${D}${destination_directory}/${destination_file}-${impl}" || die
290 done 300 done
291 301
292 dosym "${destination_file}-${default_impl}" "${destination_directory}/${destination_file}" 302 dosym "${destination_file}-${default_impl}" "${destination_directory}/${destination_file}"
293 fi 303 fi
294} 304}

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.20