venv.py (1529B)
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 8 Test virtualenv creation. This installs talos in the local venv; that's it. 9 """ 10 11 import os 12 import sys 13 14 sys.path.insert(1, os.path.dirname(sys.path[0])) 15 16 from mozharness.base.errors import PythonErrorList 17 from mozharness.base.python import virtualenv_config_options, VirtualenvMixin 18 from mozharness.base.script import BaseScript 19 20 21 # VirtualenvExample {{{1 22 class 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 50 if __name__ == "__main__": 51 venv_example = VirtualenvExample() 52 venv_example.run_and_exit()