Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "aedifix"
authors = [{name = "NVIDIA Corporation"}]
license = { text = "Apache-2.0" }
license = "Apache-2.0"
description = "aedifix - Build system for Legate libraries"
classifiers = [
"Intended Audience :: Developers",
Expand Down
3 changes: 1 addition & 2 deletions src/aedifix/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class ConfigFile(Configurable):
"""

__slots__ = (
"_cmake_configure_file",
"_config_file_template",
"_default_subst",
"_project_variables_file",
Expand All @@ -42,7 +41,7 @@ def __init__(
manager : ConfigurationManager
The configuration manager to manage this Config.
config_file_template : Path
The template file to read
The template file to read.
"""
super().__init__(manager=manager)
self._config_file_template = config_file_template.resolve()
Expand Down
18 changes: 12 additions & 6 deletions src/aedifix/package/main_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def __init__( # noqa: PLR0913
arch_name: str,
project_dir_name: str,
project_dir_value: Path,
project_config_file_template: Path,
project_config_file_template: Path | None = None,
project_src_dir: Path | None = None,
default_arch_file_path: Path | None = None,
) -> None:
Expand All @@ -390,9 +390,11 @@ def __init__( # noqa: PLR0913
The name of the project dir variable, e.g. 'LEGATE_DIR'.
project_dir_value : Path
The value of the project dir, e.g. /path/to/legate.
project_config_file_template: Path
project_config_file_template: Path, optional
A path to a configure file template to fill out and place under
PROJECT_DIR/PROJECT_ARCH on successful configure.
PROJECT_DIR/PROJECT_ARCH on successful configure. If not given,
a default template file containing PYTHON, CMAKE,
CMAKE_BUILD_PARALLEL_LEVEL, and CMAKE_GENERATOR will be used.
project_src_dir : Path, optional
The path to the projects source directory for CMake. If not
provided, ``project_dir_value`` is used instead.
Expand All @@ -414,6 +416,11 @@ def __init__( # noqa: PLR0913
assert not arch_name.endswith("_")
assert arch_name.isupper()
assert arch_name.endswith("ARCH")
if project_config_file_template is None:
project_config_file_template = (
Path(__file__).parents[1] / "templates" / "variables.mk.in"
).resolve(strict=True)

if not project_config_file_template.exists():
msg = (
f"Project configure file: {project_config_file_template} does "
Expand All @@ -426,6 +433,7 @@ def __init__( # noqa: PLR0913
"not a file"
)
raise ValueError(msg)

self._arch_name = arch_name
self._arch_value, self._arch_value_provenance = (
self.preparse_arch_value(argv)
Expand All @@ -441,9 +449,7 @@ def __init__( # noqa: PLR0913
raise ValueError(msg)
self._proj_dir_name = project_dir_name
self._proj_dir_value = project_dir_value.resolve(strict=True)
self._proj_config_file_template = (
project_config_file_template.resolve()
)
self._proj_config_file_template = project_config_file_template
if project_src_dir is None:
project_src_dir = self._proj_dir_value
self._proj_src_dir = project_src_dir.resolve(strict=True)
Expand Down
5 changes: 5 additions & 0 deletions src/aedifix/templates/variables.mk.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- mode: makefile-gmake -*-
export PYTHON ?= @AEDIFIX_PYTHON_EXECUTABLE@
export CMAKE ?= @CMAKE_COMMAND@
export CMAKE_BUILD_PARALLEL_LEVEL ?= @CMAKE_BUILD_PARALLEL_LEVEL@
export CMAKE_GENERATOR ?= @CMAKE_GENERATOR@
7 changes: 1 addition & 6 deletions tests/fixtures/dummy_main_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

from os import environ
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import TYPE_CHECKING, Final
from typing import TYPE_CHECKING

from .dummy_main_package import DummyMainPackage

Expand All @@ -15,9 +14,6 @@

from aedifix.manager import ConfigurationManager

_tmp_file: Final = NamedTemporaryFile() # noqa: SIM115
_tmp_path: Final = Path(_tmp_file.name)


class DummyMainModule(DummyMainPackage):
name = "DummyMainModule"
Expand All @@ -31,7 +27,6 @@ def __init__(
arch_name="AEDIFIX_PYTEST_ARCH",
project_dir_name="AEDIFIX_PYTEST_DIR",
project_dir_value=Path(environ["AEDIFIX_PYTEST_DIR"]),
project_config_file_template=_tmp_path,
)

@classmethod
Expand Down
10 changes: 2 additions & 8 deletions tests/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
from pathlib import Path


@pytest.fixture
def manager() -> ConfigurationManager:
return ConfigurationManager((), DummyMainModule)


class TestConfigurationManager:
@pytest.mark.parametrize(
"argv", ((), ("--foo",), ("-b", "1", "--bar=baz"))
Expand Down Expand Up @@ -79,9 +74,8 @@ def test_create(
assert (manager._aedifix_root_dir / "aedifix").exists()
assert (manager._aedifix_root_dir / "aedifix").is_dir()

def test_setup(
self, manager: ConfigurationManager, AEDIFIX_PYTEST_ARCH: str
) -> None:
def test_setup(self, AEDIFIX_PYTEST_ARCH: str) -> None:
manager = ConfigurationManager((), DummyMainModule)
orig_argv = deepcopy(manager.argv)
assert len(manager._modules) == 1
manager.setup()
Expand Down
Loading