Browse Source

refactor installation style and recommendations

conda
Sebastian Heimann 2 months ago
parent
commit
d609de0715
  1. 12
      README.md
  2. 96
      doc/source/install/details.rst
  3. 19
      doc/source/install/packages/anaconda.rst
  4. 4
      doc/source/install/packages/index.rst
  5. 1
      doc/source/install/packages/pip.rst
  6. 27
      doc/source/install/system/linux/arch.rst
  7. 29
      doc/source/install/system/linux/centos.rst
  8. 28
      doc/source/install/system/linux/deb.rst
  9. 52
      doc/source/install/system/linux/index.rst
  10. 26
      doc/source/install/system/linux/suse.rst
  11. 22
      doc/source/install/system/mac.rst
  12. 6
      doc/source/install/system/windows.rst
  13. 320
      install.py
  14. 66
      install_prerequisites.py
  15. 4
      maintenance/vagrant/arch/inside.sh
  16. 4
      maintenance/vagrant/centos-7/inside.sh
  17. 2
      maintenance/vagrant/centos-8/inside.sh
  18. 4
      maintenance/vagrant/debian-10/inside.sh
  19. 2
      maintenance/vagrant/debian-9/inside.sh
  20. 3
      maintenance/vagrant/osx/inside.sh
  21. 2
      maintenance/vagrant/ubuntu-16.04/inside.sh
  22. 2
      maintenance/vagrant/ubuntu-18.04/inside.sh
  23. 4
      maintenance/vagrant/ubuntu-20.04/inside.sh
  24. 15
      prerequisites/prerequisites_debian_python3.sh
  25. 2
      requirements-all.txt
  26. 13
      requirements-conda-windows.txt
  27. 11
      requirements-conda.txt

12
README.md

