diff --git a/soma-forge/bin/soma-forge b/soma-forge/bin/soma-forge index 19c5b72..0697c49 100755 --- a/soma-forge/bin/soma-forge +++ b/soma-forge/bin/soma-forge @@ -1,2 +1,3 @@ -#!/bin/sh +#!/usr/bin/env bash +export PYTHONPATH="$$(dirname $(dirname $0)):PYTHONPATH" exec python -m soma_forge "$@" diff --git a/soma-forge/python/soma_forge/__main__.py b/soma-forge/python/soma_forge/__main__.py deleted file mode 100644 index e5d868f..0000000 --- a/soma-forge/python/soma_forge/__main__.py +++ /dev/null @@ -1,6 +0,0 @@ -import rich.traceback -rich.traceback.install() - -from . import cli - -cli() diff --git a/soma-forge/python/soma_forge/conf/bv_maker.cfg b/soma-forge/python/soma_forge/conf/bv_maker.cfg deleted file mode 100644 index ddb971c..0000000 --- a/soma-forge/python/soma_forge/conf/bv_maker.cfg +++ /dev/null @@ -1,36 +0,0 @@ -[ source $CASA_SRC ] - default_source_dir = {{component}} - ignore_git_failure=ON - -{components_source} - # brainvisa brainvisa-cea $CASA_BRANCH - # brainvisa brainvisa-standard $CASA_BRANCH - # brainvisa nuclear_imaging $CASA_BRANCH - # brainvisa cati $CASA_BRANCH - # - soma-base - # git https://github.com/populse/soma-base 6.0 - # - populse-db - # git https://github.com/populse/populse_db 3.0 - # - capsul - # git https://github.com/populse/capsul 3.0 - # - anatomist-gpl - # git https://github.com/brainvisa/anatomist-gpl capsul3 - # - morphologist-gpl - # git https://github.com/brainvisa/morphologist-gpl capsul3 - # - morpho-deepsulci - # git https://github.com/brainvisa/morpho-deepsulci capsul3 - # - morphologist-ui - # git https://github.com/brainvisa/morphologist capsul3 - -[ 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} \ No newline at end of file diff --git a/soma-forge/python/soma_forge/conf/soma-forge.yaml b/soma-forge/python/soma_forge/conf/soma-forge.yaml deleted file mode 100644 index 14bca4b..0000000 --- a/soma-forge/python/soma_forge/conf/soma-forge.yaml +++ /dev/null @@ -1,8 +0,0 @@ -packages: - - bioprocessing - - brainvisa - - constellation - - cortical-surface - - morphologist-baby - - nuclear-imaging - - cati \ No newline at end of file diff --git a/soma-forge/python/soma_forge/__init__.py b/soma-forge/soma_forge.py similarity index 96% rename from soma-forge/python/soma_forge/__init__.py rename to soma-forge/soma_forge.py index eeb8b84..8a70a8f 100644 --- a/soma-forge/python/soma_forge/__init__.py +++ b/soma-forge/soma_forge.py @@ -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 @@ -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(): @@ -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(): @@ -181,8 +203,6 @@ 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(): @@ -190,7 +210,7 @@ def init(directory, packages, python, capsul, qt, force): 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( @@ -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" @@ -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: @@ -695,3 +715,6 @@ def main(): kwargs = vars(args).copy() del kwargs["func"] sys.exit(args.func(**kwargs)) + +if __name__ == '__main__': + cli()