summaryrefslogtreecommitdiffstats
path: root/install_requirements.py
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2013-02-13 18:35:39 -0300
committerLibravatarAgustin Henze <tin@sluc.org.ar>2013-02-13 18:35:39 -0300
commita40930043121a4b60de8526d58417761a54ab718 (patch)
tree383c5cf8e320761ee942619282fe51be625179a7 /install_requirements.py
parent9c5708cc92af894e414bc76ee35ec2230de5d288 (diff)
Imported Upstream version 5.2upstream/5.2
Diffstat (limited to 'install_requirements.py')
-rw-r--r--install_requirements.py35
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()