@ -16,8 +16,16 @@ installation styles. Please consult the [Pyrocko Installation Manual](https://py
```
git clone https://git.pyrocko.org/pyrocko/pyrocko.git
cd pyrocko
sudo python install_prerequisites.py
sudo python setup.py install
python install.py deps system
python install.py system
```
### User installation from source
```
git clone https://git.pyrocko.org/pyrocko/pyrocko.git
cd pyrocko
pip install . # only install into isolated environments like this!
```
### Installation with Anaconda

96
doc/source/install/details.rst

@ -8,6 +8,7 @@ needed when a standard install is not possible or conflicts arise.
**For standard install instructions, head on over to**
* :doc:`system/index`
* :doc:`packages/index`
Prerequisites
-------------
@ -19,14 +20,15 @@ installed from source:
* C compiler (tested with gcc, clang and MSVC)
* ``patch`` utility
* `NumPy <http://numpy.scipy.org/>`_ (>= 1.6, with development headers)
* `wheel <https://pypi.org/project/wheel/>`_
* Try to use normal system packages for these Python modules:
* `Python <http://www.python.org/>`_ (>= 3.5, with development headers)
* `NumPy <http://numpy.scipy.org/>`_ (>= 1.6, with development headers)
* `SciPy <http://scipy.org/>`_
* `matplotlib <http://matplotlib.sourceforge.net/>`_ (with Qt4 or Qt5 backend)
* `matplotlib <http://matplotlib.sourceforge.net/>`_ (with Qt5 backend)
* `pyyaml <https://bitbucket.org/xi/pyyaml>`_
* `PyQt4 or PyQt5 <http://www.riverbankcomputing.co.uk/software/pyqt/intro>`_ (only needed for the GUI apps)
* `PyQt5 <http://www.riverbankcomputing.co.uk/software/pyqt/intro>`_ (only needed for the GUI apps)
* `requests <http://docs.python-requests.org/en/master/>`_
* Optional Python modules:
@ -43,40 +45,86 @@ installed from source:
* `QSSP <https://git.pyrocko.org/pyrocko/fomosto-qssp>`_ (optional, needed for the Fomosto ``qssp.2010`` backend)
* `PSGRN/PSCMP <https://git.pyrocko.org/pyrocko/fomosto-psgrn-pscmp>`_ (optional, needed for the Fomosto ``psgrn.pscmp`` backend)
Download, compile and install Pyrocko from source
-------------------------------------------------
Download, build and install from source
---------------------------------------
The following examples will install Pyrocko system-wide with Python 3 on Linux
or MacOS. For Windows source installs, please refer to :ref:`Installation on
The following examples will install Pyrocko from source, on Linux or MacOS.
For Windows "from source" installs, please refer to :ref:`Installation on
Windows: From source <windows-install-from-source>`.
Because of the many different and conflicting ways how you can manage your
Python installations, be sure to understand the basics of Python package
management before proceeding.
For convenience, we are using Pyrocko's "from source" installation helper
``install.py`` here. Run ``python install.py --help`` for more information. The
native commands to be run are printed before execution, and have to be
confirmed by you.
.. highlight:: sh
Use ``git`` to download the software package and the included script ``setup.py``
to install::
**(A1)** Download (clone) the Pyrocko project directory with *git*::
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
# for single user:
python3 setup.py install --user
# system wide:
sudo python3 setup.py install
**(A2)** Change to the Pyrocko project directory::
cd ~/src/pyrocko/
**(A3)** Install prerequisites using your method of choice::
# (a) If you manage the prerequisites with the system's native package manager:
python3 install.py deps system
# or (b), if you manage the prerequisites with pip:
python3 install.py deps pip
# or (c), if you manage your installation with conda:
python3 install.py deps conda
**(A4)** Build and install Pyrocko::
# If you want to install for single user (pip, venv, conda):
python3 install.py user
# or, if you want to install system wide:
python3 install.py system
**Note:** With *pip*, if you do not specify ``--no-deps``, it will automatically
download and install missing dependencies. Unless you manage your installations
exclusively with *pip*, omitting this flag can lead to conflicts.
**Note:** The intention of using ``--no-build-isolation`` is to compile exactly
against the already installed prerequisites. If you omit the flag, *pip* will
compile against possibly newer versions which it downloads and installs into a
temporary, isolated environment.
**Note:** If you have previously installed Pyrocko using other tools like e.g.
*easy_install*, *pip*, or *conda*, you should first remove the old
installation. Otherwise you will end up with two parallel installations which
will cause trouble.
*pip*, or *conda*, you should first remove the old installation. Otherwise you
will end up with two parallel installations which will cause trouble.
Updating
--------
Updating a "from source" install
--------------------------------
If you later would like to update Pyrocko, run the following commands (this
assumes that you have used *git* to download Pyrocko)::
assumes that you have used *git* to download Pyrocko).
**(B1)** **Change to the Pyrocko project directory (A2).**
**(B2)** Update the project directory tree with *git*::
cd ~/src/pyrocko # assuming the Pyrocko source package is here
git pull origin master --ff-only
# for single user:
python3 setup.py install --user
# system wide:
sudo python3 setup.py install
**(B3)** **Build and reinstall Pyrocko (A4).**
Uninstalling
------------
You can use *pip* to uninstall Pyrocko::
# (a) To remove a single user "from source" install (pip, venv, conda):
pip uninstall pyrocko
# (b) To remove a system-wide "from source" install:
sudo pip uninstall pyrocko

19
doc/source/install/packages/anaconda.rst

@ -1,5 +1,5 @@
Installation under Anaconda
===========================
Installation with conda
=======================
`Anaconda <https://www.anaconda.com/>`_, is a cross-platform Python
distribution with its own package manager ``conda``. For a more lightweight
@ -31,15 +31,16 @@ Anaconda on Linux or MacOS. For Windows source installs, please refer to
:ref:`Installation on Windows: From source <windows-install-from-source>`.
.. code-block:: bash
:caption: Compile from source
:caption: Build and install from source
conda install setuptools numpy scipy matplotlib pyqt pyyaml progressbar2 requests jinja2 nose
cd `conda info --root`
mkdir src
cd src
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
python setup.py install
# make sure the correct conda environment is activated
python3 install.py deps conda # install prerequisites with conda
python3 install.py user # build and install Pyrocko with pip
**Note:** The native ``conda`` and ``pip`` commands to be run are printed
before execution and must be confirmed.
For instructions on how to install Pyrocko on other systems or if the
installation with the above procedure fails, see :doc:`index` or

4
doc/source/install/packages/index.rst

@ -1,7 +1,7 @@
Python package manager installations
------------------------------------
We provide pre-compiled Anaconda and pip packages for use with Python 3,
We provide pre-compiled conda and pip packages for use with Python 3,
running on X86_64 Linux, Mac OS X and Windows. As a fallback for other systems
and platforms we provide pip source packages which are compiled during
installation with pip.
@ -9,7 +9,7 @@ installation with pip.
.. toctree ::
:maxdepth: 1
Anaconda <anaconda>
conda <anaconda>
pip <pip>
.. raw:: html

1
doc/source/install/packages/pip.rst

@ -48,7 +48,6 @@ install Pyrocko:
.. code-block:: bash
# first use apt-get/yum/pacman to install prerequisites (see above), then:
pip install --no-deps pyrocko
**Advantages:**

27
doc/source/install/system/linux/arch.rst

@ -1,24 +1,15 @@
Installation on Arch Linux systems
==================================
These example instructions are for a system-wide installation of Pyrocko under
Arch Linux with default Python 3.
Use the general Linux installation instructions: :doc:`index`
.. code-block:: bash
:caption: **Arch Linux** (e.g. 2021.06.01)
Prerequisites
-------------
sudo pacman -Syu git make gcc patch python python-setuptools \
python-numpy python-scipy python-matplotlib \
python-pyqt5 qt5-webengine qt5-svg qt5-webkit \
python-cairo python-progressbar \
python-requests python-yaml python-jinja \
python-nose python-coverage
The following packages are installed on Arch when running
``python install.py deps system`` in Pyrocko's project directory:
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
sudo python setup.py install
For instructions on how to install Pyrocko on other systems or if the
installation with the above procedure fails, see :doc:`../index` or
:doc:`/install/details`.
.. literalinclude :: /../../prerequisites/prerequisites_arch_python3.sh
:caption: Arch system packages satisfying Pyrocko's requirements.
Executed by ``python install.py deps system``
:lines: 3-

29
doc/source/install/system/linux/centos.rst

@ -1,24 +1,15 @@
Installation on Centos and other rpm-based systems
--------------------------------------------------
==================================================
These example instructions are for a system-wide installation of Pyrocko under
Centos 8 with Python 3. Slight variations may work on other rpm-based systems.
Use the general Linux installation instructions: :doc:`index`
.. code-block:: bash
:caption: e.g. **Centos 8**, Python 3
Prerequisites
-------------
sudo yum install epel-release dnf-plugins-core
sudo yum config-manager --set-enabled powertools
The following packages are installed on Centos systems when running
``python install.py deps system`` in Pyrocko's project directory:
sudo yum install make gcc git python3 python3-yaml python3-matplotlib
sudo yum install python3-numpy python3-scipy python3-requests
sudo yum install python3-jinja2 python3-qt5 python3-matplotlib-qt5
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
sudo python3 setup.py install
For instructions on how to install Pyrocko on other systems or if the
installation with the above procedure fails, see :doc:`../index` or
:doc:`/install/details`.
.. literalinclude :: /../../prerequisites/prerequisites_centos_python3.sh
:caption: Centos system packages satisfying Pyrocko's requirements.
Executed by ``python install.py deps system``
:lines: 3-

28
doc/source/install/system/linux/deb.rst

@ -1,25 +1,15 @@
Installation on Ubuntu, Debian, Mint, ...
=========================================
These example instructions should work for a system-wide installation of
Pyrocko under deb-based Linuxes with Python 3.
Use the general Linux installation instructions: :doc:`index`
.. code-block:: bash
:caption: e.g. **Ubuntu** (14.04, 16.04, 18.04, 20.04), **Debian** (8, 9, 10), **Mint** (17, 18, 19, 20)
Prerequisites
-------------
sudo apt-get install -y make git python3-dev python3-setuptools
sudo apt-get install -y python3-yaml python3-progressbar python3-jinja2
sudo apt-get install -y python3-requests
sudo apt-get install -y python3-numpy python3-numpy-dev python3-scipy python3-matplotlib
sudo apt-get install -y python3-pyqt5 python3-pyqt5.qtopengl python3-pyqt5.qtsvg
# the following may emit an error message which can be ignored
sudo apt-get install -y python3-pyqt5.qtwebengine || sudo apt-get install -y python3-pyqt5.qtwebkit
The following packages are installed on Debian based systems when running
``python install.py deps system`` in Pyrocko's project directory:
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
sudo python3 setup.py install
For instructions on how to install Pyrocko on other systems or if the
installation with the above procedure fails, see :doc:`../index` or
:doc:`/install/details`.
.. literalinclude :: /../../prerequisites/prerequisites_debian_python3.sh
:caption: Debian system packages satisfying Pyrocko's requirements.
Executed by ``python install.py deps system``
:lines: 3-

52
doc/source/install/system/linux/index.rst

@ -1,9 +1,53 @@
Installation under Linux
------------------------
========================
This section lists the commands needed to install Pyrocko and its prerequisites
on some popular Linux distributions
This section lists the commands to install Pyrocko and its prerequisites on
most popular Linux distributions.
System-wide installation from source
------------------------------------
.. code-block:: bash
:caption: **Any Linux**
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
python install.py deps system # installs prerequisites using apt/yum/pacman
python install.py system # installs with pip, but uses system deps
User installation from source into isolated environment
-------------------------------------------------------
.. code-block:: bash
:caption: **Any Linux**
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
python -m venv myenv
source myenv/bin/activate
pip install . # pip auto-resolves prerequisites (!)
pip install --only-binary :all: PyQt5 # for Snuffler
User installation from source using system packages for the prerequisites
-------------------------------------------------------------------------
.. code-block:: bash
:caption: **Any Linux**
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
python -m venv --use-system-packages myenv
source myenv/bin/activate
python install.py deps system # installs prerequisites using apt/yum/pacman
python install.py user # installs with pip, but uses system deps
Distribution specific details and prerequisite package lists
------------------------------------------------------------
.. toctree::
:maxdepth: 1
@ -14,5 +58,5 @@ on some popular Linux distributions
Arch <arch>
For instructions on how to install Pyrocko on other systems or if the
installation with any of the above procedures fails, see
installation with any of the above procedures fails, see :doc:`../index` or
:doc:`/install/details`.

26
doc/source/install/system/linux/suse.rst

@ -1,23 +1,15 @@
Installation on OpenSuse systems
================================
These example instructions should work for a system-wide installation of
Pyrocko under OpenSuse Linuxes with Python 3.
Use the general Linux installation instructions: :doc:`index`
.. code-block:: bash
:caption: **OpenSuse** (e.g. 42.1)
Prerequisites
-------------
sudo zypper -n install make git gcc python3-devel python3-setuptools \
python3-numpy python3-numpy-devel python3-scipy python3-matplotlib \
python3-qt5 \
python3-PyYAML python3-progressbar python3-Jinja2 \
python3-requests
The following packages are installed on OpenSuse systems when running
``python install.py deps system`` in Pyrocko's project directory:
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
sudo python3 setup.py install
For instructions on how to install Pyrocko on other systems or if the
installation with the above procedure fails, see :doc:`../index` or
:doc:`/install/details`.
.. literalinclude :: /../../prerequisites/prerequisites_opensuse_python3.sh
:caption: Opensuse system packages satisfying Pyrocko's requirements.
Executed by ``python install.py deps system``
:lines: 3-

22
doc/source/install/system/mac.rst

@ -13,28 +13,6 @@ Mac OS X with Anaconda
If you are using Anaconda under Mac OS X, see
:doc:`/install/packages/anaconda`.
Mac OS X with MacPorts (Python 3)
----------------------------------
.. note::
This information is slightly outdated. There should be a newer version
of Python 3 available with MacPorts. Help on updating the docs is welcome!
.. code-block:: bash
:caption: e.g. **Mac OS X** (10.6 - 10.10) with **MacPorts** (2.4.2)
sudo port install git
sudo port install python35
sudo port select python python35
sudo port install py35-numpy py35-scipy py35-matplotlib py35-yaml py35-pyqt5 py35-setuptools py35-jinja2 py35-requests
sudo easy_install progressbar
cd ~/src/ # or wherever you keep your source packages
git clone https://git.pyrocko.org/pyrocko/pyrocko.git pyrocko
cd pyrocko
sudo python3 setup.py install --install-scripts=/usr/local/bin
For instructions on how to install Pyrocko on other systems or if the
installation with the above procedure fails, see :doc:`index` or
:doc:`/install/details`.

6
doc/source/install/system/windows.rst

@ -42,10 +42,8 @@ command line and you have a C compiler installed.
git clone https://git.pyrocko.org/pyrocko/pyrocko.git
cd pyrocko
conda install git setuptools m2-tar m2-gzip m2-patch
conda install numpy scipy matplotlib pyqt pyyaml progressbar2 requests jinja2 nose
python setup.py install
python install.py deps conda
python install.py user
For instructions on how to install Pyrocko on other systems or if the
installation with the above procedure fails, see :doc:`index` or

320
install.py

@ -0,0 +1,320 @@
import sys
import os
import re
import platform
import argparse
import shlex
import subprocess
import textwrap
def wrap(s):
lines = []
parts = re.split(r'\n{2,}', s)
for part in parts:
if part.startswith('usage:'):
lines.extend(part.splitlines())
else:
for line in part.splitlines():
if not line:
lines.append(line)
if not line.startswith(' '):
lines.extend(
textwrap.wrap(line, 79,))
else:
lines.extend(
textwrap.wrap(line, 79, subsequent_indent=' '*24))
lines.append('')
return '\n'.join(lines)
def yes(parser):
parser.add_argument(
'-y', '--yes',
help='do not ask any questions (batch mode)',
action='store_true',
default=False)
def quiet(parser):
parser.add_argument(
'-q', '--quiet',
help='do not print executed commands',
action='store_true',
default=False)
commands = {
'description': wrap(
'This is Pyrocko\'s "from source" installation helper.\n\nIt provides '
'shortcut commands to circumvent pip\'s default automatic dependency '
'resolution which may be problematic, e.g. when prerequisites should '
'be supplied either by the system\'s native package manager, or by '
'other non-pip package managers, like conda. '
'\n\n'
'Examples:\n\n'
'For a system-wide installation of Pyrocko "from source", run:'
'\n\n'
' /usr/bin/python install.py deps system\n'
' /usr/bin/python install.py system\n'
'\n'
'For installation "from source" into the currently activated conda '
'environment:\n\n'
' python install.py deps conda\n'
' python install.py user\n'
'\n'
'For installation "from source" into a fresh venv with prerequisites '
'supplied by the systems native package manager:\n\n'
' /usr/bin/python -m venv --system-site-packages myenv\n'
' source myenv/bin/activate\n'
' python install.py deps system\n'
' python install.py user\n'
'\n'
'For installation "from source" into a fresh venv with prerequisites '
'supplied by pip (result is in this case similar to a standard '
'"pip install .").:\n\n'
' /usr/bin/python -m venv myenv\n'
' source myenv/bin/activate\n'
' python install.py deps pip\n'
' python install.py user\n'
'\n'
'For batch installations with no questions add --yes --quiet to the '
'selected subcommands.'
),
'subcommands': {
'deps': {
'help': 'install prerequisites',
'description': wrap(
'Install Pyrocko\'s prerequisites for a subsequent build and '
'install "from source", using the selected installation type. '
'Please consult the --help message of the available '
'subcommands for further information.'),
'subcommands': {
'pip': {
'help': 'install prerequisites using pip',
'description': wrap(
'Install Pyrocko\'s prerequisites using pip into user '
'environment. This command invokes `pip install` with '
'the appropriate list of prerequisites to prepare the '
'user\'s environment for a subsequent build and '
'install of Pyrocko "from source".'),
'arguments': [yes, quiet],
},
'conda': {
'help': 'install prerequisites using conda',
'description': wrap(
'Install Pyrocko\'s prerequisites using conda into '
'into the user\'s environment. This command invokes '
'`conda install` with the appropriate list of '
'prerequisites to prepare the currently selected '
'conda environment for a subsequent build and install '
'of Pyrocko "from source".'),
'arguments': [yes, quiet],
},
'system': {
'help': 'install prerequisites using the system\'s '
'package manager',
'description': wrap(
'Install prerequisites using the system\'s '
'package manager. On supported platforms, this '
'command invokes the system\'s package manager '
'with the appropriate list of system packages to '
'prepare for a subsequent build and install of '
'Pyrocko "from source".'),
'arguments': [yes, quiet],
},
},
},
'user': {
'help': 'install into user or conda environment',
'description': wrap(
'Build Pyrocko "from source" and install it into user or '
'conda environment. Use this installation method if you do '
'not have "sudo" access on your system, or if you want to '
'install into a virtual, or a conda environment. The selected '
'options will prevent pip from automatically installing '
'dependencies. Use one of the `deps` subcommands to satisfy '
'Pyrocko\'s requirements before running this installer.'),
'arguments': [yes, quiet],
},
'system': {
'help': 'install system-wide',
'description': wrap(
'Build Pyrocko "from source" and install it system-wide for '
'all users. Requires "sudo" access. The selected options will '
'prevent pip from automatically installing dependencies. Use '
'the "deps system" subcommand to satisfy ' 'Pyrocko\'s '
'requirements with system packages before running this '
'installer.'),
'arguments': [yes, quiet],
},
}
}
def die(message):
sys.exit('Error: %s' % message)
def confirm(s, force, quiet):
if not force:
try:
return input(
'Execute:\n\n%s\n\nProceed? [y/n] ' % s).lower() == 'y'
except KeyboardInterrupt:
print()
return False
elif not quiet:
print('Running:\n\n%s\n\n' % s)
return True
else:
return True
def do_command(cmd, force=False, quiet=False):
qcmd = indent(' '.join(shlex.quote(s) for s in cmd))
if confirm(qcmd, force, quiet):
try:
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError:
die('Error: Called process exited with error.')
except OSError as e:
die('Could not run the requested command: %s' % e)
else:
sys.exit('Aborted.')
def indent(s):
return '\n'.join(' ' + line for line in s.splitlines())
def do_shell_script(fn, force=False, quiet=False):
qscript = indent(open(fn, 'r').read())
if confirm(qscript, force, quiet):
os.execl('/bin/sh', 'sh', fn)
else:
sys.exit('Aborted.')
def cmd_deps_conda(parser, args):
if platform.system().lower() == 'windows':
requirements = 'requirements-conda-windows.txt'
else:
requirements = 'requirements-conda.txt'
do_command(
['conda', 'install', '--file', requirements],
force=args.yes, quiet=args.quiet)
def cmd_deps_pip(parser, args):
do_command(
['pip', 'install', '-r', 'requirements-all.txt'],
force=args.yes, quiet=args.quiet)
def cmd_deps_system(parser, args):
distribution = ''
try:
distribution = platform.linux_distribution()[0].lower().rstrip()
except Exception:
pass
if not distribution:
try:
uname = platform.uname()
if uname[2].find('arch') != -1:
distribution = 'arch'
elif uname[3].lower().find('ubuntu') != -1:
distribution = 'ubuntu'
except Exception:
pass
if not distribution:
sys.exit(
'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)
do_shell_script(fn, force=args.yes, quiet=args.quiet)
def cmd_user(parser, args):
do_command([
'pip', 'install', '--no-deps', '--no-build-isolation',
'--force-reinstall', '.'],
force=args.yes, quiet=args.quiet)
def cmd_system(parser, args):
do_command([
'sudo', 'pip', 'install', '--no-deps', '--no-build-isolation',
'--force-reinstall', '.'],
force=args.yes, quiet=args.quiet)
def print_help(parser, args):
parser.print_help()
def kwargs(d, keys):
return dict((k, d[k]) for k in keys if k in d)
class HelpFormatter(argparse.RawDescriptionHelpFormatter):
def __init__(self, *args, **kwargs):
kwargs['width'] = 79
argparse.RawDescriptionHelpFormatter.__init__(
self, *args, **kwargs)
def make_parser(d, name=None, parent=None, path=()):
if parent is None:
parser = argparse.ArgumentParser(
formatter_class=HelpFormatter,
**kwargs(d, ['description']))
parser.set_defaults(func=print_help, parser=parser)
else:
parser = parent.add_parser(
name,
formatter_class=HelpFormatter,
**kwargs(d, ['help', 'description']))
if 'arguments' in d:
for func in d['arguments']:
func(parser)
if 'subcommands' in d:
subparsers = parser.add_subparsers(title='subcommands')
for name, d in d['subcommands'].items():
subparser = make_parser(d, name, subparsers, path + (name,))
subparser.set_defaults(
func=globals().get(
'cmd_%s' % '_'.join(path + (name,)),
print_help),
parser=subparser)
return parser
parser = make_parser(commands)
args = parser.parse_args()
args.func(args.parser, args)

66
install_prerequisites.py

@ -1,66 +0,0 @@
#!/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.
Options:
--yes Do not ask any questions (batch mode).
--help Show this help message and exit
''')
force_yes = '--yes' in sys.argv[1:]
distribution = ''
try:
distribution = platform.linux_distribution()[0].lower().rstrip()
except Exception:
pass
if not distribution:
try:
uname = platform.uname()
if uname[2].find('arch') != -1:
distribution = 'arch'
elif uname[3].lower().find('ubuntu') != -1:
distribution = 'ubuntu'
except Exception:
pass
if not distribution:
sys.exit(
'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:
try:
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':
sys.exit(0)
os.execl('/bin/sh', 'sh', fn)

4
maintenance/vagrant/arch/inside.sh

@ -33,8 +33,8 @@ ln -s "/vagrant/example_run_dir" "test/example_run_dir"
mkdir -p "$HOME/.config/matplotlib"
echo "backend : agg" > "$HOME/.config/matplotlib/matplotlibrc"
python3 install_prerequisites.py --yes && \
sudo pip install --no-deps --force-reinstall --no-build-isolation . && \
python3 install.py deps system --yes && \
python3 install.py system --yes && \
python3 -m pyrocko.print_version deps >> "$outfile_py3" && \
xvfb-run -s '-screen 0 640x480x24' python3 -m nose "$thetest" > >(tee -a "$outfile_py3") 2> >(tee -a "$outfile_py3" >&2) || \
/bin/true

4
maintenance/vagrant/centos-7/inside.sh

@ -38,8 +38,8 @@ cd "$pyrockodir"
ln -s "/vagrant/pyrocko-test-data" "test/data"
ln -s "/vagrant/example_run_dir" "test/example_run_dir"
pip install -r requirements-all.txt
pip install --no-deps --force-reinstall --no-build-isolation . && \
python install.py deps conda --yes && \
python install.py user --yes && \
python -m pyrocko.print_version deps >> "$outfile_py3" && \
python -m nose "$thetest" > >(tee -a "$outfile_py3") 2> >(tee -a "$outfile_py3" >&2) || \
/bin/true

2
maintenance/vagrant/centos-8/inside.sh

@ -34,7 +34,7 @@ ln -s "/vagrant/example_run_dir" "test/example_run_dir"
python3=/usr/bin/python3
pip3=/usr/bin/pip3
sudo "$python3" install_prerequisites.py --yes && \
"$python3" install.py deps system --yes && \
sudo "$pip3" install --no-deps --force-reinstall . && \
"$python3" -m pyrocko.print_version deps >> "$outfile_py3" && \
"$python3" -m nose "$thetest" > >(tee -a "$outfile_py3") 2> >(tee -a "$outfile_py3" >&2) || \

4
maintenance/vagrant/debian-10/inside.sh

@ -34,8 +34,8 @@ cd "$pyrockodir"
ln -s "/vagrant/pyrocko-test-data" "test/data"
ln -s "/vagrant/example_run_dir" "test/example_run_dir"
sudo python3 install_prerequisites.py --yes && \
sudo pip3 install --no-deps --force-reinstall --no-build-isolation . && \
python3 install.py deps system --yes && \
python3 install.py system --yes && \
python3 -m pyrocko.print_version deps >> "$outfile_py3" && \
xvfb-run -s '-screen 0 640x480x24' python3 -m nose "$thetest" > >(tee -a "$outfile_py3") 2> >(tee -a "$outfile_py3" >&2) || \
/bin/true

2
maintenance/vagrant/debian-9/inside.sh

@ -34,7 +34,7 @@ cd "$pyrockodir"
ln -s "/pyrocko-test-data" "test/data"
ln -s "/vagrant/example_run_dir" "test/example_run_dir"
sudo python3 install_prerequisites.py --yes && \
python3 install.py deps system --yes && \
sudo pip3 install --no-deps --force-reinstall . && \
python3 -m pyrocko.print_version deps >> "$outfile_py3" && \
xvfb-run -s '-screen 0 640x480x24' python3 -m nose "$thetest" > >(tee -a "$outfile_py3") 2> >(tee -a "$outfile_py3" >&2) || \

3
maintenance/vagrant/osx/inside.sh

@ -63,7 +63,8 @@ conda install -y \
jinja2 \
nose
sudo pip3 install --no-deps --force-reinstall --no-build-isolation . && \
python3 install.py deps conda --yes && \
python3 install.py user --yes && \
python3 -m pyrocko.print_version deps >> "$outfile" && \
python3 -m nose "$thetest" > >(tee -a "$outfile") 2> >(tee -a "$outfile" >&2) || \
/usr/bin/true

2
maintenance/vagrant/ubuntu-16.04/inside.sh

@ -35,7 +35,7 @@ cd "$pyrockodir"
ln -s "/pyrocko-test-data" "test/data"
ln -s "/vagrant/example_run_dir" "test/example_run_dir"
sudo python3 install_prerequisites.py --yes && \
python3 install.py deps system --yes && \
sudo pip3 install --no-deps --force-reinstall . && \
python3 -m pyrocko.print_version deps >> "$outfile_py3" && \
xvfb-run -s '-screen 0 640x480x24' python3 -m nose "$thetest" > >(tee -a "$outfile_py3") 2> >(tee -a "$outfile_py3" >&2) || \

2
maintenance/vagrant/ubuntu-18.04/inside.sh

@ -32,7 +32,7 @@ cd "$pyrockodir"
ln -s "/pyrocko-test-data" "test/data"
ln -s "/vagrant/example_run_dir" "test/example_run_dir"
sudo python3 install_prerequisites.py --yes && \
python3 install.py deps system --yes && \
sudo pip3 install --no-deps --force-reinstall . && \
python3 -m pyrocko.print_version deps >> "$outfile_py3" && \
xvfb-run -s '-screen 0 640x480x24' python3 -m nose "$thetest" > >(tee -a "$outfile_py3") 2> >(tee -a "$outfile_py3" >&2) || \

4
maintenance/vagrant/ubuntu-20.04/inside.sh

@ -32,8 +32,8 @@ cd "$pyrockodir"
ln -s "/pyrocko-test-data" "test/data"
ln -s "/vagrant/example_run_dir" "test/example_run_dir"
sudo python3 install_prerequisites.py --yes && \
sudo pip3 install --no-deps --force-reinstall --no-build-isolation . && \
python3 install.py deps system --yes && \
python3 install.py system && \
python3 -m pyrocko.print_version deps >> "$outfile_py3" && \
xvfb-run -s '-screen 0 640x480x24' python3 -m nose "$thetest" > >(tee -a "$outfile_py3") 2> >(tee -a "$outfile_py3" >&2) || \
/bin/true

15
prerequisites/prerequisites_debian_python3.sh

@ -1,10 +1,9 @@
#!/bin/sh
#!/bin/bash
sudo apt-get update -y
sudo apt-get install -y make git python3-dev python3-setuptools python3-pip python3-wheel
sudo apt-get install -y python3-numpy python3-numpy-dev python3-scipy python3-matplotlib
sudo apt-get install -y python3-pyqt5 python3-pyqt5.qtopengl python3-pyqt5.qtsvg
sudo apt-get install -y python3-pyqt5.qtwebengine || sudo apt-get install -y python3-pyqt5.qtwebkit
sudo apt-get install -y python3-yaml python3-progressbar python3-jinja2
sudo apt-get install -y python3-requests
sudo apt-get install -y python3-coverage python3-nose
sudo apt-get install -y make git python3-dev python3-setuptools python3-pip \
python3-wheel python3-numpy python3-numpy-dev python3-scipy \
python3-matplotlib python3-pyqt5 python3-pyqt5.qtopengl \
python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-yaml \
python3-progressbar python3-jinja2 python3-requests python3-coverage \
python3-nose

2
requirements-all.txt

@ -1,3 +1,5 @@
setuptools
wheel
numpy>=1.8
scipy
pyyaml

13
requirements-conda-windows.txt

@ -0,0 +1,13 @@
m2-tar
m2-gzip
m2-patch
setuptools
wheel
numpy>=1.8
scipy
pyyaml
matplotlib
progressbar2
requests
nose
jinja2

11
requirements-conda.txt

@ -0,0 +1,11 @@
setuptools
wheel
numpy>=1.8
scipy
pyyaml
matplotlib
progressbar2
requests
nose
jinja2
pyqt
Loading…
Cancel
Save