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