1#!/usr/bin/env python
2# This Source Code Form is subject to the terms of the Mozilla Public
3# License, v. 2.0. If a copy of the MPL was not distributed with this
4# file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
6"""venv.py
7
8Test virtualenv creation. This installs talos in the local venv; that's it.
9"""
10
11from __future__ import absolute_import
12import os
13import sys
14
15sys.path.insert(1, os.path.dirname(sys.path[0]))
16
17from mozharness.base.errors import PythonErrorList
18from mozharness.base.python import virtualenv_config_options, VirtualenvMixin
19from mozharness.base.script import BaseScript
20
21# VirtualenvExample {{{1
22class VirtualenvExample(VirtualenvMixin, BaseScript):
23    config_options = [
24        [
25            ["--talos-url"],
26            {
27                "action": "store",
28                "dest": "talos_url",
29                "default": "https://hg.mozilla.org/build/talos/archive/tip.tar.gz",
30                "help": "Specify the talos pip url",
31            },
32        ]
33    ] + virtualenv_config_options
34
35    def __init__(self, require_config_file=False):
36        super(VirtualenvExample, self).__init__(
37            config_options=self.config_options,
38            all_actions=[
39                "create-virtualenv",
40            ],
41            default_actions=[
42                "create-virtualenv",
43            ],
44            require_config_file=require_config_file,
45            config={"virtualenv_modules": ["talos"]},
46        )
47
48
49# __main__ {{{1
50if __name__ == "__main__":
51    venv_example = VirtualenvExample()
52    venv_example.run_and_exit()
53