File: __init__.py

package info (click to toggle)
metview-python 1.16.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,896 kB
  • sloc: python: 11,306; makefile: 84; ansic: 51; sh: 7
file content (44 lines) | stat: -rw-r--r-- 1,373 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# (C) Copyright 2017- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

# requires a Python 3 interpreter
import os
import sys

if sys.version_info[0] < 3:  # pragma: no cover
    raise EnvironmentError(
        "Metview's Python interface requires Python 3. You are using Python "
        + repr(sys.version_info)
    )


# if the user has started via "python -m metview selfcheck"
# then we do not want to import anything yet because we want to
# catch errors differently

if len(sys.argv) != 2 or sys.argv[0] != "-m" or sys.argv[1] != "selfcheck":
    try:
        from . import bindings as _bindings

        _bindings.bind_functions(globals(), module_name=__name__)

        # Remove "_bindings" from the public API.
        del _bindings

        from . import gallery
        from . import style
        from metview.metviewpy import indexer
        from . import title
        from . import layout
        from . import ui
        from . import compat

    except Exception as exp:
        if "METVIEW_PYTHON_ONLY" not in os.environ:
            raise exp