Set lock_path correctly.
[openstack-build/neutron-build.git] / tools / install_venv.py
1 #!/usr/bin/env python
2 # Copyright 2010 United States Government as represented by the
3 # Administrator of the National Aeronautics and Space Administration.
4 # All Rights Reserved.
5 #
6 # Copyright 2010 OpenStack Foundation.
7 # Copyright 2013 IBM Corp.
8 #
9 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
10 #    not use this file except in compliance with the License. You may obtain
11 #    a copy of the License at
12 #
13 #         http://www.apache.org/licenses/LICENSE-2.0
14 #
15 #    Unless required by applicable law or agreed to in writing, software
16 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18 #    License for the specific language governing permissions and limitations
19 #    under the License.
20
21 """
22 Installation script for Neutron's development virtualenv
23 """
24 from __future__ import print_function
25
26 import os
27 import sys
28
29 import install_venv_common as install_venv
30
31
32 def print_help():
33     help = """
34  Neutron development environment setup is complete.
35
36  Neutron development uses virtualenv to track and manage Python dependencies
37  while in development and testing.
38
39  To activate the Neutron virtualenv for the extent of your current shell
40  session you can run:
41
42  $ source .venv/bin/activate
43
44  Or, if you prefer, you can run commands in the virtualenv on a case by case
45  basis by running:
46
47  $ tools/with_venv.sh <your command>
48
49  Also, make test will automatically use the virtualenv.
50     """
51     print(help)
52
53
54 def main(argv):
55     root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
56     venv = os.path.join(root, '.venv')
57     pip_requires = os.path.join(root, 'requirements.txt')
58     test_requires = os.path.join(root, 'test-requirements.txt')
59     py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
60     project = 'Neutron'
61     install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
62                                        py_version, project)
63     options = install.parse_args(argv)
64     install.check_python_version()
65     install.check_dependencies()
66     install.create_virtualenv(no_site_packages=options.no_site_packages)
67     install.install_dependencies()
68     print_help()
69
70
71 if __name__ == '__main__':
72     main(sys.argv)