diff options
Diffstat (limited to 'install_requirements.py')
| -rw-r--r-- | install_requirements.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/install_requirements.py b/install_requirements.py new file mode 100644 index 0000000..bea8813 --- /dev/null +++ b/install_requirements.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Helper tool to install the right requirements using pip based on the +running Python version. It requires ``pip`` to be installed and found +in the $PATH. + +:author: Niko Wenselowski +""" +from __future__ import unicode_literals, print_function + +import sys +import os + + +def get_requirements_file_path(): + """Returns the absolute path to the correct requirements file.""" + directory = os.path.dirname(__file__) + + if sys.version_info[0] == 3: + requirements_file = 'requirements-3.txt' + else: + requirements_file = 'requirements.txt' + + return os.path.join(directory, requirements_file) + + +def main(): + requirements_file = get_requirements_file_path() + print('Installing requirements from %s' % requirements_file) + os.system('pip install -r %s --use-mirrors' % requirements_file) + + +if __name__ == '__main__': + main() |
