build/autoconf/python-virtualenv.m4

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 dnl This Source Code Form is subject to the terms of the Mozilla Public
     2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
     3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
     5 AC_DEFUN([MOZ_PYTHON],
     6 [
     8 dnl We honor the Python path defined in an environment variable. This is used
     9 dnl to pass the virtualenv's Python from the main configure to SpiderMonkey's
    10 dnl configure, for example.
    11 if test -z "$PYTHON"; then
    12   MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python)
    13   if test -z "$PYTHON"; then
    14       AC_MSG_ERROR([python was not found in \$PATH])
    15   fi
    16 else
    17   AC_MSG_RESULT([Using Python from environment variable \$PYTHON])
    18 fi
    20 _virtualenv_topsrcdir=
    21 _virtualenv_populate_path=
    23 dnl If this is a mozilla-central, we'll find the virtualenv in the top
    24 dnl source directory. If this is a SpiderMonkey build, we assume we're at
    25 dnl js/src and try to find the virtualenv from the mozilla-central root.
    26 for base in $MOZILLA_CENTRAL_PATH $_topsrcdir $_topsrcdir/../..; do
    27   possible=$base/python/mozbuild/mozbuild/virtualenv.py
    29   if test -e $possible; then
    30     _virtualenv_topsrcdir=$base
    31     _virtualenv_populate_path=$possible
    32     break
    33   fi
    34 done
    36 if test -z $_virtualenv_populate_path; then
    37     AC_MSG_ERROR([Unable to find Virtualenv population script. In order
    38 to build, you will need mozilla-central's virtualenv.
    40 If you are building from a mozilla-central checkout, you should never see this
    41 message. If you are building from a source archive, the source archive was
    42 likely not created properly (it is missing the virtualenv files).
    44 If you have a copy of mozilla-central available, define the
    45 MOZILLA_CENTRAL_PATH environment variable to the top source directory of
    46 mozilla-central and relaunch configure.])
    48 fi
    50 if test -z $DONT_POPULATE_VIRTUALENV; then
    51   AC_MSG_RESULT([Creating Python environment])
    52   dnl This verifies our Python version is sane and ensures the Python
    53   dnl virtualenv is present and up to date. It sanitizes the environment
    54   dnl for us, so we don't need to clean anything out.
    55   $PYTHON $_virtualenv_populate_path \
    56     $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv \
    57     $_virtualenv_topsrcdir/build/virtualenv_packages.txt || exit 1
    59   case "$host_os" in
    60   mingw*)
    61     PYTHON=`cd $MOZ_BUILD_ROOT && pwd -W`/_virtualenv/Scripts/python.exe
    62     ;;
    63   *)
    64     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
    65     ;;
    66   esac
    67 fi
    69 AC_SUBST(PYTHON)
    71 AC_MSG_CHECKING([Python environment is Mozilla virtualenv])
    72 $PYTHON -c "import mozbuild.base"
    73 if test "$?" != 0; then
    74     AC_MSG_ERROR([Python environment does not appear to be sane.])
    75 fi
    76 AC_MSG_RESULT([yes])
    78 PYTHON_SITE_PACKAGES=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()"`
    79 if test -z "$PYTHON_SITE_PACKAGES"; then
    80     AC_MSG_ERROR([Could not determine python site packages directory.])
    81 fi
    82 AC_SUBST([PYTHON_SITE_PACKAGES])
    84 ])

mercurial