File: cli.py

package info (click to toggle)
dh-fortran 0.45
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 492 kB
  • sloc: f90: 5,686; perl: 531; python: 296; makefile: 79; sh: 7
file content (60 lines) | stat: -rw-r--r-- 957 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/python3
"""
Driver for dh-fortran

Copyright (C) 2025 Alastair McKinstry <mckinstry@debian.org>
Released under the GPL-3 Gnu Public License.
"""


import click
import os
import sys
import dhfortran.compilers


from contextlib import contextmanager


@contextmanager
def errhandler(*args, **kwargs):
    try:
        # print(*args, **kwargs)
        # breakpoint() here, or maybe dump on DH_VERBOSE?
        yield
    except Exception as ex:
        print(f"Error: {ex}")
        sys.exit(1)


@click.group()
def dh_fortran():
    pass


@click.command("get_fc_flags")
@click.option("--fc")
def get_fc_flags(fc):
    print(fc)


@click.command("get_fc_default")
def get_fc_default():
    pass


@click.command("get_fc_optional")
def get_fc_optional():
    pass


@click.command("get_fc_exe")
@click.option("--flavor")
def get_fc_exe(flavor):
    pass


@click.command("get_fc_vendor")
@click.option("--flavor")
def get_fc_vendor(flavor):
    pass