• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rjfarmer / gfModParser / 14693472217

27 Apr 2025 03:17PM UTC coverage: 78.481% (-0.3%) from 78.779%
14693472217

push

github

rjfarmer
Add support for gfortran 15

17 of 24 new or added lines in 2 files covered. (70.83%)

558 of 711 relevant lines covered (78.48%)

0.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/gfModParser/utils.py
1
# SPDX-License-Identifier: GPL-2.0+
2

3
import numpy as np
1✔
4
import itertools
1✔
5
import subprocess
1✔
6
from packaging.version import Version
1✔
7

8
try:
1✔
9
    import pyquadp as pyq
1✔
10

11
    PYQ_IMPORTED = True
×
12
except ImportError:
1✔
13
    PYQ_IMPORTED = False
1✔
14

15

16
"""
1✔
17
Map gfortran version to Mod file version
18
"""
19

20

21
def gfortran_mod_map(version):
1✔
22
    if version < Version("4.8.1"):
1✔
NEW
23
        return 9
×
24
    elif version < Version("4.9.2"):
1✔
NEW
25
        return 10
×
26
    elif version < Version("5.1.0"):
1✔
NEW
27
        return 12
×
28
    elif version < Version("8.0.0"):
1✔
NEW
29
        return 14
×
30
    elif version < Version("15.0.0"):
1✔
31
        return 15
1✔
NEW
32
    elif version.major == 15:
×
NEW
33
        return 16
×
34
    else:
NEW
35
        raise ValueError(f"Unknown gfortran version {version}")
×
36

37

38
def string_clean(string):
1✔
39
    if string is None:
1✔
40
        return
1✔
41
    if string.startswith("'") or string.startswith('"'):
1✔
42
        string = string[1:]
1✔
43
    if string.endswith("'") or string.endswith('"'):
1✔
44
        string = string[:-1]
1✔
45

46
    return string
1✔
47

48

49
def hextofloat(s, kind=4):
1✔
50
    # Given hex like parameter '0.12decde@9' returns 5065465344.0
51
    man, exp = s.split("@")
1✔
52
    exp = int(exp)
1✔
53
    decimal = man.index(".")
1✔
54
    negative = man[0] == "-"
1✔
55
    man = man[decimal + 1 :]
1✔
56
    man = man.ljust(exp, "0")
1✔
57
    man = man[:exp] + "." + man[exp:]
1✔
58
    man = man + "P0"
1✔
59
    if negative:
1✔
60
        man = "-" + man
1✔
61
    if PYQ_IMPORTED and kind == 16:
1✔
62
        return pyq.qfloat.fromhex(man)
×
63
    elif kind == 8:
1✔
64
        return np.double.fromhex(man)
1✔
65
    else:
66
        return float.fromhex(man)
1✔
67

68

69
def gfortran_version():
1✔
70
    x = (
1✔
71
        subprocess.run(["gfortran", "-v"], capture_output=True)
72
        .stderr.decode()
73
        .split("\n")
74
    )
75
    for i in x:
1✔
76
        if "gcc version" in i:
1✔
77
            v = i.split()[2]
1✔
78
            return Version(v)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc