This repository has been archived by the owner on Jun 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feature/#151/represent-local-env
- Loading branch information
Showing
185 changed files
with
1,581 additions
and
1,206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .build_target_cls import * | ||
from .compiler_instance_targets import * |
32 changes: 16 additions & 16 deletions
32
...build_system/build_target/build_target.py → ...d_system/build_target/build_target_cls.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletions
14
conf/script/src/build_system/build_target/compiler_instance_targets.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import dataclasses | ||
__all__ = ['CompilerInstanceTargets'] | ||
|
||
import build_system.build_target.build_target | ||
import build_system.compiler.installed_instance | ||
from dataclasses import dataclass | ||
|
||
from .build_target_cls import * | ||
from ..compiler import * | ||
|
||
@dataclasses.dataclass(order=True, frozen=True) | ||
|
||
@dataclass(order=True, frozen=True) | ||
class CompilerInstanceTargets: | ||
compiler_instance: build_system.compiler.installed_instance.CompilerInstance | ||
build_targets: list[build_system.build_target.build_target.BuildTarget] | ||
compiler_instance: CompilerInstance | ||
build_targets: list[BuildTarget] | ||
|
||
def __iter__(self): | ||
return self.build_targets.__iter__() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .location import * | ||
from .version import * |
20 changes: 11 additions & 9 deletions
20
conf/script/src/build_system/cmd/compiler/host/get_info/cli.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
__all__ = ['fetch_compiler_info', | ||
'fetch_compiler_info_with_default_path'] | ||
|
||
import argparse | ||
from pathlib import Path | ||
from typing import Any, Callable, Optional | ||
|
||
import build_system.compiler.family | ||
import utils.cli.arg_parsing | ||
import utils.cli.try_cmd | ||
from build_system.compiler import * | ||
from ext.cli import * | ||
|
||
|
||
def fetch_compiler_info(compiler_family: build_system.compiler.family.CompilerFamily, | ||
def fetch_compiler_info(compiler_family: CompilerFamily, | ||
fetch_compiler_info_func: Callable[[Optional[Path]], Any], | ||
default_compiler_path: Optional[Path] = None, | ||
desc_compiler_info: str = 'version', | ||
help_path_meaning: str = 'executable') -> None: | ||
arg_parser = argparse.ArgumentParser(description=f"Fetches {compiler_family.name} compiler's {desc_compiler_info}") | ||
utils.cli.arg_parsing.add_optional_path_arg(arg_parser, path_arg_default_value=default_compiler_path, | ||
path_arg_help=f"The {compiler_family.name} compiler's {help_path_meaning} path") | ||
add_optional_path_arg(arg_parser, path_arg_default_value=default_compiler_path, | ||
path_arg_help=f"The {compiler_family.name} compiler's {help_path_meaning} path") | ||
|
||
compiler_path: Optional[Path] = utils.cli.arg_parsing.parse_optional_path_arg(arg_parser) | ||
compiler_path: Optional[Path] = parse_optional_path_arg(arg_parser) | ||
arg_parser.parse_args() | ||
|
||
def cli_cmd(): | ||
compiler_info = fetch_compiler_info_func(compiler_path) | ||
print(compiler_info, end=str()) | ||
|
||
utils.cli.try_cmd.try_cmd_except_managed_errors(cli_cmd, arg_parser) | ||
try_cmd_except_managed_errors(cli_cmd, arg_parser) | ||
|
||
|
||
def fetch_compiler_info_with_default_path(compiler_family: build_system.compiler.family.CompilerFamily, fetch_compiler_info_func: Callable[[Path], Any]) -> None: | ||
def fetch_compiler_info_with_default_path(compiler_family: CompilerFamily, fetch_compiler_info_func: Callable[[Path], Any]) -> None: | ||
fetch_compiler_info(compiler_family, fetch_compiler_info_func, compiler_family.value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .msvc import * |
3 changes: 2 additions & 1 deletion
3
conf/script/src/build_system/cmd/compiler/host/get_info/location/msvc/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from build_system.cmd.compiler.host.get_info.location.msvc.impl import find_location | ||
from .cli import * | ||
from .impl import * |
8 changes: 4 additions & 4 deletions
8
conf/script/src/build_system/cmd/compiler/host/get_info/location/msvc/__main__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import build_system.cmd.compiler.host.get_info.location.msvc.cli | ||
import utils.cli.main | ||
from ext.cli import * | ||
from . import * | ||
|
||
|
||
def main(): | ||
build_system.cmd.compiler.host.get_info.location.msvc.cli.find() | ||
cli_find_msvc_location() | ||
|
||
|
||
utils.cli.main.wrap_main(main) | ||
wrap_main(main) |
21 changes: 12 additions & 9 deletions
21
conf/script/src/build_system/cmd/compiler/host/get_info/location/msvc/cli.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
__all__ = ['cli_find_msvc_location'] | ||
|
||
from pathlib import Path | ||
from typing import NoReturn, Optional, Union | ||
|
||
import build_system.cmd.compiler.host.get_info.cli | ||
import build_system.compiler.family | ||
import utils.error.cls_def | ||
from ...cli import * | ||
from .impl import * | ||
from build_system.compiler import * | ||
from ext.error import * | ||
|
||
|
||
def _find_no_arg(compiler_installation_path: Optional[Path] = None) -> Union[Path, NoReturn]: | ||
compiler_installation_path: Optional[Path] = build_system.cmd.compiler.host.get_info.location.msvc.find_location(compiler_installation_path) | ||
compiler_installation_path: Optional[Path] = find_msvc_location(compiler_installation_path) | ||
|
||
if compiler_installation_path is None: | ||
raise utils.error.cls_def.CompilerNotFoundError() | ||
raise CompilerNotFoundError() | ||
|
||
return compiler_installation_path | ||
|
||
|
||
def find() -> None: | ||
build_system.cmd.compiler.host.get_info.cli.fetch_compiler_info(build_system.compiler.family.CompilerFamily.MSVC, | ||
_find_no_arg, desc_compiler_info='location', | ||
help_path_meaning='installation') | ||
def cli_find_msvc_location() -> None: | ||
fetch_compiler_info(CompilerFamily.MSVC, | ||
_find_no_arg, desc_compiler_info='location', | ||
help_path_meaning='installation') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .clang import * | ||
from .gcc import * | ||
from .msvc import * |
3 changes: 2 additions & 1 deletion
3
conf/script/src/build_system/cmd/compiler/host/get_info/version/clang/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from build_system.cmd.compiler.host.get_info.version.clang.impl import fetch_version | ||
from .cli import * | ||
from .impl import * |
8 changes: 4 additions & 4 deletions
8
conf/script/src/build_system/cmd/compiler/host/get_info/version/clang/__main__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import build_system.cmd.compiler.host.get_info.version.clang.cli | ||
import utils.cli.main | ||
from ext.cli import * | ||
from . import * | ||
|
||
|
||
def main(): | ||
build_system.cmd.compiler.host.get_info.version.clang.cli.fetch_gcc_version() | ||
cli_fetch_clang_version() | ||
|
||
|
||
utils.cli.main.wrap_main(main) | ||
wrap_main(main) |
10 changes: 5 additions & 5 deletions
10
conf/script/src/build_system/cmd/compiler/host/get_info/version/clang/cli.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from pathlib import Path | ||
__all__ = ['cli_fetch_clang_version'] | ||
|
||
import build_system.cmd.compiler.host.get_info.version.gnu.cli | ||
import build_system.compiler.family | ||
from build_system.compiler import * | ||
from ..gnu import * | ||
|
||
|
||
def fetch_gcc_version() -> None: | ||
build_system.cmd.compiler.host.get_info.version.gnu.cli.fetch_version(compiler_family=build_system.compiler.family.CompilerFamily.CLANG) | ||
def cli_fetch_clang_version() -> None: | ||
cli_fetch_gnu_version(compiler_family=CompilerFamily.CLANG) |
11 changes: 6 additions & 5 deletions
11
conf/script/src/build_system/cmd/compiler/host/get_info/version/clang/impl.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import build_system.cmd.compiler.host.get_info.version.gnu | ||
import build_system.compiler.family | ||
import build_system.compiler.version | ||
__all__ = ['fetch_clang_version'] | ||
|
||
from build_system.compiler import * | ||
from ..gnu import * | ||
|
||
def fetch_version() -> build_system.compiler.version.CompilerVersion: | ||
return build_system.cmd.compiler.host.get_info.version.gnu.fetch_version(build_system.compiler.family.CompilerFamily.CLANG.value) | ||
|
||
def fetch_clang_version() -> CompilerVersion: | ||
return fetch_gnu_version(CompilerFamily.CLANG.value) |
19 changes: 9 additions & 10 deletions
19
conf/script/src/build_system/cmd/compiler/host/get_info/version/fetch_by_criteria.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
import build_system.cmd.compiler.host.get_info.version.clang | ||
import build_system.cmd.compiler.host.get_info.version.gcc | ||
import build_system.cmd.compiler.host.get_info.version.msvc | ||
import build_system.compiler.family | ||
import build_system.compiler.version | ||
__all__ = ['fetch_compiler_version_by_family'] | ||
|
||
fetch_func_by_compiler_family = {build_system.compiler.family.CompilerFamily.MSVC: build_system.cmd.compiler.host.get_info.version.msvc.fetch_version, | ||
build_system.compiler.family.CompilerFamily.CLANG: build_system.cmd.compiler.host.get_info.version.clang.fetch_version, | ||
build_system.compiler.family.CompilerFamily.GCC: build_system.cmd.compiler.host.get_info.version.gcc.fetch_version} | ||
from build_system.compiler import * | ||
from . import * | ||
|
||
_fetch_func = {CompilerFamily.MSVC: fetch_msvc_version, | ||
CompilerFamily.CLANG: fetch_clang_version, | ||
CompilerFamily.GCC: fetch_gcc_version} | ||
|
||
def fetch_by_compiler_family(compiler_family: build_system.compiler.family.CompilerFamily) -> build_system.compiler.version.CompilerVersion: | ||
return fetch_func_by_compiler_family[compiler_family]() | ||
|
||
def fetch_compiler_version_by_family(compiler_family: CompilerFamily) -> CompilerVersion: | ||
return _fetch_func[compiler_family]() |
3 changes: 2 additions & 1 deletion
3
conf/script/src/build_system/cmd/compiler/host/get_info/version/gcc/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from build_system.cmd.compiler.host.get_info.version.gcc.impl import fetch_version | ||
from .cli import * | ||
from .impl import * |
8 changes: 4 additions & 4 deletions
8
conf/script/src/build_system/cmd/compiler/host/get_info/version/gcc/__main__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import build_system.cmd.compiler.host.get_info.version.gcc.cli | ||
import utils.cli.main | ||
from ext.cli import * | ||
from . import * | ||
|
||
|
||
def main(): | ||
build_system.cmd.compiler.host.get_info.version.gcc.cli.fetch_gcc_version() | ||
cli_fetch_gcc_version() | ||
|
||
|
||
utils.cli.main.wrap_main(main) | ||
wrap_main(main) |
10 changes: 5 additions & 5 deletions
10
conf/script/src/build_system/cmd/compiler/host/get_info/version/gcc/cli.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from pathlib import Path | ||
__all__ = ['cli_fetch_gcc_version'] | ||
|
||
import build_system.cmd.compiler.host.get_info.version.gnu.cli | ||
import build_system.compiler.family | ||
from build_system.compiler import * | ||
from ..gnu import * | ||
|
||
|
||
def fetch_gcc_version() -> None: | ||
build_system.cmd.compiler.host.get_info.version.gnu.cli.fetch_version(compiler_family=build_system.compiler.family.CompilerFamily.GCC) | ||
def cli_fetch_gcc_version() -> None: | ||
cli_fetch_gnu_version(compiler_family=CompilerFamily.GCC) |
11 changes: 6 additions & 5 deletions
11
conf/script/src/build_system/cmd/compiler/host/get_info/version/gcc/impl.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import build_system.cmd.compiler.host.get_info.version.gnu | ||
import build_system.compiler.family | ||
import build_system.compiler.version | ||
__all__ = ['fetch_gcc_version'] | ||
|
||
from build_system.compiler import * | ||
from ..gnu import * | ||
|
||
def fetch_version() -> build_system.compiler.version.CompilerVersion: | ||
return build_system.cmd.compiler.host.get_info.version.gnu.fetch_version(build_system.compiler.family.CompilerFamily.GCC.value) | ||
|
||
def fetch_gcc_version() -> CompilerVersion: | ||
return fetch_gnu_version(CompilerFamily.GCC.value) |
24 changes: 14 additions & 10 deletions
24
conf/script/src/build_system/cmd/compiler/host/get_info/version/generic_fetch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
__all__ = ['verify_compiler_path', | ||
'interpret_fetched_compiler_version', | ||
'fetch_compiler_version'] | ||
|
||
from pathlib import Path | ||
from typing import AnyStr, Callable | ||
|
||
import build_system.compiler.version | ||
import utils.cmd_integrity | ||
import utils.error.cls_def | ||
from build_system.compiler import * | ||
from ext.cmd_integrity import * | ||
from ext.error import * | ||
|
||
|
||
def assure_path_integrity(compiler_path: Path) -> None: | ||
def verify_compiler_path(compiler_path: Path) -> None: | ||
"""Assures the integrity of the supplied :param:`compiler_path` | ||
:param compiler_path: The path to the compiler executable file. It must not be a directory. | ||
""" | ||
if not utils.cmd_integrity.cmd_exists(str(compiler_path)): | ||
raise utils.error.cls_def.CompilerNotFoundError() | ||
if not cmd_exists(str(compiler_path)): | ||
raise CompilerNotFoundError() | ||
|
||
|
||
def interpret_fetched_version(compiler_version_str: AnyStr) -> build_system.compiler.version.CompilerVersion: | ||
return build_system.compiler.version.CompilerVersion.create_from_str(compiler_version_str.strip()) | ||
def interpret_fetched_compiler_version(compiler_version_str: AnyStr) -> CompilerVersion: | ||
return CompilerVersion.create_from_str(compiler_version_str.strip()) | ||
|
||
|
||
def fetch(compiler: Path, fetch_compiler_version_func: Callable[[Path], AnyStr]) -> build_system.compiler.version.CompilerVersion: | ||
def fetch_compiler_version(compiler: Path, fetch_compiler_version_func: Callable[[Path], AnyStr]) -> CompilerVersion: | ||
compiler_version_str: AnyStr = fetch_compiler_version_func(compiler) | ||
return interpret_fetched_version(compiler_version_str) | ||
return interpret_fetched_compiler_version(compiler_version_str) |
3 changes: 2 additions & 1 deletion
3
conf/script/src/build_system/cmd/compiler/host/get_info/version/gnu/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from build_system.cmd.compiler.host.get_info.version.gnu.impl import fetch_version | ||
from .cli import * | ||
from .impl import * |
13 changes: 7 additions & 6 deletions
13
conf/script/src/build_system/cmd/compiler/host/get_info/version/gnu/cli.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from pathlib import Path | ||
__all__ = ['cli_fetch_gnu_version'] | ||
|
||
import build_system.cmd.compiler.host.get_info.cli | ||
import build_system.compiler.family | ||
from build_system.compiler import * | ||
from .impl import * | ||
from ...cli import * | ||
|
||
|
||
def fetch_version(compiler_family: build_system.compiler.family.CompilerFamily) -> None: | ||
build_system.cmd.compiler.host.get_info.cli.fetch_compiler_info_with_default_path(compiler_family=compiler_family, | ||
fetch_compiler_info_func=build_system.cmd.compiler.host.get_info.version.gnu.fetch_version) | ||
def cli_fetch_gnu_version(compiler_family: CompilerFamily) -> None: | ||
fetch_compiler_info_with_default_path(compiler_family=compiler_family, | ||
fetch_compiler_info_func=fetch_gnu_version) |
Oops, something went wrong.