Skip to content

Commit

Permalink
#7 simplify soma-forge project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
sapetnioc committed Jun 6, 2024
1 parent 28ba73f commit 500dab9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 58 deletions.
3 changes: 2 additions & 1 deletion soma-forge/bin/soma-forge
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/sh
#!/usr/bin/env bash
export PYTHONPATH="$$(dirname $(dirname $0)):PYTHONPATH"
exec python -m soma_forge "$@"
6 changes: 0 additions & 6 deletions soma-forge/python/soma_forge/__main__.py

This file was deleted.

36 changes: 0 additions & 36 deletions soma-forge/python/soma_forge/conf/bv_maker.cfg

This file was deleted.

8 changes: 0 additions & 8 deletions soma-forge/python/soma_forge/conf/soma-forge.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from rich.console import Console
from rich.table import Table
from rich.pretty import Pretty
import rich.traceback
rich.traceback.install()

default_qt = 5
default_capsul = 2
Expand All @@ -34,6 +36,26 @@
}
}

bv_maker_cfg_template = """[ source $CASA_SRC ]
default_source_dir = {{component}}
ignore_git_failure=ON
{components_source}
[ build $CASA_BUILD ]
default_steps = configure build doc
make_options = -j$NCPU
cmake_options += -DPIXI=$CASA
build_type = Release
packaging_thirdparty = OFF
clean_config = ON
clean_build = ON
test_ref_data_dir = $CASA_TESTS/ref
test_run_data_dir = $CASA_TESTS/test
{components_build}
"""


@click.group(context_settings={"help_option_names": ["-h", "--help"]})
def cli():
Expand Down Expand Up @@ -70,8 +92,8 @@ def cli():
def init(directory, packages, python, capsul, qt, force):
"""Create or reconfigure a full BrainVISA development directory"""
if not packages:
packages= ['all']
packages = ["all"]

neuro_forge_url = "https://brainvisa.info/neuro-forge"
pixi_root = pathlib.Path(directory)
if not pixi_root.exists():
Expand Down Expand Up @@ -181,16 +203,14 @@ def init(directory, packages, python, capsul, qt, force):
dependencies[package] = existing_constraint

# Generate bv_maker.cfg
with open(pathlib.Path(__file__).parent / "conf" / "bv_maker.cfg") as f:
bv_maker_cfg_template = f.read()
components_source = []
components_build = []
for package, cb in components.items():
components_source.append(f"# Components of package {package}")
components_build.append(f"# Components of package {package}")
for component, branch in cb.items():
components_source.append(f"brainvisa {component} {branch}")
components_build.append(f"brainvisa {component} $CASA_SRC")
components_build.append(f"brainvisa {component} {branch} $CASA_SRC")
bv_maker_cfg = pixi_root / "conf" / "bv_maker.cfg"
if bv_maker_cfg.exists() and not force:
console.print(
Expand Down Expand Up @@ -247,7 +267,7 @@ def init(directory, packages, python, capsul, qt, force):
pixi_config.setdefault("dependencies", {})[package] = "*"

shutil.copy(
pathlib.Path(__file__).parent.parent.parent / "activate.sh",
pathlib.Path(__file__).parent / "activate.sh",
pixi_root / "activate.sh",
)
activation_script = "activate.sh"
Expand All @@ -274,7 +294,7 @@ def read_recipes():
"""
Iterate over all recipes files defined in soma-forge.
"""
for recipe_file in (pathlib.Path(__file__).parent.parent.parent / "recipes").glob(
for recipe_file in (pathlib.Path(__file__).parent / "recipes").glob(
"*.yaml"
):
with open(recipe_file) as f:
Expand Down Expand Up @@ -695,3 +715,6 @@ def main():
kwargs = vars(args).copy()
del kwargs["func"]
sys.exit(args.func(**kwargs))

if __name__ == '__main__':
cli()

0 comments on commit 500dab9

Please sign in to comment.