diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/talos/INSTALL.py | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/talos/INSTALL.py')
-rwxr-xr-x | testing/talos/INSTALL.py | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/testing/talos/INSTALL.py b/testing/talos/INSTALL.py new file mode 100755 index 0000000000..73edfbb7b5 --- /dev/null +++ b/testing/talos/INSTALL.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +""" +installation script for talos. This script: +- creates a virtualenv in the current directory +- sets up talos in development mode: `python setup.py develop` +- downloads pageloader and packages to talos/page_load_test/pageloader.xpi +""" +import os +import subprocess +import sys + +import six + +try: + from subprocess import check_call as call +except ImportError: + from subprocess import call + +# globals +here = os.path.dirname(os.path.abspath(__file__)) +VIRTUALENV = "https://raw.github.com/pypa/virtualenv/1.10/virtualenv.py" + + +def which(binary, path=os.environ["PATH"]): + dirs = path.split(os.pathsep) + for dir in dirs: + if os.path.isfile(os.path.join(dir, path)): + return os.path.join(dir, path) + if os.path.isfile(os.path.join(dir, path + ".exe")): + return os.path.join(dir, path + ".exe") + + +def main(args=sys.argv[1:]): + + # sanity check + # ensure setup.py exists + setup_py = os.path.join(here, "setup.py") + assert os.path.exists(setup_py), "setup.py not found" + + # create a virtualenv + virtualenv = which("virtualenv") or which("virtualenv.py") + if virtualenv: + call([virtualenv, "--system-site-packages", here]) + else: + process = subprocess.Popen( + [sys.executable, "-", "--system-site-packages", here], stdin=subprocess.PIPE + ) + stdout, stderr = process.communicate( + input=six.moves.urllib.request.urlopen(VIRTUALENV).read() + ) + + # find the virtualenv's python + for i in ("bin", "Scripts"): + bindir = os.path.join(here, i) + if os.path.exists(bindir): + break + else: + raise AssertionError("virtualenv binary directory not found") + for i in ("python", "python.exe"): + virtualenv_python = os.path.join(bindir, i) + if os.path.exists(virtualenv_python): + break + else: + raise AssertionError("virtualenv python not found") + + # install talos into the virtualenv + call([os.path.abspath(virtualenv_python), "setup.py", "develop"], cwd=here) + + +if __name__ == "__main__": + main() |