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

Diff of /eclass/python.eclass

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

Revision 1.144 Revision 1.145
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/python.eclass,v 1.144 2012/01/01 05:02:27 floppym Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.145 2012/01/21 19:48:20 floppym Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Gentoo Python Project <python@gentoo.org> 7# Gentoo Python Project <python@gentoo.org>
8# @BLURB: Eclass for Python packages 8# @BLURB: Eclass for Python packages
553 einfo "Converting shebang in '${file}'" 553 einfo "Converting shebang in '${file}'"
554 fi 554 fi
555 555
556 sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?\(jython\|pypy-c\|python\)\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2${python_interpreter}\6:" -i "${file}" || die "Conversion of shebang in '${file}' failed" 556 sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?\(jython\|pypy-c\|python\)\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2${python_interpreter}\6:" -i "${file}" || die "Conversion of shebang in '${file}' failed"
557 fi 557 fi
558 done
559}
560
561# @FUNCTION: python_clean_py-compile_files
562# @USAGE: [-q|--quiet]
563# @DESCRIPTION:
564# Clean py-compile files to disable byte-compilation.
565python_clean_py-compile_files() {
566 _python_check_python_pkg_setup_execution
567
568 local file files=() quiet="0"
569
570 while (($#)); do
571 case "$1" in
572 -q|--quiet)
573 quiet="1"
574 ;;
575 -*)
576 die "${FUNCNAME}(): Unrecognized option '$1'"
577 ;;
578 *)
579 die "${FUNCNAME}(): Invalid usage"
580 ;;
581 esac
582 shift
583 done
584
585 while read -d $'\0' -r file; do
586 files+=("${file#./}")
587 done < <(find -name py-compile -type f -print0)
588
589 for file in "${files[@]}"; do
590 if [[ "${quiet}" == "0" ]]; then
591 einfo "Cleaning '${file}' file"
592 fi
593 echo "#!/bin/sh" > "${file}"
558 done 594 done
559} 595}
560 596
561# @FUNCTION: python_clean_installation_image 597# @FUNCTION: python_clean_installation_image
562# @USAGE: [-q|--quiet] 598# @USAGE: [-q|--quiet]

Legend:
Removed from v.1.144  
changed lines
  Added in v.1.145

  ViewVC Help
Powered by ViewVC 1.1.20