blob: 84d0fd9537efc0fe43c1123388ec0e691b4e4d85 [file] [log] [blame]
Matthew Treinish8e937d72012-12-14 11:11:41 -05001# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2010 United States Government as represented by the
4# Administrator of the National Aeronautics and Space Administration.
5# All Rights Reserved.
Monty Taylorb2ca5ca2013-04-28 18:00:21 -07006# flake8: noqa
ZhiQiang Fan39f97222013-09-20 04:49:44 +08007# Copyright 2010 OpenStack Foundation
Matthew Treinish51dfee72013-01-28 15:50:29 -05008# Copyright 2013 IBM Corp.
Matthew Treinish8e937d72012-12-14 11:11:41 -05009#
10# Licensed under the Apache License, Version 2.0 (the "License"); you may
11# not use this file except in compliance with the License. You may obtain
12# a copy of the License at
13#
14# http://www.apache.org/licenses/LICENSE-2.0
15#
16# Unless required by applicable law or agreed to in writing, software
17# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
19# License for the specific language governing permissions and limitations
20# under the License.
21
22"""Installation script for Tempest's development virtualenv."""
23
Matthew Treinish8e937d72012-12-14 11:11:41 -050024import os
Matthew Treinish8e937d72012-12-14 11:11:41 -050025import sys
26
Matthew Treinish51dfee72013-01-28 15:50:29 -050027import install_venv_common as install_venv
Matthew Treinish8e937d72012-12-14 11:11:41 -050028
29
Matthew Treinish51dfee72013-01-28 15:50:29 -050030class CentOS(install_venv.Fedora):
Ryota Hashimoto67adbd92013-01-15 04:04:24 -070031 """This covers CentOS."""
32
33 def post_process(self):
34 if not self.check_pkg('openssl-devel'):
35 self.yum.install('openssl-devel', check_exit_code=False)
36
37
Matthew Treinish8e937d72012-12-14 11:11:41 -050038def print_help():
Attila Fazekasb2902af2013-02-16 16:22:44 +010039 """This prints Help."""
40
Matthew Treinish8e937d72012-12-14 11:11:41 -050041 help = """
42 Tempest development environment setup is complete.
43
44 Tempest development uses virtualenv to track and manage Python dependencies
45 while in development and testing.
46
47 To activate the Tempest virtualenv for the extent of your current shell
48 session you can run:
49
50 $ source .venv/bin/activate
51
52 Or, if you prefer, you can run commands in the virtualenv on a case by case
53 basis by running:
54
55 $ tools/with_venv.sh <your command>
56
57 Also, make test will automatically use the virtualenv.
58 """
Chang Bo Guoc3fd1532013-09-17 23:24:39 -070059 print(help)
Matthew Treinish8e937d72012-12-14 11:11:41 -050060
61
Matthew Treinish8e937d72012-12-14 11:11:41 -050062def main(argv):
Matthew Treinish51dfee72013-01-28 15:50:29 -050063 root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
64 venv = os.path.join(root, '.venv')
Zhenguo Niud41413a2013-05-29 17:42:42 +080065 pip_requires = os.path.join(root, 'requirements.txt')
66 test_requires = os.path.join(root, 'test-requirements.txt')
Matthew Treinish51dfee72013-01-28 15:50:29 -050067 py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
68 project = 'Tempest'
69 install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
70 py_version, project)
71 if os.path.exists('/etc/redhat-release'):
72 with open('/etc/redhat-release') as rh_release:
73 if 'CentOS' in rh_release.read():
74 install_venv.Fedora = CentOS
75 options = install.parse_args(argv)
76 install.check_python_version()
77 install.check_dependencies()
78 install.create_virtualenv(no_site_packages=options.no_site_packages)
79 install.install_dependencies()
80 install.post_process()
Matthew Treinish8e937d72012-12-14 11:11:41 -050081 print_help()
82
83if __name__ == '__main__':
84 main(sys.argv)