Skip to content

Commit

Permalink
Merge branch 'compiler_wrapper' into linker-lib-flags
Browse files Browse the repository at this point in the history
  • Loading branch information
hiker committed Nov 21, 2024
2 parents 602d57b + 68ccc4c commit 0464dc5
Show file tree
Hide file tree
Showing 72 changed files with 222 additions and 2,496 deletions.
10 changes: 9 additions & 1 deletion source/fab/tools/compiler_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,20 @@ def __str__(self):
return f"{type(self).__name__}({self._compiler.name})"

def get_version(self) -> Tuple[int, ...]:
"""
"""Determines the version of the compiler. The implementation in the
compiler wrapper additionally ensures that the wrapper compiler and
compiler wrapper report both the same version. This verifies that the
user's build environment is as expected. For example, this will check
if mpif90 from mpif90-ifort does indeed invoke ifort (and not e.g.
gfortran).
:returns: a tuple of at least 2 integers, representing the version
e.g. (6, 10, 1) for version '6.10.1'.
:raises RuntimeError: if the compiler was not found, or if it returned
an unrecognised output from the version command.
:raises RuntimeError: if the compiler wrapper and wrapped compiler
have different version numbers.
"""

if self._version is not None:
Expand Down
62 changes: 35 additions & 27 deletions source/fab/tools/versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,40 @@
# For further details please refer to the file COPYRIGHT
# which you should have received as part of this distribution
##############################################################################

"""This file contains the base class for versioning tools like git and
subversion. It also contains derived classes Git, Subversion, and Fcm.
"""

Versioning tools such as Subversion and Git.
"""
from abc import ABC
from pathlib import Path
from typing import Dict, List, Optional, Union

from fab.tools.category import Category
from fab.tools.tool import Tool


class Versioning(Tool):
'''This is the base class for versioning tools like git and svn.
:param name: the name of the tool.
:param exec_name: the name of the executable of this tool.
:param category: the category to which this tool belongs).
'''

class Versioning(Tool, ABC):
"""
Base class for versioning tools like Git and Subversion.
"""
def __init__(self, name: str,
exec_name: Union[str, Path],
category: Category):
"""
Constructor.
:param name: Display name of this tool.
:param exec_name: Executable for this tool.
:param category: Tool belongs to this category.
"""
super().__init__(name, exec_name, category,
availability_option="help")


# =============================================================================
class Git(Versioning):
'''This is the base class for git.
'''
"""
Interface to Git version control system.
"""

def __init__(self):
super().__init__("git", "git",
Expand Down Expand Up @@ -111,20 +114,23 @@ def merge(self, dst: Union[str, Path],

# =============================================================================
class Subversion(Versioning):
'''This is the base class for subversion. Note that this is also the
base class for FCM, so it allows overwriting name, exec_name and
category, but will default to use svn.
:param name: name of the tool, defaults to subversion.
:param exec_name: name of the executable, defaults to "svn".
:param category: the category, FCM or SUBVERSION (the latter is
the default)
'''

"""
Interface to the Subversion version control system.
"""
def __init__(self, name: Optional[str] = None,
exec_name: Optional[Union[str, Path]] = None,
category: Category = Category.SUBVERSION):
name = name or "subversion"
"""
Constructor.
This is class is extended by the FCM interface which is why name and
executable are mutable.
:param name: Tool name, defaults to "subversion."
:param exec_name: Tool executable, defaults to "svn."
:param category: Tool category, defaults to SUBVERSION.
"""
name = name or "Subversion"
exec_name = exec_name or "svn"
super().__init__(name, exec_name, category=category)

Expand Down Expand Up @@ -166,7 +172,9 @@ def export(self, src: Union[str, Path],
:param dst: destination path.
:param revision: revision to export.
'''
self.execute(['export', '--force'], revision, [str(src), str(dst)])
self.execute(['export', '--force'],
revision,
[str(src), str(dst)])

def checkout(self, src: Union[str, Path],
dst: Union[str, Path],
Expand Down Expand Up @@ -214,4 +222,4 @@ class Fcm(Subversion):
'''

def __init__(self):
super().__init__("fcm", "fcm", Category.FCM)
super().__init__("FCM", "fcm", Category.FCM)
33 changes: 0 additions & 33 deletions tests-old/TestCases/CompiletimeDependency/Makefile

This file was deleted.

6 changes: 0 additions & 6 deletions tests-old/TestCases/CompiletimeDependency/bisto.h

This file was deleted.

20 changes: 0 additions & 20 deletions tests-old/TestCases/CompiletimeDependency/hillfort.F90

This file was deleted.

17 changes: 0 additions & 17 deletions tests-old/TestCases/CompiletimeDependency/looper.c

This file was deleted.

6 changes: 0 additions & 6 deletions tests-old/TestCases/CompiletimeDependency/oxo.h

This file was deleted.

21 changes: 0 additions & 21 deletions tests-old/TestCases/CompiletimeDependency/support_mod.f90

This file was deleted.

56 changes: 0 additions & 56 deletions tests-old/TestCases/CompiletimeDependency/with-beef.mk

This file was deleted.

55 changes: 0 additions & 55 deletions tests-old/TestCases/CompiletimeDependency/without-beef.mk

This file was deleted.

8 changes: 0 additions & 8 deletions tests-old/TestCases/FortranSourceTree/ReadMe

This file was deleted.

23 changes: 0 additions & 23 deletions tests-old/TestCases/FortranSourceTree/fpp_one.f90

This file was deleted.

Loading

0 comments on commit 0464dc5

Please sign in to comment.