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

Diff of /eclass/python.eclass

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

Revision 1.62 Revision 1.63
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/python.eclass,v 1.62 2009/08/13 16:57:01 arfrever Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.63 2009/08/14 21:22:47 arfrever Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# python@gentoo.org 7# python@gentoo.org
8# 8#
111# @FUNCTION: validate_PYTHON_ABIS 111# @FUNCTION: validate_PYTHON_ABIS
112# @DESCRIPTION: 112# @DESCRIPTION:
113# Make sure PYTHON_ABIS variable has valid value. 113# Make sure PYTHON_ABIS variable has valid value.
114validate_PYTHON_ABIS() { 114validate_PYTHON_ABIS() {
115 # Ensure that /usr/bin/python and /usr/bin/python-config are valid. 115 # Ensure that /usr/bin/python and /usr/bin/python-config are valid.
116 if [[ "$(</usr/bin/python)" != *"Gentoo Python wrapper program"* ]]; then 116 if [[ "$(readlink /usr/bin/python)" != "python-wrapper" ]]; then
117 die "/usr/bin/python isn't valid program" 117 die "/usr/bin/python isn't valid symlink"
118 fi 118 fi
119 if [[ "$(</usr/bin/python-config)" != *"Gentoo python-config wrapper script"* ]]; then 119 if [[ "$(</usr/bin/python-config)" != *"Gentoo python-config wrapper script"* ]]; then
120 die "/usr/bin/python-config isn't valid script" 120 die "/usr/bin/python-config isn't valid script"
121 fi 121 fi
122 122
556 [[ -f "${myroot}/${f}" ]] && myfiles+=("${myroot}/${f}") 556 [[ -f "${myroot}/${f}" ]] && myfiles+=("${myroot}/${f}")
557 done 557 done
558 558
559 if ((${#myfiles[@]})); then 559 if ((${#myfiles[@]})); then
560 python${PYVER} ${myroot}/usr/$(get_libdir)/python${PYVER}/py_compile.py "${myfiles[@]}" 560 python${PYVER} ${myroot}/usr/$(get_libdir)/python${PYVER}/py_compile.py "${myfiles[@]}"
561 python${PYVER} -O ${myroot}/usr/$(get_libdir)/python${PYVER}/py_compile.py "${myfiles[@]}" 2> /dev/null 561 python${PYVER} -O ${myroot}/usr/$(get_libdir)/python${PYVER}/py_compile.py "${myfiles[@]}" &> /dev/null
562 else 562 else
563 ewarn "No files to compile!" 563 ewarn "No files to compile!"
564 fi 564 fi
565} 565}
566 566
644 if ((${#site_packages_dirs[@]})); then 644 if ((${#site_packages_dirs[@]})); then
645 for dir in "${site_packages_dirs[@]}"; do 645 for dir in "${site_packages_dirs[@]}"; do
646 site_packages_absolute_dirs+=("${root}$(python_get_sitedir)/${dir}") 646 site_packages_absolute_dirs+=("${root}$(python_get_sitedir)/${dir}")
647 done 647 done
648 "$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" || return_code="1" 648 "$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" || return_code="1"
649 "$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" 2> /dev/null || return_code="1" 649 "$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" &> /dev/null || return_code="1"
650 fi 650 fi
651 if ((${#site_packages_files[@]})); then 651 if ((${#site_packages_files[@]})); then
652 for file in "${site_packages_files[@]}"; do 652 for file in "${site_packages_files[@]}"; do
653 site_packages_absolute_files+=("${root}$(python_get_sitedir)/${file}") 653 site_packages_absolute_files+=("${root}$(python_get_sitedir)/${file}")
654 done 654 done
655 "$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" || return_code="1" 655 "$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" || return_code="1"
656 "$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" 2> /dev/null || return_code="1" 656 "$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" &> /dev/null || return_code="1"
657 fi 657 fi
658 eend "${return_code}" 658 eend "${return_code}"
659 fi 659 fi
660 unset site_packages_absolute_dirs site_packages_absolute_files 660 unset site_packages_absolute_dirs site_packages_absolute_files
661 done 661 done
666 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then 666 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then
667 return_code="0" 667 return_code="0"
668 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for Python ${PYVER}..." 668 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for Python ${PYVER}..."
669 if ((${#other_dirs[@]})); then 669 if ((${#other_dirs[@]})); then
670 python${PYVER} "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" || return_code="1" 670 python${PYVER} "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" || return_code="1"
671 python${PYVER} -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" 2> /dev/null || return_code="1" 671 python${PYVER} -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1"
672 fi 672 fi
673 if ((${#other_files[@]})); then 673 if ((${#other_files[@]})); then
674 python${PYVER} "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" || return_code="1" 674 python${PYVER} "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" || return_code="1"
675 python${PYVER} -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" 2> /dev/null || return_code="1" 675 python${PYVER} -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1"
676 fi 676 fi
677 eend "${return_code}" 677 eend "${return_code}"
678 fi 678 fi
679 else 679 else
680 local myroot mydirs=() myfiles=() myopts=() 680 local myroot mydirs=() myfiles=() myopts=() return_code="0"
681 681
682 # strip trailing slash 682 # strip trailing slash
683 myroot="${ROOT%/}" 683 myroot="${ROOT%/}"
684 684
685 # respect ROOT and options passed to compileall.py 685 # respect ROOT and options passed to compileall.py
723 723
724 ebegin "Byte compiling python modules for python-${PYVER} .." 724 ebegin "Byte compiling python modules for python-${PYVER} .."
725 if ((${#mydirs[@]})); then 725 if ((${#mydirs[@]})); then
726 python${PYVER} \ 726 python${PYVER} \
727 "${myroot}"/usr/$(get_libdir)/python${PYVER}/compileall.py \ 727 "${myroot}"/usr/$(get_libdir)/python${PYVER}/compileall.py \
728 "${myopts[@]}" "${mydirs[@]}" 728 "${myopts[@]}" "${mydirs[@]}" || return_code="1"
729 python${PYVER} -O \ 729 python${PYVER} -O \
730 "${myroot}"/usr/$(get_libdir)/python${PYVER}/compileall.py \ 730 "${myroot}"/usr/$(get_libdir)/python${PYVER}/compileall.py \
731 "${myopts[@]}" "${mydirs[@]}" 2> /dev/null 731 "${myopts[@]}" "${mydirs[@]}" &> /dev/null || return_code="1"
732 fi 732 fi
733 733
734 if ((${#myfiles[@]})); then 734 if ((${#myfiles[@]})); then
735 python_mod_compile "${myfiles[@]}" 735 python_mod_compile "${myfiles[@]}"
736 fi 736 fi
737 737
738 eend $? 738 eend "${return_code}"
739 fi 739 fi
740} 740}
741 741
742# @FUNCTION: python_mod_cleanup 742# @FUNCTION: python_mod_cleanup
743# @USAGE: [directory] 743# @USAGE: [directory]

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

  ViewVC Help
Powered by ViewVC 1.1.20