blob: 20dcefa4c0ccc1360b0971add29bfa6135e48ee1 [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.
6#
7# Copyright 2010 OpenStack, LLC
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
24import optparse
25import os
26import subprocess
27import sys
28
Matthew Treinish51dfee72013-01-28 15:50:29 -050029import install_venv_common as install_venv
Matthew Treinish8e937d72012-12-14 11:11:41 -050030
31
Matthew Treinish51dfee72013-01-28 15:50:29 -050032class CentOS(install_venv.Fedora):
Ryota Hashimoto67adbd92013-01-15 04:04:24 -070033 """This covers CentOS."""
34
35 def post_process(self):
36 if not self.check_pkg('openssl-devel'):
37 self.yum.install('openssl-devel', check_exit_code=False)
38
39
Matthew Treinish8e937d72012-12-14 11:11:41 -050040def print_help():
Attila Fazekasb2902af2013-02-16 16:22:44 +010041 """This prints Help."""
42
Matthew Treinish8e937d72012-12-14 11:11:41 -050043 help = """
44 Tempest development environment setup is complete.
45
46 Tempest development uses virtualenv to track and manage Python dependencies
47 while in development and testing.
48
49 To activate the Tempest virtualenv for the extent of your current shell
50 session you can run:
51
52 $ source .venv/bin/activate
53
54 Or, if you prefer, you can run commands in the virtualenv on a case by case
55 basis by running:
56
57 $ tools/with_venv.sh <your command>
58
59 Also, make test will automatically use the virtualenv.
60 """
61 print help
62
63
Matthew Treinish8e937d72012-12-14 11:11:41 -050064def main(argv):
Matthew Treinish51dfee72013-01-28 15:50:29 -050065 root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
66 venv = os.path.join(root, '.venv')
67 pip_requires = os.path.join(root, 'tools', 'pip-requires')
68 test_requires = os.path.join(root, 'tools', 'test-requires')
69 py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
70 project = 'Tempest'
71 install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
72 py_version, project)
73 if os.path.exists('/etc/redhat-release'):
74 with open('/etc/redhat-release') as rh_release:
75 if 'CentOS' in rh_release.read():
76 install_venv.Fedora = CentOS
77 options = install.parse_args(argv)
78 install.check_python_version()
79 install.check_dependencies()
80 install.create_virtualenv(no_site_packages=options.no_site_packages)
81 install.install_dependencies()
82 install.post_process()
Matthew Treinish8e937d72012-12-14 11:11:41 -050083 print_help()
84
85if __name__ == '__main__':
86 main(sys.argv)