A seismology toolkit for Python https://pyrocko.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.6 KiB

#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import platform
import sys
import os
if '--help' in sys.argv[1:] or '-h' in sys.argv[1:]:
sys.exit('''usage: install_prerequisites.py [--yes] [--help]
Try to install Pyrocko's prerequisites through your system's native package
manager. This script simply calls a shell script (see under `prerequisites/`)
appropriate for your system and Python version.
--yes Do not ask any questions (batch mode).
--help Show this help message and exit
force_yes = '--yes' in sys.argv[1:]
distribution = ''
distribution = platform.linux_distribution()[0].lower().rstrip()
except Exception:
if not distribution:
uname = platform.uname()
if uname[2].find('arch') != -1:
distribution = 'arch'
elif uname[3].lower().find('ubuntu') != -1:
distribution = 'ubuntu'
except Exception:
if not distribution:
'Cannot determine platform for automatic prerequisite installation.')
if distribution == 'ubuntu':
distribution = 'debian'
if distribution.startswith('centos'):
distribution = 'centos'
fn = 'prerequisites/prerequisites_%s_python%i.sh' % (
distribution, sys.version_info.major)
if not force_yes:
input_func = raw_input
except NameError:
input_func = input
confirm = input_func('Execute: %s \n\
proceed? [y/n]' % open(fn, 'r').read())
if not confirm.lower() == 'y':
os.execl('/bin/sh', 'sh', fn)