Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 240709 Details for
Bug 330517
dev-python/chaco-3.3.1[doc] fails to build
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Environment file
chaco_environment (text/plain), 149.47 KB, created by
Jeremy Stent
on 2010-07-30 14:57:00 UTC
(
hide
)
Description:
Environment file
Filename:
MIME Type:
Creator:
Jeremy Stent
Created:
2010-07-30 14:57:00 UTC
Size:
149.47 KB
patch
obsolete
>declare -x ABI="amd64" >declare -x ADA_INCLUDE_PATH="/usr/lib64/gnat-gcc/x86_64-pc-linux-gnu/4.3/adainclude" >declare -x ADA_OBJECTS_PATH="/usr/lib64/gnat-gcc/x86_64-pc-linux-gnu/4.3/adalib" >declare -x ADA_PROJECT_PATH=":/usr/lib64/ada/x86_64-pc-linux-gnu-gnat-gcc-4.3/gpr" >declare -x ALSA_CARDS="" >declare -x ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" >declare -x ANT_HOME="/usr/share/ant" >declare -x APACHE2_MODULES="asis auth_digest authn_dbd cern_meta dbd dumpio ident imagemap log_forensic proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http substitute version actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache charset_lite dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" >declare -x ARCH="amd64" >declare -x ASFLAGS_x86="--32" >declare -x AUGUSTUS_CONFIG_PATH="/usr/share/augustus/config" >declare -x BLASTDB="/usr/share/ncbi/formatdb" >declare -x BLASTMAT="/usr/share/ncbi/data" >declare -x BROWSER="xdg-open" >declare -x CAMERAS="adc65 agfa_cl20 aox barbie canon casio_qv clicksmart310 digigr8 digita dimagev dimera3500 directory enigma13 fuji gsmart300 hp215 iclick jamcam jd11 jl2005a kodak_dc120 kodak_dc210 kodak_dc240 kodak_dc3200 kodak_ez200 konica konica_qm150 largan lg_gsm mars mustek panasonic_coolshot panasonic_dc1000 panasonic_dc1580 panasonic_l859 pccam300 pccam600 polaroid_pdc320 polaroid_pdc640 polaroid_pdc700 ptp2 ricoh ricoh_g3 samsung sierra sipix_blink sipix_blink2 sipix_web2 smal sonix sony_dscf1 sony_dscf55 soundvision spca50x sq905 stv0674 stv0680 sx330z template topfield toshiba_pdrm11" >declare -x CBUILD="x86_64-pc-linux-gnu" >declare -x CCL_DEFAULT_DIRECTORY="/usr/lib64/clozurecl" >declare -x CDEFINE_amd64="__x86_64__" >declare -x CDEFINE_default="__unix__" >declare -x CDEFINE_x86="__i386__" >declare -x CFLAGS="-march=athlon64 -O2 -pipe" >declare -x CFLAGS_default="" >declare -x CFLAGS_x86="-m32" >declare -x CF_LIB="/usr/share/confluence" >declare -x CG_COMPILER_EXE="/opt/bin/cgc" >declare -x CHOST="x86_64-pc-linux-gnu" >declare -x CHOST_amd64="x86_64-pc-linux-gnu" >declare -x CHOST_default="x86_64-pc-linux-gnu" >declare -x CHOST_x86="i686-pc-linux-gnu" >declare -x CLHEP_BASE_DIR="/usr" >declare -x CROSSCOMPILE_OPTS="" >declare -x CTARGET_default="x86_64-pc-linux-gnu" >declare -x CVS_RSH="ssh" >declare -x CXXFLAGS="-march=athlon64 -O2 -pipe" >declare -x DATAPLOT_FILES="/usr/share/dataplot" >declare -x DATAPLOT_WEB="OFF" >declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-HIjseKOVPl,guid=76df7f3eb137f6185ca749bc00000037" >declare -x DEFAULT_ABI="amd64" >declare -- DEFINED_PHASES=" compile install postinst postrm prepare test" >declare -- DEPEND=">=dev-python/enable-3.3.1 > >=dev-python/enthoughtbase-3.0.5 > dev-python/numpy > dev-python/setuptools > doc? ( dev-python/setupdocs ) > test? ( > dev-python/coverage > >=dev-python/nose-0.10.3 > media-fonts/font-cursor-misc > media-fonts/font-misc-misc > x11-apps/xhost > ) >=app-admin/eselect-python-20091230 =dev-lang/python-2* test? ( !prefix? ( x11-base/xorg-server ) > x11-apps/xhost )" >declare -- DESCRIPTION="Interactive plotting toolkit" >declare -x DESKTOP_SESSION="e16-kde" >declare -x DESTTREE="/usr" >declare -x DIROPTIONS="-m0755" >declare -- DISTUTILS_SRC_TEST="setup.py" >declare -x DRQUEUE_LOGS="/var/log/drqueue" >declare -x DRQUEUE_MASTER="127.0.0.1" >declare -x DRQUEUE_ROOT="/var/lib/drqueue" >declare -x EAPI="3" >declare -x EC2_AMITOOL_HOME="/opt/ec2-ami-tools" >declare -x EC2_HOME="/opt/ec2-api-tools" >declare -x ELIBC="glibc" >declare -x EMBOSS_ACDROOT="/usr/share/EMBOSS/acd" >declare -x EXEOPTIONS="-m0755" >declare -x FEATURES="assume-digests buildpkg ccache collision-protect distlocks fixpackages metadata-transfer news parallel-fetch protect-owned sandbox sfperms splitdebug strict unmerge-logs unmerge-orphans userfetch userpriv usersandbox" >declare -x FLTK_DOCDIR="/usr/share/doc/fltk-2.0_pre6970/html" >declare -x FRACTDIR="/usr/share/xfractint" >declare -x G4ABLADATA="/usr/share/geant4/data/G4ABLA3.0" >declare -x G4DATA="/usr/share/geant4/data" >declare -x G4INCLUDE="/usr/include/geant" >declare -x G4INSTALL="/usr/share/geant4" >declare -x G4LEDATA="/usr/share/geant4/data/G4EMLOW6.9" >declare -x G4LEVELGAMMADATA="/usr/share/geant4/data/PhotonEvaporation2.0" >declare -x G4LIB="/usr/lib64/geant4" >declare -x G4LIB_BUILD_G3TOG4="y" >declare -x G4LIB_BUILD_GDML="y" >declare -x G4LIB_BUILD_SHARED="y" >declare -x G4LIB_USE_ZLIB="y" >declare -x G4NEUTRONHPCROSSSECTIONS="/usr/share/geant4/data/G4NDL3.13" >declare -x G4OPTIMIZE="y" >declare -x G4RADIOACTIVEDATA="/usr/share/geant4/data/RadioactiveDecay3.2" >declare -x G4REALSURFACEDATA="/usr/share/geant4/data/G4REALSURFACEDATA*" >declare -x G4SYSTEM="Linux-g++" >declare -x G4UI_BUILD_QT_SESSION="y" >declare -x G4UI_BUILD_XAW_SESSION="y" >declare -x G4UI_BUILD_XM_SESSION="y" >declare -x G4VIS_BUILD_DAWN_DRIVER="y" >declare -x G4VIS_BUILD_OI_DRIVER="y" >declare -x G4VIS_BUILD_OPENGLXM_DRIVER="y" >declare -x G4VIS_BUILD_OPENGLX_DRIVER="y" >declare -x G4VIS_BUILD_RAYTRACERX_DRIVER="y" >declare -x G4VIS_BUILD_VRMLFILE_DRIVER="y" >declare -x G4VIS_BUILD_VRML_DRIVER="y" >declare -x G4VIS_USE_DAWN="y" >declare -x G4VIS_USE_OI="y" >declare -x G4VIS_USE_OPENGLX="y" >declare -x G4VIS_USE_OPENGLXM="y" >declare -x G4VIS_USE_RAYTRACERX="y" >declare -x G4VIS_USE_VRML="y" >declare -x G4VIS_USE_VRMLFILE="y" >declare -x G4WORKDIR="\${HOME}/geant4" >declare -x GCC_SPECS="" >declare -x GDK_USE_XFT="1" >declare -x GDMSESSION="e16-kde" >declare -x GDM_LANG="C" >declare -x GDM_XSERVER_LOCATION="local" >declare -x GMXBIN="/usr/bin" >declare -x GMXDATA="/usr/share" >declare -x GMXLDLIB="/usr/lib64" >declare -x GMXMAN="/usr/share/man" >declare -x GNOME_KEYRING_PID="3924" >declare -x GNOME_KEYRING_SOCKET="/tmp/.private/stentj/keyring-7bMqwv/socket" >declare -x GS_LIB="/home/stentj/.fonts" >declare -x GTK2_RC_FILES="/etc/gtk-2.0/gtkrc:/home/stentj/.gtkrc-2.0::/home/stentj/.kde4/share/config/gtkrc-2.0" >declare -x GTK_RC_FILES="/etc/gtk/gtkrc:/home/stentj/.gtkrc::/home/stentj/.kde4/share/config/gtkrc" >declare -x GUILE_LOAD_PATH="/usr/share/guile/1.8" >declare -x HG="/usr/bin/hg" >declare -- HOMEPAGE="http://code.enthought.com/projects/chaco http://pypi.python.org/pypi/Chaco" >declare -x INFODIR="/usr/GNUstep/System/Library/Documentation/info:/usr/GNUstep/Local/Library/Documentation/info" >declare -x INHERITED="python toolchain-funcs virtualx multilib distutils" >declare -x INPUT_DEVICES="evdev joystick keyboard mouse" >declare -x INSDESTTREE="" >declare -x INSOPTIONS="-m0644" >declare -- IUSE="doc examples test test" >declare -x JAVAC="/etc/java-config-2/current-system-vm/bin/javac" >declare -x JAVACC_HOME="/usr/share/javacc/" >declare -x JAVA_HOME="/etc/java-config-2/current-system-vm" >declare -x JDK_HOME="/etc/java-config-2/current-system-vm" >declare -x KDEWM="e16" >declare -x KDE_FULL_SESSION="true" >declare -x KDE_MULTIHEAD="false" >declare -x KDE_SESSION_UID="1000" >declare -x KDE_SESSION_VERSION="4" >declare -x KERNEL="linux" >declare -x KERNEL_ABI="amd64" >declare -x KEYWORDS="~amd64 ~x86" >declare -x KV="2.6.34-gentoo-r2" >declare -x LADSPA_PATH="/usr/lib64/ladspa" >declare -x LAGAN_DIR="/usr/share/lagan" >declare -x LANG="C" >declare -x LCD_DEVICES="" >declare -x LC_CTYPE="en_GB.UTF-8" >declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed" >declare -x LDFLAGS_default="" >declare -x LDFLAGS_x86="-m elf_i386" >declare -x LIBDIR_amd64="lib64" >declare -x LIBDIR_amd64_fbsd="lib64" >declare -x LIBDIR_default="lib" >declare -x LIBDIR_ppc="lib32" >declare -x LIBDIR_ppc64="lib64" >declare -x LIBDIR_sparc32="lib32" >declare -x LIBDIR_sparc64="lib64" >declare -x LIBDIR_x86="lib32" >declare -x LIBDIR_x86_fbsd="lib32" >declare -x LIBOPTIONS="-m0644" >declare -x LICENSE="BSD" >declare -x LINGUAS="af ar as as_IN ast az be be_BY bg bn bn_BD bn_IN bo br brx bs ca ca@valencia cs csb cy da de dgo dz el en en_CA en_GB en_US en_ZA en-GB eo es es_AR es_CL es_CR es_ES es-ES es_LA es-LA es_MX et et_EE eu fa fi fo fr fr_CA fr-CA fy fy_NL ga ga_IE gl gu gu_IN he hi hi_IN hne hr hsb hu hy id is it ja ka kk km kn kn_IN ko kok ks ku la lt lv mai mk ml ml_IN mn mni mr mr_IN ms nb nb_NO nds ne nl nn nn_NO no nr ns oc or or_IN pa pa_IN pl pt pt_BR pt-BR pt_PT rm ro ru rw sa_IN sat sd se sh si sk sl sq sr sr_CS sr@Latn sr@latin ss st sv sv_SE sw sw_TZ ta ta_IN ta_LK te te_IN tg th ti_ER tl tk tn tr ts uk ur_IN uz uz@cyrillic ve vi wa xh zh zh_CN zh_TW zh-CN zh_HK zh-HK zh-TW zu" >declare -x LIRC_DEVICES="accent act200l act220l adaptec all alsa_usb animax asusdh atilibusb atiusb audio audio_alsa avermedia avermedia98 avermedia_vdomate awlibusb bestbuy bestbuy2 breakoutbox bte bw6130 caraca chronos commandir cph06x creative creative_infracd devinput digimatrix dsp dvico ea65 ene0100 exaudio flyvideo ftdi gvbctv5pci hauppauge hauppauge_dvb hercules_smarttv_stereo i2cuser igorplugusb iguanaIR imon imon_24g imon_knob imon_lcd imon_pad imon_rsc inputlirc irdeo irdeo_remote irlink irman irreal it87 ite8709 knc_one kworld leadtek_0007 leadtek_0010 leadtek_pvr2000 livedrive_midi livedrive_seq logitech mceusb mediafocusI mouseremote mouseremote_ps2 mp3anywhere mplay nslu2 packard_bell parallel pcmak pcmak_usb pctv pixelview_bt878 pixelview_pak pixelview_pro provideo realmagic remote_wonder_plus remotemaster sa1100 samsung sasem sb0540 serial serial_igor_cesko silitek sir slinke streamzap tekram tekram_bt829 tira ttusbir tuxbox tvbox udp uirt2 uirt2_raw usb_uirt_raw usbirboy usbx userspace wpc8769l xboxusb" >declare -x LOGTALKHOME="/usr/share/logtalk-2.37.4" >declare -x MAKEOPTS="-j2" >declare -x MULTILIB_ABIS="amd64 x86" >declare -x MULTILIB_STRICT_DENY="64-bit.*shared object" >declare -x MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib" >declare -x MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage)" >declare -x MULTITALK_DIR="/usr/share/multitalk" >declare -- MY_P="Chaco-3.3.1" >declare -- MY_PN="Chaco" >declare -x NCBI="/etc/ncbi" >declare -x NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" >declare -x OPENGL_PROFILE="nvidia" >declare -x PATH="/usr/lib/ccache/bin:/usr/lib64/portage/bin/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.4:/usr/x86_64-pc-linux-gnu/gnat-gcc-bin/4.3:/usr/libexec/gnat-gcc/x86_64-pc-linux-gnu/4.3:/usr/lib64/ada/x86_64-pc-linux-gnu-gnat-gcc-4.3/adadoc:/usr/lib64/ada/x86_64-pc-linux-gnu-gnat-gcc-4.3/bin:/usr/lib64/subversion/bin:/opt/eagle-5.10.0/bin:/opt/cuda/bin:/opt/cuda/cudaprof/bin:/usr/GNUstep/System/Tools:/usr/GNUstep/Local/Tools:/opt/cuda/openclprof/bin" >declare -- PDEPEND=" " >declare -x PKG_CONFIG_PATH="/usr/lib64/pkgconfig" >declare -x PLPLOT_LIB="/usr/share/EMBOSS/" >declare -x PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="css gif htm[l]? jp[e]?g js pdf png" >declare -x PRELINK_PATH_MASK="/usr/lib64/klibc:/opt/eagle-5.10.0:/usr/lib64/libfreebl3.so:/usr/lib64/libnssdbm3.so:/usr/lib64/libsoftokn3.so /usr/lib64/klibc:/opt/eagle-5.9.0" >declare -x PROFILE_ONLY_VARIABLES="ARCH ELIBC KERNEL USERLAND" >declare -x PROPERTIES="" >declare -x PROVIDE="" >declare -x PYMOL_DATA="/usr/share/pymol/data" >declare -x PYMOL_PATH="//usr/lib64/python2.6/site-packages/pymol" >declare -x PYMOL_SCRIPTS="/usr/share/pymol/scripts" >declare -x PYTHIA8DATA="/usr/share/pythia/xmldoc" >declare -x PYTHONDOCS="/usr/share/doc/python-docs-2.6.5/html/library" >declare -x PYTHONDOCS_2_4="/usr/share/doc/python-docs-2.4.4-r1/html" >declare -x PYTHONDOCS_2_5="/usr/share/doc/python-docs-2.5.4-r1/html" >declare -x PYTHONDOCS_2_6="/usr/share/doc/python-docs-2.6.5/html/library" >declare -x PYTHONDOCS_3_1="/usr/share/doc/python-docs-3.1.2/html/library" >declare -x PYTHONDONTWRITEBYTECODE="1" >declare -x PYTHONPATH="/usr/lib64/paraview-3.6" >declare -a PYTHON_CFLAGS='([0]="2.* + -fno-strict-aliasing")' >declare -- PYTHON_COLORS="0" >declare -- PYTHON_DEPEND="2" >declare -- PYTHON_MODNAME="enthought" >declare -- PYTHON_TEST_VERBOSITY="1" >declare -x QRNADB="/usr/share/qrna/data" >declare -x QT_PLUGIN_PATH="/home/stentj/.kde4/lib64/kde4/plugins/:/usr/lib64/kde4/plugins/" >declare -x RDEPEND=">=dev-python/enable-3.3.1 > >=dev-python/enthoughtbase-3.0.5 > dev-python/numpy >=app-admin/eselect-python-20091230 =dev-lang/python-2* " >declare -x RESTRICT="" >declare -- RESTRICT_PYTHON_ABIS="3.*" >declare -x RNAVIEW="/usr/share/rnaview" >declare -x RUBYOPT="-rauto_gem" >declare -x RUBY_TARGETS="" >declare -x R_HOME="/usr/lib64/R" >declare -x S="/var/tmp/portage/dev-python/chaco-3.3.1/work/Chaco-3.3.1" >declare -x SANDBOX_DEBUG="0" >declare -x SANDBOX_DENY="" >declare -x SANDBOX_PID="32338" >declare -x SANDBOX_PREDICT="/var/tmp/portage/dev-python/chaco-3.3.1/homedir:/dev/crypto:/var/cache/fontconfig" >declare -x SANDBOX_READ="/:/dev/stdin:/var/tmp:/var/tmp/ccache" >declare -x SANDBOX_VERBOSE="1" >declare -x SANDBOX_WRITE=":/dev/console:/dev/fd:/dev/full:/dev/null:/dev/pts/:/dev/pty:/dev/shm:/dev/stderr:/dev/stdout:/dev/tts:/dev/tty:/dev/vc/:/dev/zero:/proc/self/fd:/tmp/:/tmp/.private/root:/usr/lib/cf:/usr/lib/conftest:/usr/lib32/cf:/usr/lib32/conftest:/usr/lib64/cf:/usr/lib64/conftest:/usr/tmp/cf:/usr/tmp/conftest:/var/tmp:/var/tmp/:/var/tmp/ccache:/var/tmp/portage/dev-python/chaco-3.3.1/homedir/.bash_history" >declare -x SANE_CONFIG_DIR="/etc/sane.d" >declare -x SBCL_HOME="/usr/lib64/sbcl" >declare -x SBCL_SOURCE_ROOT="/usr/lib64/sbcl/src" >declare -x SCHEME_LIBRARY_PATH="/usr/share/slib/" >declare -x SCSH_LIB_DIRS="/usr/lib32/scsh" >declare -x SESSION_MANAGER="local/reason3:@/tmp/.ICE-unix/4101,unix/reason3:/tmp/.ICE-unix/4101" >declare -x SGML_CATALOG_FILES="/etc/sgml/xml-simple-docbook-4.1.2.4.cat:/etc/sgml/sgml-docbook-3.0.cat:/etc/sgml/xhtml1.cat:/etc/sgml/xml-docbook-4.3.cat:/etc/sgml/sgml-docbook-4.0.cat:/etc/sgml/xml-simple-docbook-1.0.cat:/etc/sgml/dsssl-docbook-stylesheets.cat:/etc/sgml/gentoo-guide.cat:/etc/sgml/sgml-docbook-3.1.cat:/etc/sgml/xml-docbook-4.5.cat:/etc/sgml/xml-docbook-4.1.2.cat:/etc/sgml/xml-docbook-4.2.cat:/etc/sgml/sgml-docbook.cat:/etc/sgml/sgml-docbook-4.1.cat:/etc/sgml/sgml-docbook-4.5.cat:/etc/sgml/sgml-ent.cat:/etc/sgml/sgml-docbook-4.2.cat:/etc/sgml/sgml-lite.cat:/etc/sgml/openjade-1.3.2.cat:/etc/sgml/xml-docbook-4.4.cat:/etc/sgml/linuxdoc.cat" >declare -x SLOT="0" >declare -- SRC_URI="http://www.enthought.com/repo/ETS/Chaco-3.3.1.tar.gz" >declare -x STAGE1_USE="multilib nptl nptlonly unicode" >declare -x STRIGI_PLUGIN_PATH="/usr/lib64/strigi:" >declare -- SUPPORT_PYTHON_ABIS="1" >declare -x SYMLINK_LIB="yes" >declare -x TEXINPUTS="/usr/lib64/ocaml/ocamldoc:" >declare -x USB_DEVFS_PATH="/dev/bus/usb" >declare -x USE="amd64 doc elibc_glibc examples kernel_linux multilib userland_GNU" >declare -x USERLAND="GNU" >declare -x USERNAME="stentj" >declare -x VBOX_APP_HOME="/usr/lib64/virtualbox-ose" >declare -x VIDEO_CARDS="" >declare -- VIRTUALX_DEPEND="!prefix? ( x11-base/xorg-server ) > x11-apps/xhost" >declare -- VIRTUALX_REQUIRED="optional" >declare -- VIRTUALX_USE="test" >declare -x VTKHOME="/usr" >declare -x VTK_DATA_ROOT="/usr/share/vtk/data" >declare -x VTK_DIR="/usr/lib64/vtk-5.6" >declare -x WINDOWPATH="7" >declare -x XCURSOR_THEME="Silver" >declare -x XDG_CONFIG_DIRS="/etc/xdg" >declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share:/usr/share/gdm" >declare -x XDG_SESSION_COOKIE="548b2f4bbac1d561ab4335814b03ff42-1275613699.894208-380347461" >declare -x XEHELPURL="/usr/share/doc/xephem-3.7.4/html/xephem.html" >declare -x XGUILOADPATH="/usr/share/doc/snns-4.2-r8/" >declare -x XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" >declare -x XZ_OPT="--memory=max" >declare -- _="PKG_INSTALL_MASK" >declare -a _CPYTHON2_SUPPORTED_ABIS='([0]="2.4" [1]="2.5" [2]="2.6" [3]="2.7")' >declare -a _CPYTHON3_SUPPORTED_ABIS='([0]="3.0" [1]="3.1" [2]="3.2")' >declare -x _E_DOCDESTTREE_="" >declare -x _E_EXEDESTTREE_="" >declare -a _JYTHON_SUPPORTED_ABIS='([0]="2.5-jython")' >declare -- _PYTHON_ABI_EXTRACTION_COMMAND="import platform >import sys >sys.stdout.write(\".\".join(str(x) for x in sys.version_info[:2])) >if platform.system()[:4] == \"Java\": > sys.stdout.write(\"-jython\")" >declare -- ___ECLASS_RECUR_MULTILIB="yes" >declare -- ___ECLASS_RECUR_TOOLCHAIN_FUNCS="yes" >declare -x aUSE="pch qt4 doc latex dbus doc examples jadetex jpeg png" >declare -x bash4="4.1.7(2)-release" >declare -- filter_opts="" >declare -- python="die" >PYTHON () >{ > _python_check_python_pkg_setup_execution; > local ABI_output="0" absolute_path_output="0" final_ABI="0" PYTHON_ABI="${PYTHON_ABI}" python_interpreter python2="0" python3="0"; > while (($#)); do > case "$1" in > -2) > python2="1" > ;; > -3) > python3="1" > ;; > --ABI) > ABI_output="1" > ;; > -a | --absolute-path) > absolute_path_output="1" > ;; > -f | --final-ABI) > final_ABI="1" > ;; > --) > shift; > break > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > break > ;; > esac; > shift; > done; > if [[ "${ABI_output}" == "1" && "${absolute_path_output}" == "1" ]]; then > die "${FUNCNAME}(): '--ABI' and '--absolute-path' options cannot be specified simultaneously"; > fi; > if [[ "$((${python2} + ${python3} + ${final_ABI}))" -gt 1 ]]; then > die "${FUNCNAME}(): '-2', '-3' or '--final-ABI' options cannot be specified simultaneously"; > fi; > if [[ "$#" -eq 0 ]]; then > if [[ "${final_ABI}" == "1" ]]; then > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > _python_calculate_PYTHON_ABIS; > PYTHON_ABI="${PYTHON_ABIS##* }"; > else > if [[ "${python2}" == "1" ]]; then > PYTHON_ABI="$(eselect python show --python2 --ABI)"; > if [[ -z "${PYTHON_ABI}" ]]; then > die "${FUNCNAME}(): Active version of Python 2 not set"; > else > if [[ "${PYTHON_ABI}" != "2."* ]]; then > die "${FUNCNAME}(): Internal error in \`eselect python show --python2\`"; > fi; > fi; > else > if [[ "${python3}" == "1" ]]; then > PYTHON_ABI="$(eselect python show --python3 --ABI)"; > if [[ -z "${PYTHON_ABI}" ]]; then > die "${FUNCNAME}(): Active version of Python 3 not set"; > else > if [[ "${PYTHON_ABI}" != "3."* ]]; then > die "${FUNCNAME}(): Internal error in \`eselect python show --python3\`"; > fi; > fi; > else > if _python_package_supporting_installation_for_multiple_python_abis; then > if ! _python_abi-specific_local_scope; then > die "${FUNCNAME}() should be used in ABI-specific local scope"; > fi; > else > PYTHON_ABI="$("${EPREFIX}/usr/bin/python" -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")"; > if [[ -z "${PYTHON_ABI}" ]]; then > die "${FUNCNAME}(): Failure of extraction of locally active version of Python"; > fi; > fi; > fi; > fi; > fi; > else > if [[ "$#" -eq 1 ]]; then > if [[ "${final_ABI}" == "1" ]]; then > die "${FUNCNAME}(): '--final-ABI' option and Python ABI cannot be specified simultaneously"; > fi; > if [[ "${python2}" == "1" ]]; then > die "${FUNCNAME}(): '-2' option and Python ABI cannot be specified simultaneously"; > fi; > if [[ "${python3}" == "1" ]]; then > die "${FUNCNAME}(): '-3' option and Python ABI cannot be specified simultaneously"; > fi; > PYTHON_ABI="$1"; > else > die "${FUNCNAME}(): Invalid usage"; > fi; > fi; > if [[ "${ABI_output}" == "1" ]]; then > echo -n "${PYTHON_ABI}"; > return; > else > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then > python_interpreter="python${PYTHON_ABI}"; > else > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then > python_interpreter="jython-${PYTHON_ABI%-jython}"; > fi; > fi; > if [[ "${absolute_path_output}" == "1" ]]; then > echo -n "${EPREFIX}/usr/bin/${python_interpreter}"; > else > echo -n "${python_interpreter}"; > fi; > fi; > if [[ -n "${ABI}" && "${ABI}" != "${DEFAULT_ABI}" && "${DEFAULT_ABI}" != "default" ]]; then > echo -n "-${ABI}"; > fi >} >Xeconf () >{ > export maketype="econf"; > virtualmake "$@" >} >Xemake () >{ > export maketype="emake"; > virtualmake "$@" >} >Xmake () >{ > export maketype="make"; > virtualmake "$@" >} >_distutils_get_PYTHONPATH () >{ > if [[ -n "${SUPPORT_PYTHON_ABIS}" && -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then > ls -d build-${PYTHON_ABI}/lib* 2> /dev/null; > else > ls -d build/lib* 2> /dev/null; > fi >} >_distutils_get_build_dir () >{ > if [[ -n "${SUPPORT_PYTHON_ABIS}" && -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then > echo "build-${PYTHON_ABI}"; > else > echo "build"; > fi >} >_distutils_hook () >{ > if [[ "$#" -ne 1 ]]; then > die "${FUNCNAME}() requires 1 argument"; > fi; > if [[ "$(type -t "distutils_src_${EBUILD_PHASE}_$1_hook")" == "function" ]]; then > "distutils_src_${EBUILD_PHASE}_$1_hook"; > fi >} >_distutils_src_test_hook () >{ > if [[ "$#" -ne 1 ]]; then > die "${FUNCNAME}() requires 1 arguments"; > fi; > if [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then > return; > fi; > if [[ "$(type -t "distutils_src_test_pre_hook")" == "function" ]]; then > eval "python_execute_$1_pre_hook() { > distutils_src_test_pre_hook > }"; > fi; > if [[ "$(type -t "distutils_src_test_post_hook")" == "function" ]]; then > eval "python_execute_$1_post_hook() { > distutils_src_test_post_hook > }"; > fi >} >_gcc-install-dir () >{ > echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')" >} >_gcc-specs-directive_raw () >{ > local cc=$(tc-getCC); > local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}'); > ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 } >$1=="*"directive":" { pspec=spec; spec=""; outside=0; next } > outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next } > spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next } > { spec=spec $0 } >END { print spec }'; > return 0 >} >_gcc-specs-exists () >{ > [[ -f $(_gcc-install-dir)/$1 ]] >} >_parse_PYTHON_DEPEND () >{ > local major_version maximal_version minimal_version python_all="0" python_maximal_version python_minimal_version python_versions=() python2="0" python2_maximal_version python2_minimal_version python3="0" python3_maximal_version python3_minimal_version USE_flag= version_components_group version_components_group_regex version_components_groups; > version_components_group_regex="(2|3|\*)(:([[:digit:]]+\.[[:digit:]]+)?(:([[:digit:]]+\.[[:digit:]]+)?)?)?"; > version_components_groups="${PYTHON_DEPEND}"; > if [[ "${version_components_groups}" =~ ^((\!)?[[:alnum:]_-]+\?\ )?${version_components_group_regex}(\ ${version_components_group_regex})?$ ]]; then > if [[ "${version_components_groups}" =~ ^(\!)?[[:alnum:]_-]+\? ]]; then > USE_flag="${version_components_groups%\? *}"; > version_components_groups="${version_components_groups#* }"; > fi; > if [[ "${version_components_groups}" =~ ("*".*" "|" *"|^2.*\ (2|\*)|^3.*\ (3|\*)) ]]; then > die "Invalid syntax of PYTHON_DEPEND: Incorrectly specified groups of versions"; > fi; > version_components_groups="${version_components_groups// / >}"; > while read version_components_group; do > major_version="${version_components_group:0:1}"; > minimal_version="${version_components_group:2}"; > minimal_version="${minimal_version%:*}"; > maximal_version="${version_components_group:$((3 + ${#minimal_version}))}"; > if [[ "${major_version}" =~ ^(2|3)$ ]]; then > if [[ -n "${minimal_version}" && "${major_version}" != "${minimal_version:0:1}" ]]; then > die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' not in specified group of versions"; > fi; > if [[ -n "${maximal_version}" && "${major_version}" != "${maximal_version:0:1}" ]]; then > die "Invalid syntax of PYTHON_DEPEND: Maximal version '${maximal_version}' not in specified group of versions"; > fi; > fi; > if [[ "${major_version}" == "2" ]]; then > python2="1"; > python_versions=("${_CPYTHON2_SUPPORTED_ABIS[@]}"); > python2_minimal_version="${minimal_version}"; > python2_maximal_version="${maximal_version}"; > else > if [[ "${major_version}" == "3" ]]; then > python3="1"; > python_versions=("${_CPYTHON3_SUPPORTED_ABIS[@]}"); > python3_minimal_version="${minimal_version}"; > python3_maximal_version="${maximal_version}"; > else > python_all="1"; > python_versions=("${_CPYTHON2_SUPPORTED_ABIS[@]}" "${_CPYTHON3_SUPPORTED_ABIS[@]}"); > python_minimal_version="${minimal_version}"; > python_maximal_version="${maximal_version}"; > fi; > fi; > if [[ -n "${minimal_version}" ]] && ! has "${minimal_version}" "${python_versions[@]}"; then > die "Invalid syntax of PYTHON_DEPEND: Unrecognized minimal version '${minimal_version}'"; > fi; > if [[ -n "${maximal_version}" ]] && ! has "${maximal_version}" "${python_versions[@]}"; then > die "Invalid syntax of PYTHON_DEPEND: Unrecognized maximal version '${maximal_version}'"; > fi; > if [[ -n "${minimal_version}" && -n "${maximal_version}" && "${minimal_version}" > "${maximal_version}" ]]; then > die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' greater than maximal version '${maximal_version}'"; > fi; > done <<< "${version_components_groups}"; > _PYTHON_ATOMS=(); > function _append_accepted_versions_range () > { > local accepted_version="0" i; > for ((i = "${#python_versions[@]}"; i >= 0; i--)) > do > if [[ "${python_versions[${i}]}" == "${python_maximal_version}" ]]; then > accepted_version="1"; > fi; > if [[ "${accepted_version}" == "1" ]]; then > _PYTHON_ATOMS+=("=dev-lang/python-${python_versions[${i}]}*"); > fi; > if [[ "${python_versions[${i}]}" == "${python_minimal_version}" ]]; then > accepted_version="0"; > fi; > done > }; > if [[ "${python_all}" == "1" ]]; then > if [[ -z "${python_minimal_version}" && -z "${python_maximal_version}" ]]; then > _PYTHON_ATOMS+=("dev-lang/python"); > else > python_versions=("${_CPYTHON2_SUPPORTED_ABIS[@]}" "${_CPYTHON3_SUPPORTED_ABIS[@]}"); > python_minimal_version="${python_minimal_version:-${python_versions[0]}}"; > python_maximal_version="${python_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"; > _append_accepted_versions_range; > fi; > else > if [[ "${python3}" == "1" ]]; then > if [[ -z "${python3_minimal_version}" && -z "${python3_maximal_version}" ]]; then > _PYTHON_ATOMS+=("=dev-lang/python-3*"); > else > python_versions=("${_CPYTHON3_SUPPORTED_ABIS[@]}"); > python_minimal_version="${python3_minimal_version:-${python_versions[0]}}"; > python_maximal_version="${python3_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"; > _append_accepted_versions_range; > fi; > fi; > if [[ "${python2}" == "1" ]]; then > if [[ -z "${python2_minimal_version}" && -z "${python2_maximal_version}" ]]; then > _PYTHON_ATOMS+=("=dev-lang/python-2*"); > else > python_versions=("${_CPYTHON2_SUPPORTED_ABIS[@]}"); > python_minimal_version="${python2_minimal_version:-${python_versions[0]}}"; > python_maximal_version="${python2_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"; > _append_accepted_versions_range; > fi; > fi; > fi; > unset -f _append_accepted_versions_range; > if [[ "${#_PYTHON_ATOMS[@]}" -gt 1 ]]; then > DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}"; > RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}"; > else > DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}"; > RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}"; > fi; > else > die "Invalid syntax of PYTHON_DEPEND"; > fi >} >_python_abi-specific_local_scope () >{ > [[ " ${FUNCNAME[@]:2} " =~ " "(_python_final_sanity_checks|python_execute_function|python_mod_optimize|python_mod_cleanup)" " ]] >} >_python_calculate_PYTHON_ABIS () >{ > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > _python_initial_sanity_checks; > if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3 4; then > local PYTHON_ABI restricted_ABI support_ABI supported_PYTHON_ABIS=; > PYTHON_ABI_SUPPORTED_VALUES="${_CPYTHON2_SUPPORTED_ABIS[@]} ${_CPYTHON3_SUPPORTED_ABIS[@]} ${_JYTHON_SUPPORTED_ABIS[@]}"; > if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then > local cpython_enabled="0"; > if [[ -z "${USE_PYTHON}" ]]; then > die "USE_PYTHON variable is empty"; > fi; > for PYTHON_ABI in ${USE_PYTHON}; > do > if ! has "${PYTHON_ABI}" ${PYTHON_ABI_SUPPORTED_VALUES}; then > die "USE_PYTHON variable contains invalid value '${PYTHON_ABI}'"; > fi; > if has "${PYTHON_ABI}" "${_CPYTHON2_SUPPORTED_ABIS[@]}" "${_CPYTHON3_SUPPORTED_ABIS[@]}"; then > cpython_enabled="1"; > fi; > support_ABI="1"; > for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; > do > if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then > support_ABI="0"; > break; > fi; > done; > [[ "${support_ABI}" == "1" ]] && export PYTHON_ABIS+="${PYTHON_ABIS:+ }${PYTHON_ABI}"; > done; > if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then > die "USE_PYTHON variable does not enable any Python ABI supported by ${CATEGORY}/${PF}"; > fi; > if [[ "${cpython_enabled}" == "0" ]]; then > die "USE_PYTHON variable does not enable any CPython ABI"; > fi; > else > local python_version python2_version= python3_version= support_python_major_version; > if ! has_version "dev-lang/python"; then > die "${FUNCNAME}(): 'dev-lang/python' is not installed"; > fi; > python_version="$("${EPREFIX}/usr/bin/python" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"; > if has_version "=dev-lang/python-2*"; then > if [[ "$(readlink "${EPREFIX}/usr/bin/python2")" != "python2."* ]]; then > die "'${EPREFIX}/usr/bin/python2' is not valid symlink"; > fi; > python2_version="$("${EPREFIX}/usr/bin/python2" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"; > for PYTHON_ABI in "${_CPYTHON2_SUPPORTED_ABIS[@]}"; > do > support_python_major_version="1"; > for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; > do > if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then > support_python_major_version="0"; > fi; > done; > [[ "${support_python_major_version}" == "1" ]] && break; > done; > if [[ "${support_python_major_version}" == "1" ]]; then > for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; > do > if [[ "${python2_version}" == ${restricted_ABI} ]]; then > die "Active version of Python 2 is not supported by ${CATEGORY}/${PF}"; > fi; > done; > else > python2_version=""; > fi; > fi; > if has_version "=dev-lang/python-3*"; then > if [[ "$(readlink "${EPREFIX}/usr/bin/python3")" != "python3."* ]]; then > die "'${EPREFIX}/usr/bin/python3' is not valid symlink"; > fi; > python3_version="$("${EPREFIX}/usr/bin/python3" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"; > for PYTHON_ABI in "${_CPYTHON3_SUPPORTED_ABIS[@]}"; > do > support_python_major_version="1"; > for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; > do > if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then > support_python_major_version="0"; > fi; > done; > [[ "${support_python_major_version}" == "1" ]] && break; > done; > if [[ "${support_python_major_version}" == "1" ]]; then > for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; > do > if [[ "${python3_version}" == ${restricted_ABI} ]]; then > die "Active version of Python 3 is not supported by ${CATEGORY}/${PF}"; > fi; > done; > else > python3_version=""; > fi; > fi; > if [[ -n "${python2_version}" && "${python_version}" == "2."* && "${python_version}" != "${python2_version}" ]]; then > eerror "Python wrapper is configured incorrectly or '${EPREFIX}/usr/bin/python2' symlink"; > eerror "is set incorrectly. Use \`eselect python\` to fix configuration."; > die "Incorrect configuration of Python"; > fi; > if [[ -n "${python3_version}" && "${python_version}" == "3."* && "${python_version}" != "${python3_version}" ]]; then > eerror "Python wrapper is configured incorrectly or '${EPREFIX}/usr/bin/python3' symlink"; > eerror "is set incorrectly. Use \`eselect python\` to fix configuration."; > die "Incorrect configuration of Python"; > fi; > PYTHON_ABIS="${python2_version} ${python3_version}"; > PYTHON_ABIS="${PYTHON_ABIS# }"; > export PYTHON_ABIS="${PYTHON_ABIS% }"; > fi; > fi; > _python_final_sanity_checks >} >_python_check_python_pkg_setup_execution () >{ > [[ " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " ]] && return; > if ! has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_PKG_SETUP_EXECUTED}" ]]; then > die "python_pkg_setup() not called"; > fi >} >_python_clean_compiled_modules () >{ > _python_initialize_prefix_variables; > _python_set_color_variables; > [[ "${FUNCNAME[1]}" =~ ^(python_mod_optimize|python_mod_compile|python_mod_cleanup)$ ]] || die "${FUNCNAME}(): Invalid usage"; > local base_module_name compiled_file compiled_files=() dir path py_file root; > root="${EROOT%/}"; > for path in "$@"; > do > compiled_files=(); > if [[ -d "${path}" ]]; then > while read -d '' -r compiled_file; do > compiled_files+=("${compiled_file}"); > done < <(find "${path}" "(" -name "*.py[co]" -o -name "*\$py.class" ")" -print0); > if [[ "${EBUILD_PHASE}" == "postrm" ]]; then > find "${path}" -type d | sort -r | while read -r dir; do > if rmdir "${dir}" 2> /dev/null; then > echo "${_CYAN}<<< ${dir}${_NORMAL}"; > fi; > done; > fi; > else > if [[ "${path}" == *.py ]]; then > base_module_name="${path##*/}"; > base_module_name="${base_module_name%.py}"; > if [[ -d "${path%/*}/__pycache__" ]]; then > while read -d '' -r compiled_file; do > compiled_files+=("${compiled_file}"); > done < <(find "${path%/*}/__pycache__" "(" -name "${base_module_name}.*.py[co]" -o -name "${base_module_name}\$py.class" ")" -print0); > fi; > compiled_files+=("${path}c" "${path}o" "${path%.py}\$py.class"); > fi; > fi; > for compiled_file in "${compiled_files[@]}"; > do > [[ ! -f "${compiled_file}" ]] && continue; > dir="${compiled_file%/*}"; > dir="${dir##*/}"; > if [[ "${compiled_file}" == *.py[co] ]]; then > if [[ "${dir}" == "__pycache__" ]]; then > base_module_name="${compiled_file##*/}"; > base_module_name="${base_module_name%.*py[co]}"; > base_module_name="${base_module_name%.*}"; > py_file="${compiled_file%__pycache__/*}${base_module_name}.py"; > else > py_file="${compiled_file%[co]}"; > fi; > if [[ "${EBUILD_PHASE}" == "postinst" ]]; then > [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue; > else > [[ -f "${py_file}" ]] && continue; > fi; > echo "${_BLUE}<<< ${compiled_file%[co]}[co]${_NORMAL}"; > rm -f "${compiled_file%[co]}"[co]; > else > if [[ "${compiled_file}" == *\$py.class ]]; then > if [[ "${dir}" == "__pycache__" ]]; then > base_module_name="${compiled_file##*/}"; > base_module_name="${base_module_name%\$py.class}"; > py_file="${compiled_file%__pycache__/*}${base_module_name}.py"; > else > py_file="${compiled_file%\$py.class}"; > fi; > if [[ "${EBUILD_PHASE}" == "postinst" ]]; then > [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue; > else > [[ -f "${py_file}" ]] && continue; > fi; > echo "${_BLUE}<<< ${compiled_file}${_NORMAL}"; > rm -f "${compiled_file}"; > else > die "${FUNCNAME}(): Unrecognized file type: '${compiled_file}'"; > fi; > fi; > dir="${compiled_file%/*}"; > while [[ "${dir}" != "${root}" ]]; do > if rmdir "${dir}" 2> /dev/null; then > echo "${_CYAN}<<< ${dir}${_NORMAL}"; > else > break; > fi; > dir="${dir%/*}"; > done; > done; > done >} >_python_final_sanity_checks () >{ > if ! _python_implementation && [[ "$(declare -p PYTHON_SANITY_CHECKS_EXECUTED 2> /dev/null)" != "declare -- PYTHON_SANITY_CHECKS_EXECUTED="* || " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " && -z "${PYTHON_SKIP_SANITY_CHECKS}" ]]; then > local PYTHON_ABI="${PYTHON_ABI}"; > for PYTHON_ABI in ${PYTHON_ABIS-${PYTHON_ABI}}; > do > if ! has_version "$(python_get_implementational_package)"; then > die "$(python_get_implementational_package) is not installed"; > fi; > if [[ "$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")" != "${PYTHON_ABI}" ]]; then > eerror "Path to 'python': '$(type -p python)'"; > eerror "ABI: '${ABI}'"; > eerror "DEFAULT_ABI: '${DEFAULT_ABI}'"; > eerror "EPYTHON: '$(PYTHON)'"; > eerror "PYTHON_ABI: '${PYTHON_ABI}'"; > eerror "Locally active version of Python: '$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")'"; > die "'python' does not respect EPYTHON variable"; > fi; > done; > fi; > PYTHON_SANITY_CHECKS_EXECUTED="1" >} >_python_get_implementation () >{ > if [[ "$#" -ne 1 ]]; then > die "${FUNCNAME}() requires 1 argument"; > fi; > if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then > echo "CPython"; > else > if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then > echo "Jython"; > else > die "${FUNCNAME}(): Unrecognized Python ABI '$1'"; > fi; > fi >} >_python_implementation () >{ > if [[ "${CATEGORY}/${PN}" == "dev-lang/python" ]]; then > return 0; > else > if [[ "${CATEGORY}/${PN}" == "dev-java/jython" ]]; then > return 0; > else > return 1; > fi; > fi >} >_python_initial_sanity_checks () >{ > if [[ "$(declare -p PYTHON_SANITY_CHECKS_EXECUTED 2> /dev/null)" != "declare -- PYTHON_SANITY_CHECKS_EXECUTED="* || " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " && -z "${PYTHON_SKIP_SANITY_CHECKS}" ]]; then > if [[ "$(readlink "${EPREFIX}/usr/bin/python")" != "python-wrapper" ]]; then > eerror "'${EPREFIX}/usr/bin/python' is not valid symlink."; > eerror "Use \`eselect python set \${python_interpreter}\` to fix this problem."; > die "'${EPREFIX}/usr/bin/python' is not valid symlink"; > fi; > if [[ "$(<"${EPREFIX}/usr/bin/python-config")" != *"Gentoo python-config wrapper script"* ]]; then > eerror "'${EPREFIX}/usr/bin/python-config' is not valid script"; > eerror "Use \`eselect python set \${python_interpreter}\` to fix this problem."; > die "'${EPREFIX}/usr/bin/python-config' is not valid script"; > fi; > fi >} >_python_initialize_prefix_variables () >{ > if has "${EAPI:-0}" 0 1 2; then > if [[ -n "${ROOT}" && -z "${EROOT}" ]]; then > EROOT="${ROOT%/}${EPREFIX}/"; > fi; > if [[ -n "${D}" && -z "${ED}" ]]; then > ED="${D%/}${EPREFIX}/"; > fi; > fi >} >_python_package_supporting_installation_for_multiple_python_abis () >{ > if [[ "${EBUILD_PHASE}" == "depend" ]]; then > die "${FUNCNAME}() cannot be used in global scope"; > fi; > if has "${EAPI:-0}" 0 1 2 3 4; then > if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then > return 0; > else > return 1; > fi; > else > die "${FUNCNAME}(): Support for EAPI=\"${EAPI}\" not implemented"; > fi >} >_python_prepare_flags () >{ > local array=() deleted_flag element flags new_value old_flag old_value operator pattern prefix variable; > for variable in CPPFLAGS CFLAGS CXXFLAGS LDFLAGS; > do > eval "_PYTHON_SAVED_${variable}=\"\${!variable}\""; > for prefix in PYTHON_USER_ PYTHON_; > do > if [[ "$(declare -p ${prefix}${variable} 2> /dev/null)" == "declare -a ${prefix}${variable}="* ]]; then > eval "array=(\"\${${prefix}${variable}[@]}\")"; > for element in "${array[@]}"; > do > if [[ "${element}" =~ ^([[:alnum:]]|\.|-|\*|\[|\])+\ (\+|-)\ .+ ]]; then > pattern="${element%% *}"; > element="${element#* }"; > operator="${element%% *}"; > flags="${element#* }"; > if [[ "${PYTHON_ABI}" == ${pattern} ]]; then > if [[ "${operator}" == "+" ]]; then > eval "export ${variable}+=\"\${variable:+ }${flags}\""; > else > if [[ "${operator}" == "-" ]]; then > flags="${flags// / >}"; > old_value="${!variable// / >}"; > new_value=""; > while read old_flag; do > while read deleted_flag; do > if [[ "${old_flag}" == ${deleted_flag} ]]; then > continue 2; > fi; > done <<< "${flags}"; > new_value+="${new_value:+ }${old_flag}"; > done <<< "${old_value}"; > eval "export ${variable}=\"\${new_value}\""; > fi; > fi; > fi; > else > die "Element '${element}' of ${prefix}${variable} array has invalid syntax"; > fi; > done; > else > if [[ -n "$(declare -p ${prefix}${variable} 2> /dev/null)" ]]; then > die "${prefix}${variable} should be indexed array"; > fi; > fi; > done; > done >} >_python_restore_flags () >{ > local variable; > for variable in CPPFLAGS CFLAGS CXXFLAGS LDFLAGS; > do > eval "${variable}=\"\${_PYTHON_SAVED_${variable}}\""; > unset _PYTHON_SAVED_${variable}; > done >} >_python_set_color_variables () >{ > if [[ "${PYTHON_COLORS}" != "0" && "${NOCOLOR:-false}" =~ ^(false|no)$ ]]; then > _BOLD='[1m'; > _RED='[1;31m'; > _GREEN='[1;32m'; > _BLUE='[1;34m'; > _CYAN='[1;36m'; > _NORMAL='[0m'; > else > _BOLD=; > _RED=; > _GREEN=; > _BLUE=; > _CYAN=; > _NORMAL=; > fi >} >_python_test_hook () >{ > if [[ "$#" -ne 1 ]]; then > die "${FUNCNAME}() requires 1 argument"; > fi; > if _python_package_supporting_installation_for_multiple_python_abis && [[ "$(type -t "${FUNCNAME[3]}_$1_hook")" == "function" ]]; then > "${FUNCNAME[3]}_$1_hook"; > fi >} >_unpack_tar () >{ > if [ "${y}" == "tar" ]; then > $1 -dc "$srcdir$x" | tar xof -; > assert "$myfail"; > else > $1 -dc "${srcdir}${x}" > ${x%.*} || die "$myfail"; > fi >} >bashrc_has () >{ > [[ " ${*:2} " == *" $1 "* ]] >} >create_ml_includes () >{ > local dest=$1; > shift; > local basedirs=$(create_ml_includes-listdirs "$@"); > create_ml_includes-makedestdirs ${dest} ${basedirs}; > local file; > for file in $(create_ml_includes-allfiles ${basedirs}); > do > ( echo "/* Autogenerated by create_ml_includes() in multilib.eclass */"; > local dir; > for dir in ${basedirs}; > do > if [[ -f ${D}/${dir}/${file} ]]; then > echo ""; > local sym=$(create_ml_includes-sym_for_dir ${dir} "$@"); > if [[ ${sym/=} != "${sym}" ]]; then > echo "#if ${sym}"; > else > if [[ ${sym::1} == "!" ]]; then > echo "#ifndef ${sym:1}"; > else > echo "#ifdef ${sym}"; > fi; > fi; > echo "# include <$(create_ml_includes-absolute ${dir}/${file})>"; > echo "#endif /* ${sym} */"; > fi; > done ) > "${D}/${dest}/${file}"; > done >} >create_ml_includes-absolute () >{ > local dst="$(create_ml_includes-tidy_path $1)"; > dst=(${dst//\// }); > local i; > for ((i=0; i<${#dst[*]}; i++)) > do > [ "${dst[i]}" == "include" ] && break; > done; > local strip_upto=$i; > for ((i=strip_upto+1; i<${#dst[*]}-1; i++)) > do > echo -n ${dst[i]}/; > done; > echo -n ${dst[i]} >} >create_ml_includes-allfiles () >{ > [[ -z ${ED} ]] && local ED=${D}; > local basedir file; > for basedir in "$@"; > do > for file in $(find "${ED}"/${basedir} -type f); > do > echo ${file/${ED}\/${basedir}\//}; > done; > done | sort | uniq >} >create_ml_includes-listdirs () >{ > local dirs; > local data; > for data in "$@"; > do > dirs="${dirs} ${data/*:/}"; > done; > echo ${dirs:1} >} >create_ml_includes-makedestdirs () >{ > local dest=$1; > shift; > local basedirs=$@; > [[ -z ${ED} ]] && local ED=${D}; > dodir ${dest}; > local basedir; > for basedir in ${basedirs}; > do > local dir; > for dir in $(find "${ED}"/${basedir} -type d); > do > dodir ${dest}/${dir/${ED}\/${basedir}/}; > done; > done >} >create_ml_includes-sym_for_dir () >{ > local dir=$1; > shift; > local data; > for data in "$@"; > do > if [[ ${data} == *:${dir} ]]; then > echo ${data/:*/}; > return 0; > fi; > done; > echo "Shouldn't be here -- create_ml_includes-sym_for_dir $1 $@"; > exit 1 >} >create_ml_includes-tidy_path () >{ > local removed=$1; > if [ -n "${removed}" ]; then > while [ "${removed}" != "${removed/\/\//\/}" ]; do > removed=${removed/\/\//\/}; > done; > while [ "${removed}" != "${removed//\/.\//\/}" ]; do > removed=${removed//\/.\//\/}; > done; > [ "${removed##*/}" = "." ] && removed=${removed%/*}; > while [ "${removed}" != "${removed//\/..\/}" ]; do > local p1="${removed%%\/..\/*}"; > local p2="${removed#*\/..\/}"; > removed="${p1%\/*}/${p2}"; > done; > [ "${removed##*/}" = ".." ] && removed=${removed%/*/*}; > [ "${removed##*/}" = "" ] && removed=${removed%/*}; > echo ${removed}; > fi >} >distutils_pkg_postinst () >{ > if [[ "${EBUILD_PHASE}" != "postinst" ]]; then > die "${FUNCNAME}() can be used only in pkg_postinst() phase"; > fi; > _python_initialize_prefix_variables; > local pylibdir pymod; > if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then > for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"/usr/share/jython-*/Lib; > do > if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then > PYTHON_MODNAME="${PN}"; > fi; > done; > fi; > if [[ -n "${PYTHON_MODNAME}" ]]; then > if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then > python_mod_optimize ${PYTHON_MODNAME}; > else > for pymod in ${PYTHON_MODNAME}; > do > python_mod_optimize "$(python_get_sitedir)/${pymod}"; > done; > fi; > fi >} >distutils_pkg_postrm () >{ > if [[ "${EBUILD_PHASE}" != "postrm" ]]; then > die "${FUNCNAME}() can be used only in pkg_postrm() phase"; > fi; > _python_initialize_prefix_variables; > local pylibdir pymod; > if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then > for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"/usr/share/jython-*/Lib; > do > if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then > PYTHON_MODNAME="${PN}"; > fi; > done; > fi; > if [[ -n "${PYTHON_MODNAME}" ]]; then > if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then > python_mod_cleanup ${PYTHON_MODNAME}; > else > for pymod in ${PYTHON_MODNAME}; > do > for pylibdir in "${EROOT}"usr/$(get_libdir)/python*; > do > if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then > python_mod_cleanup "${pylibdir#${EROOT%/}}/site-packages/${pymod}"; > fi; > done; > done; > fi; > fi >} >distutils_python_tkinter () >{ > eerror "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()."; > die "${FUNCNAME}() is banned" >} >distutils_python_version () >{ > eerror "Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables."; > die "${FUNCNAME}() is banned" >} >distutils_src_compile () >{ > if [[ "${EBUILD_PHASE}" != "compile" ]]; then > die "${FUNCNAME}() can be used only in src_compile() phase"; > fi; > _python_set_color_variables; > if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then > function distutils_building () > { > _distutils_hook pre; > local setup_file; > for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; > do > echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL}; > "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@" || return "$?"; > done; > _distutils_hook post > }; > python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@"; > else > local setup_file; > for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; > do > echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"${_NORMAL}; > "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"; > done; > fi >} >distutils_src_install () >{ > if [[ "${EBUILD_PHASE}" != "install" ]]; then > die "${FUNCNAME}() can be used only in src_install() phase"; > fi; > _python_initialize_prefix_variables; > _python_set_color_variables; > if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then > if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge 4 ]]; then > declare -A wrapper_scripts=(); > function rename_scripts_with_versioned_shebangs () > { > if [[ -d "${ED}usr/bin" ]]; then > cd "${ED}usr/bin"; > local nonversioned_file file; > for file in *; > do > if [[ -f "${file}" && ! "${file}" =~ [[:digit:]]+\.[[:digit:]](-jython)?+$ && "$(head -n1 "${file}")" =~ ^'#!'.*(python|jython-)[[:digit:]]+\.[[:digit:]]+ ]]; then > for nonversioned_file in "${DISTUTILS_NONVERSIONED_PYTHON_SCRIPTS[@]}"; > do > [[ "${nonversioned_file}" == "/usr/bin/${file}" ]] && continue 2; > done; > mv "${file}" "${file}-${PYTHON_ABI}" || die "Renaming of '${file}' failed"; > wrapper_scripts+=(["${ED}usr/bin/${file}"]=); > fi; > done; > fi > }; > fi; > function distutils_installation () > { > _distutils_hook pre; > local setup_file; > for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; > do > echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --root="${D}" --no-compile "$@"${_NORMAL}; > "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --root="${D}" --no-compile "$@" || return "$?"; > done; > if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge 4 ]]; then > rename_scripts_with_versioned_shebangs; > fi; > _distutils_hook post > }; > python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_installation "$@"; > if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${#wrapper_scripts[@]}" -ne 0 && "${BASH_VERSINFO[0]}" -ge 4 ]]; then > python_generate_wrapper_scripts "${!wrapper_scripts[@]}"; > fi; > unset wrapper_scripts; > else > python_need_rebuild; > local setup_file; > for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; > do > echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"${_NORMAL}; > "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"; > done; > fi; > if [[ -e "${ED}usr/local" ]]; then > die "Illegal installation into /usr/local"; > fi; > local default_docs; > default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS MANIFEST* NEWS PKG-INFO README* TODO"; > local doc; > for doc in ${default_docs}; > do > [[ -s "${doc}" ]] && dodoc "${doc}"; > done; > if [[ -n "${DOCS}" ]]; then > dodoc ${DOCS} || die "dodoc failed"; > fi >} >distutils_src_prepare () >{ > if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then > die "${FUNCNAME}() can be used only in src_prepare() phase"; > fi; > local ez_setup_existence="0"; > [[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence="1"; > rm -fr ez_setup*; > if [[ "${ez_setup_existence}" == "1" ]]; then > echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py; > fi; > local distribute_setup_existence="0"; > [[ -d distribute_setup || -f distribute_setup.py ]] && distribute_setup_existence="1"; > rm -fr distribute_setup*; > if [[ "${distribute_setup_existence}" == "1" ]]; then > echo "def use_setuptools(*args, **kwargs): pass" > distribute_setup.py; > fi; > if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then > python_copy_sources; > fi >} >distutils_src_test () >{ > if [[ "${EBUILD_PHASE}" != "test" ]]; then > die "${FUNCNAME}() can be used only in src_test() phase"; > fi; > _python_set_color_variables; > if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then > if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then > function distutils_testing () > { > _distutils_hook pre; > local setup_file; > for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; > do > echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@"${_NORMAL}; > PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@" || return "$?"; > done; > _distutils_hook post > }; > python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@"; > else > local setup_file; > for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; > do > echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL}; > PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed"; > done; > fi; > else > if [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then > _distutils_src_test_hook nosetests; > python_execute_nosetests -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"; > else > if [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then > _distutils_src_test_hook py.test; > python_execute_py.test -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"; > else > if [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then > local trial_arguments; > if [[ "${DISTUTILS_SRC_TEST}" == "trial "* ]]; then > trial_arguments="${DISTUTILS_SRC_TEST#trial }"; > else > trial_arguments="${PN}"; > fi; > _distutils_src_test_hook trial; > python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- ${trial_arguments} "$@"; > else > die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"; > fi; > fi; > fi; > fi >} >distutils_src_unpack () >{ > if ! has "${EAPI:-0}" 0 1; then > die "${FUNCNAME}() cannot be used in this EAPI"; > fi; > if [[ "${EBUILD_PHASE}" != "unpack" ]]; then > die "${FUNCNAME}() can be used only in src_unpack() phase"; > fi; > unpack ${A}; > cd "${S}"; > distutils_src_prepare >} >dyn_pretend () >{ > ebuild_phase_with_hooks pkg_pretend >} >filter_invalid_flags () >{ > local flag broken_flags; > eval broken_flags=($(get_broken_flags $(getPROG CC gcc) c ${CFLAGS})); > for flag in "${broken_flags[@]}"; > do > ewarn "Filtering out invalid CFLAG \"${flag}\""; > CFLAGS="$(remove_flag "${flag}" ${CFLAGS})"; > done; > eval broken_flags=($(get_broken_flags $(getPROG CXX g++) c++ ${CXXFLAGS})); > for flag in "${broken_flags[@]}"; > do > ewarn "Filtering out invalid CXXFLAG \"${flag}\""; > CXXFLAGS="$(remove_flag "${flag}" ${CXXFLAGS})"; > done >} >gcc-fullversion () >{ > $(tc-getCC "$@") -dumpversion >} >gcc-major-version () >{ > gcc-version "$@" | cut -f1 -d. >} >gcc-micro-version () >{ > gcc-fullversion "$@" | cut -f3 -d. | cut -f1 -d- >} >gcc-minor-version () >{ > gcc-version "$@" | cut -f2 -d. >} >gcc-specs-directive () >{ > local directive subdname subdirective; > directive="$(_gcc-specs-directive_raw $1)"; > while [[ ${directive} == *%\(*\)* ]]; do > subdname=${directive/*%\(}; > subdname=${subdname/\)*}; > subdirective="$(_gcc-specs-directive_raw ${subdname})"; > directive="${directive//\%(${subdname})/${subdirective}}"; > done; > echo "${directive}"; > return 0 >} >gcc-specs-nostrict () >{ > local directive; > directive=$(gcc-specs-directive cc1); > return $([[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]) >} >gcc-specs-now () >{ > local directive; > directive=$(gcc-specs-directive link_command); > return $([[ "${directive/\{!nonow:}" != "${directive}" ]]) >} >gcc-specs-pie () >{ > local directive; > directive=$(gcc-specs-directive cc1); > return $([[ "${directive/\{!nopie:}" != "${directive}" ]]) >} >gcc-specs-relro () >{ > local directive; > directive=$(gcc-specs-directive link_command); > return $([[ "${directive/\{!norelro:}" != "${directive}" ]]) >} >gcc-specs-ssp () >{ > local directive; > directive=$(gcc-specs-directive cc1); > return $([[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]) >} >gcc-specs-ssp-to-all () >{ > local directive; > directive=$(gcc-specs-directive cc1); > return $([[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]) >} >gcc-version () >{ > gcc-fullversion "$@" | cut -f1,2 -d. >} >gen_usr_ldscript () >{ > local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname); > [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/; > tc-is-static-only && return; > dodir /usr/${libdir}; > if [[ $1 == "-a" ]]; then > auto=true; > shift; > dodir /${libdir}; > fi; > output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p'); > [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"; > for lib in "$@"; > do > local tlib; > if ${auto}; then > lib="lib${lib}${suffix}"; > else > [[ -r ${ED}/${libdir}/${lib} ]] || continue; > fi; > case ${CTARGET:-${CHOST}} in > *-darwin*) > if ${auto}; then > tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib}); > else > tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib}); > fi; > [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}"; > tlib=${tlib##*/}; > if ${auto}; then > mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die; > if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then > mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die; > fi; > rm -f "${ED}"/${libdir}/${lib}; > fi; > if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then > chmod u+w "${ED}${libdir}/${tlib}"; > local nowrite=yes; > fi; > install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "install_name_tool failed"; > [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}"; > pushd "${ED}/usr/${libdir}" > /dev/null; > ln -snf "../../${libdir}/${tlib}" "${lib}"; > popd > /dev/null > ;; > *-aix* | *-irix* | *64*-hpux* | *-interix* | *-winnt*) > if ${auto}; then > mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die; > tlib=$(readlink "${ED}"/${libdir}/${lib}); > tlib=${tlib##*/}; > if [[ -z ${tlib} ]]; then > tlib=${lib}; > else > rm -f "${ED}"/${libdir}/${lib}; > fi; > else > tlib=${lib}; > fi; > pushd "${ED}/usr/${libdir}" > /dev/null; > ln -snf "../../${libdir}/${tlib}" "${lib}"; > popd > /dev/null > ;; > hppa*-hpux*) > if ${auto}; then > tlib=$(chatr "${ED}"/usr/${libdir}/${lib} | sed -n '/internal name:/{n;s/^ *//;p;q}'); > [[ -z ${tlib} ]] && tlib=${lib}; > tlib=${tlib##*/}; > mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die; > if [[ ${tlib} != ${lib}* ]]; then > mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die; > fi; > [[ ${tlib} != ${lib} ]] && rm -f "${ED}"/${libdir}/${lib}; > else > tlib=$(chatr "${ED}"/${libdir}/${lib} | sed -n '/internal name:/{n;s/^ *//;p;q}'); > [[ -z ${tlib} ]] && tlib=${lib}; > tlib=${tlib##*/}; > fi; > pushd "${ED}"/usr/${libdir} > /dev/null; > ln -snf "../../${libdir}/${tlib}" "${lib}"; > [[ ${tlib} != ${lib} ]] && ln -snf "../../${libdir}/${tlib}" "${tlib}"; > popd > /dev/null > ;; > *) > if ${auto}; then > tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib}); > [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}"; > mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die; > if [[ ${tlib} != ${lib}* ]]; then > mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die; > fi; > rm -f "${ED}"/${libdir}/${lib}; > else > tlib=${lib}; > fi; > cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT >/* GNU ld script > Since Gentoo has critical dynamic libraries in /lib, and the static versions > in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we > run into linking problems. This "fake" dynamic lib is a linker script that > redirects the linker to the real lib. And yes, this works in the cross- > compiling scenario as the sysroot-ed linker will prepend the real path. > > See bug http://bugs.gentoo.org/4411 for more info. > */ >${output_format} >GROUP ( ${EPREFIX}/${libdir}/${tlib} ) >END_LDSCRIPT > > ;; > esac > fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}"; > done >} >getPROG () >{ > local var=$1 prog=$2; > if [[ -n ${!var} ]]; then > echo "${!var}"; > return 0; > fi; > local search=; > [[ -n $3 ]] && search=$(type -p "$3-${prog}"); > [[ -z ${search} && -n ${CHOST} ]] && search=$(type -p "${CHOST}-${prog}"); > [[ -n ${search} ]] && prog=${search##*/}; > export ${var}=${prog}; > echo "${!var}" >} >get_abi_ASFLAGS () >{ > get_abi_var ASFLAGS "$@" >} >get_abi_CDEFINE () >{ > get_abi_var CDEFINE "$@" >} >get_abi_CFLAGS () >{ > get_abi_var CFLAGS "$@" >} >get_abi_CHOST () >{ > get_abi_var CHOST "$@" >} >get_abi_CTARGET () >{ > get_abi_var CTARGET "$@" >} >get_abi_FAKE_TARGETS () >{ > get_abi_var FAKE_TARGETS "$@" >} >get_abi_LDFLAGS () >{ > get_abi_var LDFLAGS "$@" >} >get_abi_LIBDIR () >{ > get_abi_var LIBDIR "$@" >} >get_abi_var () >{ > local flag=$1; > local abi; > if [ $# -gt 1 ]; then > abi=${2}; > else > if [ -n "${ABI}" ]; then > abi=${ABI}; > else > if [ -n "${DEFAULT_ABI}" ]; then > abi=${DEFAULT_ABI}; > else > abi="default"; > fi; > fi; > fi; > local var="${flag}_${abi}"; > echo ${!var} >} >get_all_abis () >{ > local order=""; > if [[ -z ${MULTILIB_ABIS} ]]; then > echo "default"; > return 0; > fi; > for x in ${MULTILIB_ABIS}; > do > if [[ ${x} != ${DEFAULT_ABI} ]]; then > order="${order:+${order} }${x}"; > fi; > done; > order="${order:+${order} }${DEFAULT_ABI}"; > echo ${order}; > return 0 >} >get_all_libdirs () >{ > local libdirs="lib"; > local abi; > local dir; > for abi in ${MULTILIB_ABIS}; > do > [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})"; > done; > echo "${libdirs}" >} >get_broken_flags () >{ > local myprog="${1}" lang="${2}"; > shift 2; > echo 'main(){}' | LC_ALL=C ${myprog} ${@} -x ${lang} -o /dev/null - 2>&1 | egrep "unrecognized .*option" | egrep -o -- '('\''|\"|`)-.*' | sed -r 's/('\''|`|")//g; s/^/"/; s/$/"/'; > echo 'main(){}' | LC_ALL=C ${myprog} ${@} -x ${lang} -o /dev/null - 2>&1 | egrep "unrecognised debug output" | egrep -o -- '('\''|\"|`).*' | sed -r 's/('\''|`|")//g; s/^/"-g/; s/$/"/' >} >get_install_abis () >{ > local order=""; > if [[ -z ${MULTILIB_ABIS} ]]; then > echo "default"; > return 0; > fi; > if [[ ${EMULTILIB_PKG} == "true" ]]; then > for x in ${MULTILIB_ABIS}; > do > if [[ ${x} != "${DEFAULT_ABI}" ]]; then > hasq ${x} ${ABI_DENY} || ordera="${ordera} ${x}"; > fi; > done; > hasq ${DEFAULT_ABI} ${ABI_DENY} || order="${ordera} ${DEFAULT_ABI}"; > if [[ -n ${ABI_ALLOW} ]]; then > local ordera=""; > for x in ${order}; > do > if hasq ${x} ${ABI_ALLOW}; then > ordera="${ordera} ${x}"; > fi; > done; > order=${ordera}; > fi; > else > order=${DEFAULT_ABI}; > fi; > if [[ -z ${order} ]]; then > die "The ABI list is empty. Are you using a proper multilib profile? Perhaps your USE flags or MULTILIB_ABIS are too restrictive for this package."; > fi; > echo ${order}; > return 0 >} >get_libdir () >{ > local CONF_LIBDIR; > if [ -n "${CONF_LIBDIR_OVERRIDE}" ]; then > echo ${CONF_LIBDIR_OVERRIDE}; > else > get_abi_LIBDIR; > fi >} >get_libdir_override () >{ > if has_multilib_profile; then > eerror "get_libdir_override called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@gentoo.org"; > exit 1; > fi; > CONF_LIBDIR="$1"; > CONF_LIBDIR_OVERRIDE="$1"; > LIBDIR_default="$1" >} >get_libname () >{ > local libname; > local ver=$1; > case ${CHOST} in > *-cygwin | mingw* | *-mingw*) > libname="dll" > ;; > *-darwin*) > libname="dylib" > ;; > *-mint*) > libname="irrelevant" > ;; > hppa*-hpux*) > libname="sl" > ;; > *) > libname="so" > ;; > esac; > if [[ -z $* ]]; then > echo ".${libname}"; > else > for ver in "$@"; > do > case ${CHOST} in > *-darwin*) > echo ".${ver}.${libname}" > ;; > *-mint*) > echo ".${libname}" > ;; > *) > echo ".${libname}.${ver}" > ;; > esac; > done; > fi >} >get_ml_incdir () >{ > local dir=/usr/include; > if [[ $# -gt 0 ]]; then > incdir=$1; > shift; > fi; > if [[ -z "${MULTILIB_ABIS}" ]]; then > echo ${incdir}; > return 0; > fi; > local abi=${ABI-${DEFAULT_ABI}}; > if [[ $# -gt 0 ]]; then > abi=$1; > shift; > fi; > if [[ -d "${dir}/gentoo-multilib/${abi}" ]]; then > echo ${dir}/gentoo-multilib/${abi}; > else > echo ${dir}; > fi >} >get_modname () >{ > local modname; > local ver=$1; > case ${CHOST} in > *-darwin*) > modname="bundle" > ;; > *) > modname="so" > ;; > esac; > echo ".${modname}" >} >get_multilibdir () >{ > if has_multilib_profile; then > eerror "get_multilibdir called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@gentoo.org"; > exit 1; > fi; > echo ${CONF_MULTILIBDIR:=lib32} >} >has_multilib_profile () >{ > [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ] >} >is_final_abi () >{ > has_multilib_profile || return 0; > local ALL_ABIS=$(get_install_abis); > local LAST_ABI=${ALL_ABIS/* /}; > [[ ${LAST_ABI} == ${ABI} ]] >} >multilib_env () >{ > local CTARGET=${1:-${CTARGET}}; > case ${CTARGET} in > x86_64*) > export CFLAGS_x86=${CFLAGS_x86--m32}; > export CHOST_x86=${CTARGET/x86_64/i686}; > export CTARGET_x86=${CHOST_x86}; > export CDEFINE_x86="__i386__"; > export LIBDIR_x86="lib"; > export CFLAGS_amd64=${CFLAGS_amd64--m64}; > export CHOST_amd64=${CTARGET}; > export CTARGET_amd64=${CHOST_amd64}; > export CDEFINE_amd64="__x86_64__"; > export LIBDIR_amd64="lib64"; > export MULTILIB_ABIS="amd64 x86"; > export DEFAULT_ABI="amd64" > ;; > mips64*) > export CFLAGS_o32=${CFLAGS_o32--mabi=32}; > export CHOST_o32=${CTARGET/mips64/mips}; > export CTARGET_o32=${CHOST_o32}; > export CDEFINE_o32="_MIPS_SIM == _ABIO32"; > export LIBDIR_o32="lib"; > export CFLAGS_n32=${CFLAGS_n32--mabi=n32}; > export CHOST_n32=${CTARGET}; > export CTARGET_n32=${CHOST_n32}; > export CDEFINE_n32="_MIPS_SIM == _ABIN32"; > export LIBDIR_n32="lib32"; > export CFLAGS_n64=${CFLAGS_n64--mabi=64}; > export CHOST_n64=${CTARGET}; > export CTARGET_n64=${CHOST_n64}; > export CDEFINE_n64="_MIPS_SIM == _ABI64"; > export LIBDIR_n64="lib64"; > export MULTILIB_ABIS="n64 n32 o32"; > export DEFAULT_ABI="n32" > ;; > powerpc64*) > export CFLAGS_ppc=${CFLAGS_ppc--m32}; > export CHOST_ppc=${CTARGET/powerpc64/powerpc}; > export CTARGET_ppc=${CHOST_ppc}; > export CDEFINE_ppc="!__powerpc64__"; > export LIBDIR_ppc="lib"; > export CFLAGS_ppc64=${CFLAGS_ppc64--m64}; > export CHOST_ppc64=${CTARGET}; > export CTARGET_ppc64=${CHOST_ppc64}; > export CDEFINE_ppc64="__powerpc64__"; > export LIBDIR_ppc64="lib64"; > export MULTILIB_ABIS="ppc64 ppc"; > export DEFAULT_ABI="ppc64" > ;; > s390x*) > export CFLAGS_s390=${CFLAGS_s390--m31}; > export CHOST_s390=${CTARGET/s390x/s390}; > export CTARGET_s390=${CHOST_s390}; > export CDEFINE_s390="!__s390x__"; > export LIBDIR_s390="lib"; > export CFLAGS_s390x=${CFLAGS_s390x--m64}; > export CHOST_s390x=${CTARGET}; > export CTARGET_s390x=${CHOST_s390x}; > export CDEFINE_s390x="__s390x__"; > export LIBDIR_s390x="lib64"; > export MULTILIB_ABIS="s390x s390"; > export DEFAULT_ABI="s390x" > ;; > sparc*) > export CFLAGS_sparc32=${CFLAGS_sparc32}; > export CHOST_sparc32=${CTARGET/sparc64/sparc}; > export CTARGET_sparc32=${CHOST_sparc32}; > export CDEFINE_sparc32="!__arch64__"; > export LIBDIR_sparc32="lib"; > export CFLAGS_sparc64=${CFLAGS_sparc64--m64}; > export CHOST_sparc64=${CTARGET}; > export CTARGET_sparc64=${CHOST_sparc64}; > export CDEFINE_sparc64="__arch64__"; > export LIBDIR_sparc64="lib64"; > export MULTILIB_ABIS="${MULTILIB_ABIS-sparc64 sparc32}"; > export DEFAULT_ABI="${DEFAULT_ABI-sparc64}" > ;; > *) > export MULTILIB_ABIS="default"; > export DEFAULT_ABI="default" > ;; > esac >} >multilib_toolchain_setup () >{ > local v vv; > export ABI=$1; > if [[ ${ABI} != ${DEFAULT_ABI} ]]; then > if [[ ${DEFAULT_ABI_SAVED} != "true" ]]; then > for v in CHOST CBUILD AS CC CXX LD; > do > export __abi_saved_${v}="${!v}"; > done; > export DEFAULT_ABI_SAVED="true"; > fi; > export CHOST=$(get_abi_CHOST ${DEFAULT_ABI}); > export AS="$(tc-getAS) $(get_abi_ASFLAGS)"; > export CC="$(tc-getCC) $(get_abi_CFLAGS)"; > export CXX="$(tc-getCXX) $(get_abi_CFLAGS)"; > export LD="$(tc-getLD) $(get_abi_LDFLAGS)"; > export CHOST=$(get_abi_CHOST $1); > export CBUILD=$(get_abi_CHOST $1); > else > if [[ ${DEFAULT_ABI_SAVED} == "true" ]]; then > for v in CHOST CBUILD AS CC CXX LD; > do > vv="__abi_saved_${v}"; > export ${v}=${!vv}; > done; > fi; > fi >} >nonfatal () >{ > if has "${EAPI:-0}" 0 1 2 3 3_pre2; then > die "$FUNCNAME() not supported in this EAPI"; > fi; > if [[ $# -lt 1 ]]; then > die "$FUNCNAME(): Missing argument"; > fi; > PORTAGE_NONFATAL=1 "$@" >} >number_abis () >{ > get_install_abis | wc -w >} >pkg_nofetch () >{ > _eapi0_pkg_nofetch "$@" >} >pkg_postinst () >{ > distutils_pkg_postinst "$@" >} >pkg_postrm () >{ > distutils_pkg_postrm "$@" >} >prep_ml_includes () >{ > if [[ $(number_abis) -gt 1 ]]; then > local dir; > local dirs; > local base; > if [[ $# -eq 0 ]]; then > dirs=/usr/include; > else > dirs="$@"; > fi; > for dir in ${dirs}; > do > base=${T}/gentoo-multilib/${dir}/gentoo-multilib; > mkdir -p "${base}"; > [[ -d ${base}/${ABI} ]] && rm -rf "${base}/${ABI}"; > mv "${D}/${dir}" "${base}/${ABI}"; > done; > if is_final_abi; then > base=${T}/gentoo-multilib; > pushd "${base}"; > find . | tar -c -T - -f - | tar -x --no-same-owner -f - -C "${D}"; > popd; > set --; > for dir in ${dirs}; > do > set -- "$@" "${dir}"; > local abi; > for abi in $(get_install_abis); > do > set -- "$@" "$(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}"; > done; > create_ml_includes "$@"; > done; > fi; > fi >} >python_clean_installation_image () >{ > _python_check_python_pkg_setup_execution; > _python_initialize_prefix_variables; > local file files=() quiet="0"; > [[ "${EBUILD_PHASE}" != "install" ]] && die "${FUNCNAME}() can be used only in src_install() phase"; > while (($#)); do > case "$1" in > -q | --quiet) > quiet="1" > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > die "${FUNCNAME}(): Invalid usage" > ;; > esac; > shift; > done; > while read -d '' -r file; do > files+=("${file}"); > done < <(find "${ED}" "(" -name "*.py[co]" -o -name "*\$py.class" ")" -type f -print0); > if [[ "${#files[@]}" -gt 0 ]]; then > if [[ "${quiet}" == "0" ]]; then > ewarn "Deleting byte-compiled Python modules needlessly generated by build system:"; > fi; > for file in "${files[@]}"; > do > if [[ "${quiet}" == "0" ]]; then > ewarn " ${file}"; > fi; > rm -f "${file}"; > if [[ "${file%/*}" == *"/__pycache__" ]]; then > rmdir "${file%/*}" 2> /dev/null; > fi; > done; > fi; > function python_clean_sitedirs () > { > if [[ -d "${ED}$(python_get_sitedir)" ]]; then > find "${ED}$(python_get_sitedir)" "(" -name "*.c" -o -name "*.h" -o -name "*.la" ")" -type f -print0 | xargs -0 rm -f; > fi > }; > if _python_package_supporting_installation_for_multiple_python_abis; then > python_execute_function -q python_clean_sitedirs; > else > python_clean_sitedirs; > fi; > unset -f python_clean_sitedirs >} >python_convert_shebangs () >{ > _python_check_python_pkg_setup_execution; > local argument file files=() only_executables="0" python_version quiet="0" recursive="0"; > while (($#)); do > case "$1" in > -r | --recursive) > recursive="1" > ;; > -q | --quiet) > quiet="1" > ;; > -x | --only-executables) > only_executables="1" > ;; > --) > shift; > break > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > break > ;; > esac; > shift; > done; > if [[ "$#" -eq 0 ]]; then > die "${FUNCNAME}(): Missing Python version and files or directories"; > else > if [[ "$#" -eq 1 ]]; then > die "${FUNCNAME}(): Missing files or directories"; > fi; > fi; > python_version="$1"; > shift; > for argument in "$@"; > do > if [[ ! -e "${argument}" ]]; then > die "${FUNCNAME}(): '${argument}' does not exist"; > else > if [[ -f "${argument}" ]]; then > files+=("${argument}"); > else > if [[ -d "${argument}" ]]; then > if [[ "${recursive}" == "1" ]]; then > while read -d '' -r file; do > files+=("${file}"); > done < <(find "${argument}" $([[ "${only_executables}" == "1" ]] && echo -perm /111) -type f -print0); > else > die "${FUNCNAME}(): '${argument}' is not a regular file"; > fi; > else > die "${FUNCNAME}(): '${argument}' is not a regular file or a directory"; > fi; > fi; > fi; > done; > for file in "${files[@]}"; > do > file="${file#./}"; > [[ "${only_executables}" == "1" && ! -x "${file}" ]] && continue; > if [[ "$(head -n1 "${file}")" =~ ^'#!'.*python ]]; then > [[ "$(sed -ne "2p" "${file}")" =~ ^"# Gentoo '".*"' wrapper script generated by python_generate_wrapper_scripts()"$ ]] && continue; > if [[ "${quiet}" == "0" ]]; then > einfo "Converting shebang in '${file}'"; > fi; > sed -e "1s/python\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?/python${python_version}/" -i "${file}" || die "Conversion of shebang in '${file}' failed"; > sed -e '1s/\(^#!\)[[:space:]]*/\1/' -i "${file}" || die "sed '${file}' failed"; > fi; > done >} >python_copy_sources () >{ > _python_check_python_pkg_setup_execution; > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > local dir dirs=() PYTHON_ABI; > if [[ "$#" -eq 0 ]]; then > if [[ "${WORKDIR}" == "${S}" ]]; then > die "${FUNCNAME}() cannot be used with current value of S variable"; > fi; > dirs=("${S%/}"); > else > dirs=("$@"); > fi; > _python_calculate_PYTHON_ABIS; > for PYTHON_ABI in ${PYTHON_ABIS}; > do > for dir in "${dirs[@]}"; > do > cp -pr "${dir}" "${dir}-${PYTHON_ABI}" > /dev/null || die "Copying of sources failed"; > done; > done >} >python_disable_pyc () >{ > _python_check_python_pkg_setup_execution; > if [[ "$#" -ne 0 ]]; then > die "${FUNCNAME}() does not accept arguments"; > fi; > export PYTHONDONTWRITEBYTECODE="1" >} >python_enable_pyc () >{ > _python_check_python_pkg_setup_execution; > if [[ "$#" -ne 0 ]]; then > die "${FUNCNAME}() does not accept arguments"; > fi; > unset PYTHONDONTWRITEBYTECODE >} >python_execute_function () >{ > _python_check_python_pkg_setup_execution; > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > _python_set_color_variables; > local action action_message action_message_template= default_function="0" failure_message failure_message_template= final_ABI="0" function iterated_PYTHON_ABIS nonfatal="0" previous_directory previous_directory_stack previous_directory_stack_length PYTHON_ABI quiet="0" return_code separate_build_dirs="0" source_dir=; > while (($#)); do > case "$1" in > --action-message) > action_message_template="$2"; > shift > ;; > -d | --default-function) > default_function="1" > ;; > --failure-message) > failure_message_template="$2"; > shift > ;; > -f | --final-ABI) > final_ABI="1" > ;; > --nonfatal) > nonfatal="1" > ;; > -q | --quiet) > quiet="1" > ;; > -s | --separate-build-dirs) > separate_build_dirs="1" > ;; > --source-dir) > source_dir="$2"; > shift > ;; > --) > shift; > break > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > break > ;; > esac; > shift; > done; > if [[ -n "${source_dir}" && "${separate_build_dirs}" == 0 ]]; then > die "${FUNCNAME}(): '--source-dir' option can be specified only with '--separate-build-dirs' option"; > fi; > if [[ "${default_function}" == "0" ]]; then > if [[ "$#" -eq 0 ]]; then > die "${FUNCNAME}(): Missing function name"; > fi; > function="$1"; > shift; > if [[ -z "$(type -t "${function}")" ]]; then > die "${FUNCNAME}(): '${function}' function is not defined"; > fi; > else > if has "${EAPI:-0}" 0 1; then > die "${FUNCNAME}(): '--default-function' option cannot be used in this EAPI"; > fi; > if [[ "${EBUILD_PHASE}" == "configure" ]]; then > if has "${EAPI}" 2 3; then > function python_default_function () > { > econf "$@" > }; > else > function python_default_function () > { > nonfatal econf "$@" > }; > fi; > else > if [[ "${EBUILD_PHASE}" == "compile" ]]; then > function python_default_function () > { > emake "$@" > }; > else > if [[ "${EBUILD_PHASE}" == "test" ]]; then > function python_default_function () > { > if emake -j1 -n check &>/dev/null; then > emake -j1 check "$@"; > else > if emake -j1 -n test &>/dev/null; then > emake -j1 test "$@"; > fi; > fi > }; > else > if [[ "${EBUILD_PHASE}" == "install" ]]; then > function python_default_function () > { > emake DESTDIR="${D}" install "$@" > }; > else > die "${FUNCNAME}(): '--default-function' option cannot be used in this ebuild phase"; > fi; > fi; > fi; > fi; > function="python_default_function"; > fi; > if _python_abi-specific_local_scope; then > die "${FUNCNAME}(): Invalid call stack"; > fi; > if [[ "${quiet}" == "0" ]]; then > [[ "${EBUILD_PHASE}" == "setup" ]] && action="Setting up"; > [[ "${EBUILD_PHASE}" == "unpack" ]] && action="Unpacking"; > [[ "${EBUILD_PHASE}" == "prepare" ]] && action="Preparation"; > [[ "${EBUILD_PHASE}" == "configure" ]] && action="Configuration"; > [[ "${EBUILD_PHASE}" == "compile" ]] && action="Building"; > [[ "${EBUILD_PHASE}" == "test" ]] && action="Testing"; > [[ "${EBUILD_PHASE}" == "install" ]] && action="Installation"; > [[ "${EBUILD_PHASE}" == "preinst" ]] && action="Preinstallation"; > [[ "${EBUILD_PHASE}" == "postinst" ]] && action="Postinstallation"; > [[ "${EBUILD_PHASE}" == "prerm" ]] && action="Preuninstallation"; > [[ "${EBUILD_PHASE}" == "postrm" ]] && action="Postuninstallation"; > fi; > _python_calculate_PYTHON_ABIS; > if [[ "${final_ABI}" == "1" ]]; then > iterated_PYTHON_ABIS="$(PYTHON -f --ABI)"; > else > iterated_PYTHON_ABIS="${PYTHON_ABIS}"; > fi; > for PYTHON_ABI in ${iterated_PYTHON_ABIS}; > do > _python_prepare_flags; > if [[ "${quiet}" == "0" ]]; then > if [[ -n "${action_message_template}" ]]; then > action_message="$(eval echo -n "${action_message_template}")"; > else > action_message="${action} of ${CATEGORY}/${PF} with $(python_get_implementation) $(python_get_version)..."; > fi; > echo " ${_GREEN}*${_NORMAL} ${_BLUE}${action_message}${_NORMAL}"; > fi; > if [[ "${separate_build_dirs}" == "1" ]]; then > if [[ -n "${source_dir}" ]]; then > export BUILDDIR="${S}/${source_dir}-${PYTHON_ABI}"; > else > export BUILDDIR="${S}-${PYTHON_ABI}"; > fi; > pushd "${BUILDDIR}" > /dev/null || die "pushd failed"; > else > export BUILDDIR="${S}"; > fi; > previous_directory="$(pwd)"; > previous_directory_stack="$(dirs -p)"; > previous_directory_stack_length="$(dirs -p | wc -l)"; > if ! has "${EAPI}" 0 1 2 3 && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then > EPYTHON="$(PYTHON)" nonfatal "${function}" "$@"; > else > EPYTHON="$(PYTHON)" "${function}" "$@"; > fi; > return_code="$?"; > _python_restore_flags; > if [[ "${return_code}" -ne 0 ]]; then > if [[ -n "${failure_message_template}" ]]; then > failure_message="$(eval echo -n "${failure_message_template}")"; > else > failure_message="${action} failed with $(python_get_implementation) $(python_get_version) in ${function}() function"; > fi; > if [[ "${nonfatal}" == "1" ]]; then > if [[ "${quiet}" == "0" ]]; then > ewarn "${failure_message}"; > fi; > else > if [[ "${final_ABI}" == "0" ]] && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then > if [[ "${EBUILD_PHASE}" != "test" ]] || ! has test-fail-continue ${FEATURES}; then > local enabled_PYTHON_ABIS= other_PYTHON_ABI; > for other_PYTHON_ABI in ${PYTHON_ABIS}; > do > [[ "${other_PYTHON_ABI}" != "${PYTHON_ABI}" ]] && enabled_PYTHON_ABIS+="${enabled_PYTHON_ABIS:+ }${other_PYTHON_ABI}"; > done; > export PYTHON_ABIS="${enabled_PYTHON_ABIS}"; > fi; > if [[ "${quiet}" == "0" ]]; then > ewarn "${failure_message}"; > fi; > if [[ -z "${PYTHON_ABIS}" ]]; then > die "${function}() function failed with all enabled Python ABIs"; > fi; > else > die "${failure_message}"; > fi; > fi; > fi; > if [[ "$(dirs -p | wc -l)" -lt "${previous_directory_stack_length}" ]]; then > die "Directory stack decreased illegally"; > fi; > while [[ "$(dirs -p | wc -l)" -gt "${previous_directory_stack_length}" ]]; do > popd > /dev/null || die "popd failed"; > done; > cd "${previous_directory}"; > if [[ "$(dirs -p)" != "${previous_directory_stack}" ]]; then > die "Directory stack changed illegally"; > fi; > if [[ "${separate_build_dirs}" == "1" ]]; then > popd > /dev/null || die "popd failed"; > fi; > unset BUILDDIR; > done; > if [[ "${default_function}" == "1" ]]; then > unset -f python_default_function; > fi >} >python_execute_nosetests () >{ > _python_check_python_pkg_setup_execution; > _python_set_color_variables; > local PYTHONPATH_template= separate_build_dirs=; > while (($#)); do > case "$1" in > -P | --PYTHONPATH) > PYTHONPATH_template="$2"; > shift > ;; > -s | --separate-build-dirs) > separate_build_dirs="1" > ;; > --) > shift; > break > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > break > ;; > esac; > shift; > done; > function python_test_function () > { > local evaluated_PYTHONPATH; > evaluated_PYTHONPATH="$(eval echo -n "${PYTHONPATH_template}")"; > _python_test_hook pre; > if [[ -n "${evaluated_PYTHONPATH}" ]]; then > echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL}; > PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?"; > else > echo ${_BOLD}nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL}; > nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?"; > fi; > _python_test_hook post > }; > if _python_package_supporting_installation_for_multiple_python_abis; then > python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"; > else > if [[ -n "${separate_build_dirs}" ]]; then > die "${FUNCNAME}(): Invalid usage"; > fi; > python_test_function "$@" || die "Testing failed"; > fi; > unset -f python_test_function >} >python_execute_py.test () >{ > _python_check_python_pkg_setup_execution; > _python_set_color_variables; > local PYTHONPATH_template= separate_build_dirs=; > while (($#)); do > case "$1" in > -P | --PYTHONPATH) > PYTHONPATH_template="$2"; > shift > ;; > -s | --separate-build-dirs) > separate_build_dirs="1" > ;; > --) > shift; > break > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > break > ;; > esac; > shift; > done; > function python_test_function () > { > local evaluated_PYTHONPATH; > evaluated_PYTHONPATH="$(eval echo -n "${PYTHONPATH_template}")"; > _python_test_hook pre; > if [[ -n "${evaluated_PYTHONPATH}" ]]; then > echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@"${_NORMAL}; > PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@" || return "$?"; > else > echo ${_BOLD}py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@"${_NORMAL}; > py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@" || return "$?"; > fi; > _python_test_hook post > }; > if _python_package_supporting_installation_for_multiple_python_abis; then > python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"; > else > if [[ -n "${separate_build_dirs}" ]]; then > die "${FUNCNAME}(): Invalid usage"; > fi; > python_test_function "$@" || die "Testing failed"; > fi; > unset -f python_test_function >} >python_execute_trial () >{ > _python_check_python_pkg_setup_execution; > _python_set_color_variables; > local PYTHONPATH_template= separate_build_dirs=; > while (($#)); do > case "$1" in > -P | --PYTHONPATH) > PYTHONPATH_template="$2"; > shift > ;; > -s | --separate-build-dirs) > separate_build_dirs="1" > ;; > --) > shift; > break > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > break > ;; > esac; > shift; > done; > function python_test_function () > { > local evaluated_PYTHONPATH; > evaluated_PYTHONPATH="$(eval echo -n "${PYTHONPATH_template}")"; > _python_test_hook pre; > if [[ -n "${evaluated_PYTHONPATH}" ]]; then > echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL}; > PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?"; > else > echo ${_BOLD}trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL}; > trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?"; > fi; > _python_test_hook post > }; > if _python_package_supporting_installation_for_multiple_python_abis; then > python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"; > else > if [[ -n "${separate_build_dirs}" ]]; then > die "${FUNCNAME}(): Invalid usage"; > fi; > python_test_function "$@" || die "Testing failed"; > fi; > unset -f python_test_function >} >python_generate_wrapper_scripts () >{ > _python_check_python_pkg_setup_execution; > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > _python_initialize_prefix_variables; > local eselect_python_option file force="0" quiet="0" PYTHON_ABI python2_enabled="0" python3_enabled="0" respect_EPYTHON="0"; > while (($#)); do > case "$1" in > -E | --respect-EPYTHON) > respect_EPYTHON="1" > ;; > -f | --force) > force="1" > ;; > -q | --quiet) > quiet="1" > ;; > --) > shift; > break > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > break > ;; > esac; > shift; > done; > if [[ "$#" -eq 0 ]]; then > die "${FUNCNAME}(): Missing arguments"; > fi; > _python_calculate_PYTHON_ABIS; > for PYTHON_ABI in "${_CPYTHON2_SUPPORTED_ABIS[@]}"; > do > if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then > python2_enabled="1"; > fi; > done; > for PYTHON_ABI in "${_CPYTHON3_SUPPORTED_ABIS[@]}"; > do > if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then > python3_enabled="1"; > fi; > done; > if [[ "${python2_enabled}" == "1" && "${python3_enabled}" == "1" ]]; then > eselect_python_option=; > else > if [[ "${python2_enabled}" == "1" && "${python3_enabled}" == "0" ]]; then > eselect_python_option="--python2"; > else > if [[ "${python2_enabled}" == "0" && "${python3_enabled}" == "1" ]]; then > eselect_python_option="--python3"; > else > die "${FUNCNAME}(): Unsupported environment"; > fi; > fi; > fi; > for file in "$@"; > do > if [[ -f "${file}" && "${force}" == "0" ]]; then > die "${FUNCNAME}(): '$1' already exists"; > fi; > if [[ "${quiet}" == "0" ]]; then > einfo "Generating '${file#${ED%/}}' wrapper script"; > fi; > cat > "${file}" <<EOF >#!/usr/bin/env python ># Gentoo '${file##*/}' wrapper script generated by python_generate_wrapper_scripts() > >import os >import re >import subprocess >import sys > >EPYTHON_re = re.compile(r"^python(\d+\.\d+)$") >python_shebang_re = re.compile(r"^#! *(${EPREFIX}/usr/bin/python|(${EPREFIX})?/usr/bin/env +(${EPREFIX}/usr/bin/)?python)") >python_verification_output_re = re.compile("^GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n$") > >EOF > > if [[ "$?" != "0" ]]; then > die "${FUNCNAME}(): Generation of '$1' failed"; > fi; > if [[ "${respect_EPYTHON}" == "1" ]]; then > cat >> "${file}" <<EOF >EPYTHON = os.environ.get("EPYTHON") >if EPYTHON: > EPYTHON_matched = EPYTHON_re.match(EPYTHON) > if EPYTHON_matched: > PYTHON_ABI = EPYTHON_matched.group(1) > else: > sys.stderr.write("EPYTHON variable has unrecognized value '%s'\n" % EPYTHON) > sys.exit(1) >else: > try: > eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], stdout=subprocess.PIPE) > if eselect_process.wait() != 0: > raise ValueError > except (OSError, ValueError): > sys.stderr.write("Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n") > sys.exit(1) > > EPYTHON = eselect_process.stdout.read() > if not isinstance(EPYTHON, str): > # Python 3 > EPYTHON = EPYTHON.decode() > EPYTHON = EPYTHON.rstrip("\n") > > EPYTHON_matched = EPYTHON_re.match(EPYTHON) > if EPYTHON_matched: > PYTHON_ABI = EPYTHON_matched.group(1) > else: > sys.stderr.write("'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % EPYTHON) > sys.exit(1) >EOF > > if [[ "$?" != "0" ]]; then > die "${FUNCNAME}(): Generation of '$1' failed"; > fi; > else > cat >> "${file}" <<EOF >try: > eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], stdout=subprocess.PIPE) > if eselect_process.wait() != 0: > raise ValueError >except (OSError, ValueError): > sys.stderr.write("Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n") > sys.exit(1) > >EPYTHON = eselect_process.stdout.read() >if not isinstance(EPYTHON, str): > # Python 3 > EPYTHON = EPYTHON.decode() >EPYTHON = EPYTHON.rstrip("\n") > >EPYTHON_matched = EPYTHON_re.match(EPYTHON) >if EPYTHON_matched: > PYTHON_ABI = EPYTHON_matched.group(1) >else: > sys.stderr.write("'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % EPYTHON) > sys.exit(1) >EOF > > if [[ "$?" != "0" ]]; then > die "${FUNCNAME}(): Generation of '$1' failed"; > fi; > fi > cat >> "${file}" <<EOF > >wrapper_script_path = os.path.realpath(sys.argv[0]) >target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI) >os.environ["GENTOO_PYTHON_PROCESS_NAME"] = os.path.basename(sys.argv[0]) >os.environ["GENTOO_PYTHON_WRAPPER_SCRIPT_PATH"] = sys.argv[0] >os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH"] = target_executable_path >if not os.path.exists(target_executable_path): > sys.stderr.write("'%s' does not exist\n" % target_executable_path) > sys.exit(1) > >target_executable = open(target_executable_path, "rb") >target_executable_first_line = target_executable.readline() >if not isinstance(target_executable_first_line, str): > # Python 3 > target_executable_first_line = target_executable_first_line.decode("utf_8", "replace") > >python_shebang_matched = python_shebang_re.match(target_executable_first_line) >target_executable.close() > >if python_shebang_matched: > try: > python_interpreter_path = "${EPREFIX}/usr/bin/%s" % EPYTHON > os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"] = "1" > python_verification_process = subprocess.Popen([python_interpreter_path, "-c", "pass"], stdout=subprocess.PIPE) > del os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"] > if python_verification_process.wait() != 0: > raise ValueError > > python_verification_output = python_verification_process.stdout.read() > if not isinstance(python_verification_output, str): > # Python 3 > python_verification_output = python_verification_output.decode() > > if not python_verification_output_re.match(python_verification_output): > raise ValueError > > os.execv(python_interpreter_path, [python_interpreter_path] + sys.argv) > except: > pass > if "GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION" in os.environ: > del os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"] > >os.execv(target_executable_path, sys.argv) >EOF > > if [[ "$?" != "0" ]]; then > die "${FUNCNAME}(): Generation of '$1' failed"; > fi; > fperms +x "${file#${ED%/}}" || die "fperms '${file}' failed"; > done >} >python_get_implementation () >{ > _python_check_python_pkg_setup_execution; > local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"; > while (($#)); do > case "$1" in > -f | --final-ABI) > final_ABI="1" > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > die "${FUNCNAME}(): Invalid usage" > ;; > esac; > shift; > done; > if [[ "${final_ABI}" == "1" ]]; then > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > PYTHON_ABI="$(PYTHON -f --ABI)"; > else > if _python_package_supporting_installation_for_multiple_python_abis; then > if ! _python_abi-specific_local_scope; then > die "${FUNCNAME}() should be used in ABI-specific local scope"; > fi; > else > PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"; > fi; > fi; > echo "$(_python_get_implementation "${PYTHON_ABI}")" >} >python_get_implementational_package () >{ > _python_check_python_pkg_setup_execution; > local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"; > while (($#)); do > case "$1" in > -f | --final-ABI) > final_ABI="1" > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > die "${FUNCNAME}(): Invalid usage" > ;; > esac; > shift; > done; > if [[ "${final_ABI}" == "1" ]]; then > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > PYTHON_ABI="$(PYTHON -f --ABI)"; > else > if _python_package_supporting_installation_for_multiple_python_abis; then > if ! _python_abi-specific_local_scope; then > die "${FUNCNAME}() should be used in ABI-specific local scope"; > fi; > else > PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"; > fi; > fi; > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then > echo "dev-lang/python:${PYTHON_ABI}"; > else > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then > echo "dev-java/jython:${PYTHON_ABI%-jython}"; > fi; > fi >} >python_get_includedir () >{ > _python_check_python_pkg_setup_execution; > local base_path="0" final_ABI="0" prefix PYTHON_ABI="${PYTHON_ABI}"; > while (($#)); do > case "$1" in > -b | --base-path) > base_path="1" > ;; > -f | --final-ABI) > final_ABI="1" > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > die "${FUNCNAME}(): Invalid usage" > ;; > esac; > shift; > done; > if [[ "${base_path}" == "0" ]]; then > prefix="/"; > fi; > if [[ "${final_ABI}" == "1" ]]; then > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > PYTHON_ABI="$(PYTHON -f --ABI)"; > else > if _python_package_supporting_installation_for_multiple_python_abis; then > if ! _python_abi-specific_local_scope; then > die "${FUNCNAME}() should be used in ABI-specific local scope"; > fi; > else > PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"; > fi; > fi; > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then > echo "${prefix}usr/include/python${PYTHON_ABI}"; > else > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then > echo "${prefix}usr/share/jython-${PYTHON_ABI%-jython}/Include"; > fi; > fi >} >python_get_libdir () >{ > _python_check_python_pkg_setup_execution; > local base_path="0" final_ABI="0" prefix PYTHON_ABI="${PYTHON_ABI}"; > while (($#)); do > case "$1" in > -b | --base-path) > base_path="1" > ;; > -f | --final-ABI) > final_ABI="1" > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > die "${FUNCNAME}(): Invalid usage" > ;; > esac; > shift; > done; > if [[ "${base_path}" == "0" ]]; then > prefix="/"; > fi; > if [[ "${final_ABI}" == "1" ]]; then > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > PYTHON_ABI="$(PYTHON -f --ABI)"; > else > if _python_package_supporting_installation_for_multiple_python_abis; then > if ! _python_abi-specific_local_scope; then > die "${FUNCNAME}() should be used in ABI-specific local scope"; > fi; > else > PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"; > fi; > fi; > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then > echo "${prefix}usr/$(get_libdir)/python${PYTHON_ABI}"; > else > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then > echo "${prefix}usr/share/jython-${PYTHON_ABI%-jython}/Lib"; > fi; > fi >} >python_get_library () >{ > _python_check_python_pkg_setup_execution; > local base_path="0" final_ABI="0" linker_option="0" prefix PYTHON_ABI="${PYTHON_ABI}"; > while (($#)); do > case "$1" in > -b | --base-path) > base_path="1" > ;; > -f | --final-ABI) > final_ABI="1" > ;; > -l | --linker-option) > linker_option="1" > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > die "${FUNCNAME}(): Invalid usage" > ;; > esac; > shift; > done; > if [[ "${base_path}" == "0" ]]; then > prefix="/"; > fi; > if [[ "${base_path}" == "1" && "${linker_option}" == "1" ]]; then > die "${FUNCNAME}(): '--base-path' and '--linker-option' options cannot be specified simultaneously"; > fi; > if [[ "${final_ABI}" == "1" ]]; then > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > PYTHON_ABI="$(PYTHON -f --ABI)"; > else > if _python_package_supporting_installation_for_multiple_python_abis; then > if ! _python_abi-specific_local_scope; then > die "${FUNCNAME}() should be used in ABI-specific local scope"; > fi; > else > PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"; > fi; > fi; > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then > if [[ "${linker_option}" == "1" ]]; then > echo "-lpython${PYTHON_ABI}"; > else > echo "${prefix}usr/$(get_libdir)/libpython${PYTHON_ABI}$(get_libname)"; > fi; > else > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then > die "${FUNCNAME}(): Jython does not have shared library"; > fi; > fi >} >python_get_sitedir () >{ > _python_check_python_pkg_setup_execution; > local final_ABI="0" options=(); > while (($#)); do > case "$1" in > -b | --base-path) > options+=("$1") > ;; > -f | --final-ABI) > final_ABI="1"; > options+=("$1") > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > die "${FUNCNAME}(): Invalid usage" > ;; > esac; > shift; > done; > if [[ "${final_ABI}" == "1" ]]; then > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > else > if _python_package_supporting_installation_for_multiple_python_abis && ! _python_abi-specific_local_scope; then > die "${FUNCNAME}() should be used in ABI-specific local scope"; > fi; > fi; > echo "$(python_get_libdir "${options[@]}")/site-packages" >} >python_get_version () >{ > _python_check_python_pkg_setup_execution; > local final_ABI="0" full="0" major="0" minor="0" micro="0" python_command; > while (($#)); do > case "$1" in > -f | --final-ABI) > final_ABI="1" > ;; > --full) > full="1" > ;; > --major) > major="1" > ;; > --minor) > minor="1" > ;; > --micro) > micro="1" > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > die "${FUNCNAME}(): Invalid usage" > ;; > esac; > shift; > done; > if [[ "$((${full} + ${major} + ${minor} + ${micro}))" -gt 1 ]]; then > die "${FUNCNAME}(): '--full', '--major', '--minor' or '--micro' options cannot be specified simultaneously"; > fi; > if [[ "${full}" == "1" ]]; then > python_command="from sys import version_info; print('.'.join(str(x) for x in version_info[:3]))"; > else > if [[ "${major}" == "1" ]]; then > python_command="from sys import version_info; print(version_info[0])"; > else > if [[ "${minor}" == "1" ]]; then > python_command="from sys import version_info; print(version_info[1])"; > else > if [[ "${micro}" == "1" ]]; then > python_command="from sys import version_info; print(version_info[2])"; > else > if [[ -n "${PYTHON_ABI}" && "${final_ABI}" == "0" ]]; then > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then > echo "${PYTHON_ABI}"; > else > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then > echo "${PYTHON_ABI%-jython}"; > fi; > fi; > return; > fi; > python_command="from sys import version_info; print('.'.join(str(x) for x in version_info[:2]))"; > fi; > fi; > fi; > fi; > if [[ "${final_ABI}" == "1" ]]; then > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > "$(PYTHON -f)" -c "${python_command}"; > else > if _python_package_supporting_installation_for_multiple_python_abis && ! _python_abi-specific_local_scope; then > die "${FUNCNAME}() should be used in ABI-specific local scope"; > fi; > "$(PYTHON ${PYTHON_ABI})" -c "${python_command}"; > fi >} >python_mod_cleanup () >{ > _python_check_python_pkg_setup_execution; > _python_initialize_prefix_variables; > local dir iterated_PYTHON_ABIS PYTHON_ABI="${PYTHON_ABI}" root search_paths=() sitedir; > [[ "${EBUILD_PHASE}" != "postrm" ]] && die "${FUNCNAME}() can be used only in pkg_postrm() phase"; > if _python_package_supporting_installation_for_multiple_python_abis; then > if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then > die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called"; > fi; > iterated_PYTHON_ABIS="${PYTHON_ABIS}"; > else > if has "${EAPI:-0}" 0 1 2 3; then > iterated_PYTHON_ABIS="${PYTHON_ABI:-$(PYTHON --ABI)}"; > else > iterated_PYTHON_ABIS="${PYTHON_ABI}"; > fi; > fi; > root="${EROOT%/}"; > if [[ "$#" -gt 0 ]]; then > if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then > while (($#)); do > if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then > die "${FUNCNAME}(): Invalid argument '$1'"; > else > if ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then > die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"; > else > if [[ "$1" =~ ^/ ]]; then > if _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"; > fi; > search_paths+=("${root}$1"); > else > for PYTHON_ABI in ${iterated_PYTHON_ABIS}; > do > search_paths+=("${root}$(python_get_sitedir)/$1"); > done; > fi; > fi; > fi; > shift; > done; > else > search_paths=("${@#/}"); > search_paths=("${search_paths[@]/#/${root}/}"); > fi; > else > ewarn; > ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"; > ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."; > ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."; > ewarn; > for dir in "${root}"/usr/lib*; > do > if [[ -d "${dir}" && ! -L "${dir}" ]]; then > for sitedir in "${dir}"/python*/site-packages; > do > if [[ -d "${sitedir}" ]]; then > search_paths+=("${sitedir}"); > fi; > done; > fi; > done; > for sitedir in "${root}"/usr/share/jython-*/Lib/site-packages; > do > if [[ -d "${sitedir}" ]]; then > search_paths+=("${sitedir}"); > fi; > done; > fi; > _python_clean_compiled_modules "${search_paths[@]}" >} >python_mod_compile () >{ > if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then > eerror "Use python_mod_optimize() instead of ${FUNCNAME}()."; > die "${FUNCNAME}() cannot be used in this EAPI"; > fi; > _python_initialize_prefix_variables; > _python_set_color_variables; > if [[ "${FUNCNAME[1]}" != "python_mod_optimize" ]]; then > ewarn; > ewarn "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-09-01."; > ewarn "Use python_mod_optimize() instead of ${FUNCNAME}()."; > ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."; > ewarn; > fi; > local f myroot myfiles=(); > [[ "${EBUILD_PHASE}" != "postinst" ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase"; > myroot="${EROOT%/}"; > for f in "$@"; > do > [[ -f "${myroot}/${f}" ]] && myfiles+=("${myroot}/${f}"); > done; > PYTHON_ABI="$(PYTHON --ABI)"; > if ((${#myfiles[@]})); then > "$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}"; > "$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" &>/dev/null; > _python_clean_compiled_modules "${myfiles[@]}"; > else > ewarn "No files to compile!"; > fi >} >python_mod_exists () >{ > eerror "Use USE dependencies and/or has_version() instead of ${FUNCNAME}()."; > die "${FUNCNAME}() is banned" >} >python_mod_optimize () >{ > _python_check_python_pkg_setup_execution; > _python_initialize_prefix_variables; > [[ "${EBUILD_PHASE}" != "postinst" ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase"; > if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then > local dir file iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_absolute_dirs=() site_packages_dirs=() site_packages_absolute_files=() site_packages_files=(); > if _python_package_supporting_installation_for_multiple_python_abis; then > if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then > die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called"; > fi; > iterated_PYTHON_ABIS="${PYTHON_ABIS}"; > else > if has "${EAPI:-0}" 0 1 2 3; then > iterated_PYTHON_ABIS="${PYTHON_ABI:=$(PYTHON --ABI)}"; > else > iterated_PYTHON_ABIS="${PYTHON_ABI}"; > fi; > fi; > root="${EROOT%/}"; > while (($#)); do > case "$1" in > -l | -f | -q) > options+=("$1") > ;; > -d | -x) > options+=("$1" "$2"); > shift > ;; > --) > shift; > break > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > break > ;; > esac; > shift; > done; > if [[ "$#" -eq 0 ]]; then > ewarn; > ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"; > ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."; > ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."; > ewarn; > fi; > while (($#)); do > if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then > die "${FUNCNAME}(): Invalid argument '$1'"; > else > if ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then > die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"; > else > if [[ "$1" =~ ^/ ]]; then > if _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"; > fi; > if [[ -d "${root}$1" ]]; then > other_dirs+=("${root}$1"); > else > if [[ -f "${root}$1" ]]; then > other_files+=("${root}$1"); > else > if [[ -e "${root}$1" ]]; then > eerror "${FUNCNAME}(): '${root}$1' is not a regular file or a directory"; > else > eerror "${FUNCNAME}(): '${root}$1' does not exist"; > fi; > fi; > fi; > else > for PYTHON_ABI in ${iterated_PYTHON_ABIS}; > do > if [[ -d "${root}$(python_get_sitedir)/$1" ]]; then > site_packages_dirs+=("$1"); > break; > else > if [[ -f "${root}$(python_get_sitedir)/$1" ]]; then > site_packages_files+=("$1"); > break; > else > if [[ -e "${root}$(python_get_sitedir)/$1" ]]; then > eerror "${FUNCNAME}(): '$1' is not a regular file or a directory"; > else > eerror "${FUNCNAME}(): '$1' does not exist"; > fi; > fi; > fi; > done; > fi; > fi; > fi; > shift; > done; > options+=("-q"); > for PYTHON_ABI in ${iterated_PYTHON_ABIS}; > do > if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})); then > return_code="0"; > ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)"; > if ((${#site_packages_dirs[@]})); then > for dir in "${site_packages_dirs[@]}"; > do > site_packages_absolute_dirs+=("${root}$(python_get_sitedir)/${dir}"); > done; > "$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" || return_code="1"; > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then > "$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" &>/dev/null || return_code="1"; > fi; > _python_clean_compiled_modules "${site_packages_absolute_dirs[@]}"; > fi; > if ((${#site_packages_files[@]})); then > for file in "${site_packages_files[@]}"; > do > site_packages_absolute_files+=("${root}$(python_get_sitedir)/${file}"); > done; > "$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" || return_code="1"; > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then > "$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" &>/dev/null || return_code="1"; > fi; > _python_clean_compiled_modules "${site_packages_absolute_files[@]}"; > fi; > eend "${return_code}"; > fi; > unset site_packages_absolute_dirs site_packages_absolute_files; > done; > if _python_package_supporting_installation_for_multiple_python_abis; then > if [[ -n "${previous_PYTHON_ABI}" ]]; then > PYTHON_ABI="${previous_PYTHON_ABI}"; > else > unset PYTHON_ABI; > fi; > fi; > if ((${#other_dirs[@]})) || ((${#other_files[@]})); then > return_code="0"; > ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation) $(python_get_version)"; > if ((${#other_dirs[@]})); then > "$(PYTHON ${PYTHON_ABI})" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" || return_code="1"; > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then > "$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &>/dev/null || return_code="1"; > fi; > _python_clean_compiled_modules "${other_dirs[@]}"; > fi; > if ((${#other_files[@]})); then > "$(PYTHON ${PYTHON_ABI})" "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" || return_code="1"; > if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then > "$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &>/dev/null || return_code="1"; > fi; > _python_clean_compiled_modules "${other_dirs[@]}"; > fi; > eend "${return_code}"; > fi; > else > local myroot mydirs=() myfiles=() myopts=() return_code="0"; > myroot="${EROOT%/}"; > while (($#)); do > case "$1" in > -l | -f | -q) > myopts+=("$1") > ;; > -d | -x) > myopts+=("$1" "$2"); > shift > ;; > --) > shift; > break > ;; > -*) > die "${FUNCNAME}(): Unrecognized option '$1'" > ;; > *) > break > ;; > esac; > shift; > done; > if [[ "$#" -eq 0 ]]; then > ewarn; > ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"; > ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."; > ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."; > ewarn; > fi; > while (($#)); do > if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then > die "${FUNCNAME}(): Invalid argument '$1'"; > else > if [[ -d "${myroot}/${1#/}" ]]; then > mydirs+=("${myroot}/${1#/}"); > else > if [[ -f "${myroot}/${1#/}" ]]; then > myfiles+=("$1"); > else > if [[ -e "${myroot}/${1#/}" ]]; then > eerror "${FUNCNAME}(): ${myroot}/${1#/} is not a regular file or directory"; > else > eerror "${FUNCNAME}(): ${myroot}/${1#/} does not exist"; > fi; > fi; > fi; > fi; > shift; > done; > myopts+=(-q); > PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"; > ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)"; > if ((${#mydirs[@]})); then > "$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" || return_code="1"; > "$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" &>/dev/null || return_code="1"; > _python_clean_compiled_modules "${mydirs[@]}"; > fi; > if ((${#myfiles[@]})); then > python_mod_compile "${myfiles[@]}"; > fi; > eend "${return_code}"; > fi >} >python_need_rebuild () >{ > _python_check_python_pkg_setup_execution; > if _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"; > fi; > if [[ "$#" -ne 0 ]]; then > die "${FUNCNAME}() does not accept arguments"; > fi; > export PYTHON_NEED_REBUILD="$(PYTHON --ABI)" >} >python_pkg_setup () >{ > [[ "${EBUILD_PHASE}" != "setup" ]] && die "${FUNCNAME}() can be used only in pkg_setup() phase"; > if [[ "$#" -ne 0 ]]; then > die "${FUNCNAME}() does not accept arguments"; > fi; > if _python_package_supporting_installation_for_multiple_python_abis; then > _python_calculate_PYTHON_ABIS; > export EPYTHON="$(PYTHON -f)"; > else > PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"; > fi; > if ! has "${EAPI:-0}" 0 1 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; then > if [[ -n "${PYTHON_USE_WITH_OPT}" ]]; then > if [[ "${PYTHON_USE_WITH_OPT}" == !* ]]; then > use ${PYTHON_USE_WITH_OPT#!} && return; > else > use !${PYTHON_USE_WITH_OPT} && return; > fi; > fi; > function python_pkg_setup_check_USE_flags () > { > local python_atom USE_flag; > python_atom="$(python_get_implementational_package)"; > for USE_flag in ${PYTHON_USE_WITH}; > do > if ! has_version "${python_atom}[${USE_flag}]"; then > eerror "Please rebuild ${python_atom} with the following USE flags enabled: ${PYTHON_USE_WITH}"; > die "Please rebuild ${python_atom} with the following USE flags enabled: ${PYTHON_USE_WITH}"; > fi; > done; > for USE_flag in ${PYTHON_USE_WITH_OR}; > do > if has_version "${python_atom}[${USE_flag}]"; then > return; > fi; > done; > if [[ -n ${PYTHON_USE_WITH_OR} ]]; then > eerror "Please rebuild ${python_atom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}"; > die "Please rebuild ${python_atom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}"; > fi > }; > if _python_package_supporting_installation_for_multiple_python_abis; then > PYTHON_SKIP_SANITY_CHECKS="1" python_execute_function -q python_pkg_setup_check_USE_flags; > else > python_pkg_setup_check_USE_flags; > fi; > unset -f python_pkg_setup_check_USE_flags; > fi; > PYTHON_PKG_SETUP_EXECUTED="1" >} >python_set_active_version () >{ > [[ "${EBUILD_PHASE}" != "setup" ]] && die "${FUNCNAME}() can be used only in pkg_setup() phase"; > if _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"; > fi; > if [[ "$#" -ne 1 ]]; then > die "${FUNCNAME}() requires 1 argument"; > fi; > _python_initial_sanity_checks; > if [[ -z "${PYTHON_ABI}" ]]; then > if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then > if ! _python_implementation && ! has_version "dev-lang/python:$1"; then > die "${FUNCNAME}(): 'dev-lang/python:$1' is not installed"; > fi; > export EPYTHON="$(PYTHON "$1")"; > else > if [[ "$1" == "2" ]]; then > if ! _python_implementation && ! has_version "=dev-lang/python-2*"; then > die "${FUNCNAME}(): '=dev-lang/python-2*' is not installed"; > fi; > export EPYTHON="$(PYTHON -2)"; > else > if [[ "$1" == "3" ]]; then > if ! _python_implementation && ! has_version "=dev-lang/python-3*"; then > die "${FUNCNAME}(): '=dev-lang/python-3*' is not installed"; > fi; > export EPYTHON="$(PYTHON -3)"; > else > die "${FUNCNAME}(): Unrecognized argument '$1'"; > fi; > fi; > fi; > PYTHON_ABI="${EPYTHON#python}"; > PYTHON_ABI="${PYTHON_ABI%%-*}"; > fi; > _python_final_sanity_checks; > PYTHON_REQUESTED_ACTIVE_VERSION="$1" >} >python_src_compile () >{ > _python_check_python_pkg_setup_execution; > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > python_execute_function -d -s -- "$@" >} >python_src_configure () >{ > _python_check_python_pkg_setup_execution; > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > python_execute_function -d -s -- "$@" >} >python_src_install () >{ > _python_check_python_pkg_setup_execution; > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > python_execute_function -d -s -- "$@" >} >python_src_prepare () >{ > _python_check_python_pkg_setup_execution; > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > if [[ "$#" -ne 0 ]]; then > die "${FUNCNAME}() does not accept arguments"; > fi; > python_copy_sources >} >python_src_test () >{ > _python_check_python_pkg_setup_execution; > if ! _python_package_supporting_installation_for_multiple_python_abis; then > die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"; > fi; > python_execute_function -d -s -- "$@" >} >python_tkinter_exists () >{ > eerror "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()."; > die "${FUNCNAME}() is banned" >} >python_version () >{ > eerror "Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables."; > die "${FUNCNAME}() is banned" >} >register_success_hook () >{ > local x; > for x in $*; > do > hasq $x $EBUILD_SUCCESS_HOOKS || export EBUILD_SUCCESS_HOOKS="$EBUILD_SUCCESS_HOOKS $x"; > done >} >remove_flag () >{ > local remove="${1}"; > shift; > while [[ -n "${1}" ]]; do > [[ "${1}" != "${remove}" ]] && echo -n "${1} "; > shift; > done >} >src_compile () >{ > distutils_src_compile; > if use doc; then > einfo "Generation of documentation"; > "$(PYTHON -f)" setup.py build_docs --formats=html,pdf || die "Generation of documentation failed"; > fi >} >src_configure () >{ > _eapi2_src_configure "$@" >} >src_install () >{ > find "${S}" -name "*LICENSE.txt" -delete; > distutils_src_install; > dodoc docs/*.txt; > insinto /usr/share/doc/${PF}; > if use doc; then > doins -r build/docs/html build/docs/latex/*.pdf || die; > fi; > if use examples; then > doins -r examples || die; > fi >} >src_prepare () >{ > sed -e "s:,enthought/chaco2/tests::" -i setup.cfg || die "sed setup.cfg failed"; > sed -e "s/self.run_command('build_docs')/pass/" -e "/setupdocs>=1.0/d" -i setup.py || die "sed setup.py failed" >} >src_test () >{ > maketype="distutils_src_test" virtualmake >} >src_unpack () >{ > _eapi0_src_unpack "$@" >} >tc-arch () >{ > tc-ninja_magic_to_arch portage "$@" >} >tc-arch-kernel () >{ > tc-ninja_magic_to_arch kern "$@" >} >tc-endian () >{ > local host=$1; > [[ -z ${host} ]] && host=${CTARGET:-${CHOST}}; > host=${host%%-*}; > case ${host} in > alpha*) > echo big > ;; > arm*b*) > echo big > ;; > arm*) > echo little > ;; > cris*) > echo little > ;; > hppa*) > echo big > ;; > i?86*) > echo little > ;; > ia64*) > echo little > ;; > m68*) > echo big > ;; > mips*l*) > echo little > ;; > mips*) > echo big > ;; > powerpc*) > echo big > ;; > s390*) > echo big > ;; > sh*b*) > echo big > ;; > sh*) > echo little > ;; > sparc*) > echo big > ;; > x86_64*) > echo little > ;; > *) > echo wtf > ;; > esac >} >tc-export () >{ > local var; > for var in "$@"; > do > [[ $(type -t tc-get${var}) != "function" ]] && die "tc-export: invalid export variable '${var}'"; > eval tc-get${var} > /dev/null; > done >} >tc-getAR () >{ > tc-getPROG AR ar "$@" >} >tc-getAS () >{ > tc-getPROG AS as "$@" >} >tc-getBUILD_CC () >{ > local v; > for v in CC_FOR_BUILD BUILD_CC HOSTCC; > do > if [[ -n ${!v} ]]; then > export BUILD_CC=${!v}; > echo "${!v}"; > return 0; > fi; > done; > local search=; > if [[ -n ${CBUILD} ]]; then > search=$(type -p ${CBUILD}-gcc); > search=${search##*/}; > fi; > search=${search:-gcc}; > export BUILD_CC=${search}; > echo "${search}" >} >tc-getCC () >{ > tc-getPROG CC gcc "$@" >} >tc-getCPP () >{ > tc-getPROG CPP cpp "$@" >} >tc-getCXX () >{ > tc-getPROG CXX g++ "$@" >} >tc-getDLLWRAP () >{ > tc-getPROG DLLWRAP dllwrap "$@" >} >tc-getF77 () >{ > tc-getPROG F77 f77 "$@" >} >tc-getFC () >{ > tc-getPROG FC gfortran "$@" >} >tc-getGCJ () >{ > tc-getPROG GCJ gcj "$@" >} >tc-getLD () >{ > tc-getPROG LD ld "$@" >} >tc-getNM () >{ > tc-getPROG NM nm "$@" >} >tc-getOBJCOPY () >{ > tc-getPROG OBJCOPY objcopy "$@" >} >tc-getPKG_CONFIG () >{ > tc-getPROG PKG_CONFIG pkg-config "$@" >} >tc-getPROG () >{ > local var=$1; > local prog=$2; > if [[ -n ${!var} ]]; then > echo "${!var}"; > return 0; > fi; > local search=; > [[ -n $3 ]] && search=$(type -p "$3-${prog}"); > [[ -z ${search} && -n ${CHOST} ]] && search=$(type -p "${CHOST}-${prog}"); > [[ -n ${search} ]] && prog=${search##*/}; > export ${var}=${prog}; > echo "${!var}" >} >tc-getRANLIB () >{ > tc-getPROG RANLIB ranlib "$@" >} >tc-getRC () >{ > tc-getPROG RC windres "$@" >} >tc-getSTRIP () >{ > tc-getPROG STRIP strip "$@" >} >tc-has-openmp () >{ > local base="${T}/test-tc-openmp"; > cat > "${base}.c" <<-EOF >#include <omp.h> >int main() { >int nthreads, tid, ret = 0; >#pragma omp parallel private(nthreads, tid) >{ >tid = omp_get_thread_num(); >nthreads = omp_get_num_threads(); ret += tid + nthreads; >} >return ret; >} >EOF > > $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" &>/dev/null; > local ret=$?; > rm -f "${base}"*; > return ${ret} >} >tc-has-tls () >{ > local base="${T}/test-tc-tls"; > cat > "${base}.c" <<-EOF >int foo(int *i) { >static __thread int j = 0; >return *i ? j : *i; >} >EOF > > local flags; > case $1 in > -s) > flags="-S" > ;; > -c) > flags="-c" > ;; > -l) > > ;; > -*) > die "Usage: tc-has-tls [-c|-l] [toolchain prefix]" > ;; > esac; > : ${flags:=-fPIC -shared -Wl,-z,defs}; > [[ $1 == -* ]] && shift; > $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &>/dev/null; > local ret=$?; > rm -f "${base}"*; > return ${ret} >} >tc-is-cross-compiler () >{ > return $([[ ${CBUILD:-${CHOST}} != ${CHOST} ]]) >} >tc-is-hardfloat () >{ > [[ ${CTARGET//_/-} == *-hardfloat-* ]] && echo "yes" || echo "no" >} >tc-is-softfloat () >{ > case ${CTARGET} in > bfin* | h8300*) > echo "only" > ;; > *) > [[ ${CTARGET//_/-} == *-softfloat-* ]] && echo "yes" || echo "no" > ;; > esac >} >tc-is-static-only () >{ > local host=${CTARGET:-${CHOST}}; > return $([[ ${host} == *-mint* ]]) >} >tc-ninja_magic_to_arch () >{ > function ninj () > { > [[ ${type} == "kern" ]] && echo $1 || echo $2 > }; > local type=$1; > local host=$2; > [[ -z ${host} ]] && host=${CTARGET:-${CHOST}}; > case ${host} in > alpha*) > echo alpha > ;; > arm*) > echo arm > ;; > avr*) > ninj avr32 avr > ;; > bfin*) > ninj blackfin bfin > ;; > cris*) > echo cris > ;; > hppa*) > ninj parisc hppa > ;; > i?86*) > if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -lt $(KV_to_int 2.6.24) || ${host} == *freebsd* ]]; then > echo i386; > else > echo x86; > fi > ;; > ia64*) > echo ia64 > ;; > m68*) > echo m68k > ;; > mips*) > echo mips > ;; > nios2*) > echo nios2 > ;; > nios*) > echo nios > ;; > powerpc*) > if [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.16) ]] && [[ ${type} == "kern" ]]; then > echo powerpc; > else > if [[ $(KV_to_int ${KV}) -eq $(KV_to_int 2.6.15) ]] && [[ ${type} == "kern" ]]; then > if [[ ${host} == powerpc64* ]] || [[ ${PROFILE_ARCH} == "ppc64" ]]; then > echo powerpc; > else > echo ppc; > fi; > else > if [[ ${host} == powerpc64* ]]; then > echo ppc64; > else > if [[ ${PROFILE_ARCH} == "ppc64" ]]; then > ninj ppc64 ppc; > else > echo ppc; > fi; > fi; > fi; > fi > ;; > s390*) > echo s390 > ;; > sh64*) > ninj sh64 sh > ;; > sh*) > echo sh > ;; > sparc64*) > ninj sparc64 sparc > ;; > sparc*) > [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc > ;; > vax*) > echo vax > ;; > x86_64*) > if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.24) ]]; then > echo x86; > else > ninj x86_64 amd64; > fi > ;; > *) > echo unknown > ;; > esac >} >virtualmake () >{ > local retval=0; > local OLD_SANDBOX_ON="${SANDBOX_ON}"; > local XVFB=$(type -p Xvfb); > local XHOST=$(type -p xhost); > if [[ -n ${XVFB} && -n ${XHOST} ]] && ( [[ -z ${DISPLAY} ]] || ! ( ${XHOST} &>/dev/null ) ); then > export XAUTHORITY=; > einfo "Scanning for an open DISPLAY to start Xvfb ..."; > export SANDBOX_ON="0"; > local i=0; > XDISPLAY=$(i=0; while [[ -f /tmp/.X${i}-lock ]] ; do ((i++));done; echo ${i}); > ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 &>/dev/null & sleep 2; > local start=${XDISPLAY}; > while [[ ! -f /tmp/.X${XDISPLAY}-lock ]]; do > if ((XDISPLAY - start > 15)); then > eerror ""; > eerror "Unable to start Xvfb."; > eerror ""; > eerror "'${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24' returns:"; > eerror ""; > ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24; > eerror ""; > eerror "If possible, correct the above error and try your emerge again."; > eerror ""; > die; > fi; > ((XDISPLAY++)); > ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 &>/dev/null & sleep 2; > done; > export SANDBOX_ON="${OLD_SANDBOX_ON}"; > einfo "Starting Xvfb on \$DISPLAY=${XDISPLAY} ..."; > export DISPLAY=:${XDISPLAY}; > ${maketype} "$@"; > retval=$?; > kill $(cat /tmp/.X${XDISPLAY}-lock); > else > ${maketype} "$@"; > retval=$?; > fi; > return ${retval} >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 330517
:
240703
|
240705
|
240707
| 240709 |
240711