DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (dcc6d7a0dc00)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.

AC_DEFUN([MOZ_PYTHON],
[

dnl We honor the Python path defined in an environment variable. This is used
dnl to pass the virtualenv's Python from the main configure to SpiderMonkey's
dnl configure, for example.
if test -z "$PYTHON"; then
  MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python)
  if test -z "$PYTHON"; then
      AC_MSG_ERROR([python was not found in \$PATH])
  fi
else
  AC_MSG_RESULT([Using Python from environment variable \$PYTHON])
fi

_virtualenv_topsrcdir=
_virtualenv_populate_path=

dnl If this is a mozilla-central, we'll find the virtualenv in the top
dnl source directory. If this is a SpiderMonkey build, we assume we're at
dnl js/src and try to find the virtualenv from the mozilla-central root.
for base in $MOZILLA_CENTRAL_PATH $_topsrcdir $_topsrcdir/../..; do
  possible=$base/python/mozbuild/mozbuild/virtualenv.py

  if test -e $possible; then
    _virtualenv_topsrcdir=$base
    _virtualenv_populate_path=$possible
    break
  fi
done

if test -z $_virtualenv_populate_path; then
    AC_MSG_ERROR([Unable to find Virtualenv population script. In order
to build, you will need mozilla-central's virtualenv.

If you are building from a mozilla-central checkout, you should never see this
message. If you are building from a source archive, the source archive was
likely not created properly (it is missing the virtualenv files).

If you have a copy of mozilla-central available, define the
MOZILLA_CENTRAL_PATH environment variable to the top source directory of
mozilla-central and relaunch configure.])

fi

if test -z $DONT_POPULATE_VIRTUALENV; then
  AC_MSG_RESULT([Creating Python environment])
  dnl This verifies our Python version is sane and ensures the Python
  dnl virtualenv is present and up to date. It sanitizes the environment
  dnl for us, so we don't need to clean anything out.
  $PYTHON $_virtualenv_populate_path \
    $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv \
    $_virtualenv_topsrcdir/build/virtualenv_packages.txt || exit 1

  case "$host_os" in
  mingw*)
    PYTHON=`cd $MOZ_BUILD_ROOT && pwd -W`/_virtualenv/Scripts/python.exe
    ;;
  *)
    PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
    ;;
  esac
fi

AC_SUBST(PYTHON)

AC_MSG_CHECKING([Python environment is Mozilla virtualenv])
$PYTHON -c "import mozbuild.base"
if test "$?" != 0; then
    AC_MSG_ERROR([Python environment does not appear to be sane.])
fi
AC_MSG_RESULT([yes])

PYTHON_SITE_PACKAGES=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()"`
if test -z "$PYTHON_SITE_PACKAGES"; then
    AC_MSG_ERROR([Could not determine python site packages directory.])
fi
AC_SUBST([PYTHON_SITE_PACKAGES])

])