Loading pyproject.toml +1 −1 Changes for pyproject.toml: 1 added line, 1 removed line. Original line number Diff line number Diff line [project] name = "climax-CERTIC" version = "0.1.8" version = "0.1.9" description = "CLI tool for MaX, Le Moteur d'Affichage XML." readme = "README.md" license = {text = "CECILL-C"} Loading src/climax/__main__.py +31 −7 Changes for src/climax/__main__.py: 31 added lines, 7 removed lines. Original line number Diff line number Diff line import subprocess from pathlib import Path from typing import Optional, Union, Dict from typing import Optional, Union, Dict, Iterator from typing_extensions import Annotated import gettext Loading Loading @@ -100,6 +100,16 @@ def _free_port() -> int: return port def _scan_dir(start_path: Union[str, Path], extension: str = None) -> Iterator[Path]: for root, dirs, files in os.walk(start_path): for file in files: if extension: if file[(len(extension) * -1) :].lower() == extension.lower(): yield os.path.join(root, file) else: yield Path(os.path.join(root, file)).resolve() class MaXProjectConfig: def __init__(self, path_to_config_file: Union[str, Path]): self.config_file_path = Path(path_to_config_file).resolve() Loading Loading @@ -861,14 +871,13 @@ def bundles_add(bundle_name: str): @app.command(help=_("Ajoute un fichier XML à l'instance de Max en cours")) def feed(xml_file: Path): xml_file = Path(xml_file) if not xml_file.is_file(): print(_("[red]{} n'est pas un fichier XML[/red]").format(xml_file)) def feed(feed_path: Path): feed_path = Path(feed_path).resolve() if not feed_path.is_file() and not feed_path.is_dir(): print(_("[red]{} n'existe pas[/red]").format(feed_path)) raise typer.Exit(code=1) check_cwd_is_max() java_bin_path = ensure_java() # "if(not(db:exists('max'))) then db:create('max') else ()" process_args = [ str(java_bin_path), "-cp", Loading @@ -878,13 +887,28 @@ def feed(xml_file: Path): "if(not(db:exists('max'))) then db:create('max') else ()", ] subprocess.run(process_args) if feed_path.is_file(): process_args = [ str(java_bin_path), "-cp", cp_paths(), "-Xmx2g", "org.basex.BaseX", f"db:put('max', '{feed_path}', '{feed_path}')", # f"-cOPEN max; REPLACE {feed_path.resolve()}", ] subprocess.run(process_args) elif feed_path.is_dir(): for f in _scan_dir(feed_path, ".xml"): process_args = [ str(java_bin_path), "-cp", cp_paths(), "-Xmx2g", "org.basex.BaseX", f"-cOPEN max; ADD {xml_file.resolve()}", f"db:put('max', '{f}', '{str(f).lstrip(str(feed_path))}')", # f"-cOPEN max; REPLACE {f}", ] subprocess.run(process_args) Loading Loading
pyproject.toml +1 −1 Changes for pyproject.toml: 1 added line, 1 removed line. Original line number Diff line number Diff line [project] name = "climax-CERTIC" version = "0.1.8" version = "0.1.9" description = "CLI tool for MaX, Le Moteur d'Affichage XML." readme = "README.md" license = {text = "CECILL-C"} Loading
src/climax/__main__.py +31 −7 Changes for src/climax/__main__.py: 31 added lines, 7 removed lines. Original line number Diff line number Diff line import subprocess from pathlib import Path from typing import Optional, Union, Dict from typing import Optional, Union, Dict, Iterator from typing_extensions import Annotated import gettext Loading Loading @@ -100,6 +100,16 @@ def _free_port() -> int: return port def _scan_dir(start_path: Union[str, Path], extension: str = None) -> Iterator[Path]: for root, dirs, files in os.walk(start_path): for file in files: if extension: if file[(len(extension) * -1) :].lower() == extension.lower(): yield os.path.join(root, file) else: yield Path(os.path.join(root, file)).resolve() class MaXProjectConfig: def __init__(self, path_to_config_file: Union[str, Path]): self.config_file_path = Path(path_to_config_file).resolve() Loading Loading @@ -861,14 +871,13 @@ def bundles_add(bundle_name: str): @app.command(help=_("Ajoute un fichier XML à l'instance de Max en cours")) def feed(xml_file: Path): xml_file = Path(xml_file) if not xml_file.is_file(): print(_("[red]{} n'est pas un fichier XML[/red]").format(xml_file)) def feed(feed_path: Path): feed_path = Path(feed_path).resolve() if not feed_path.is_file() and not feed_path.is_dir(): print(_("[red]{} n'existe pas[/red]").format(feed_path)) raise typer.Exit(code=1) check_cwd_is_max() java_bin_path = ensure_java() # "if(not(db:exists('max'))) then db:create('max') else ()" process_args = [ str(java_bin_path), "-cp", Loading @@ -878,13 +887,28 @@ def feed(xml_file: Path): "if(not(db:exists('max'))) then db:create('max') else ()", ] subprocess.run(process_args) if feed_path.is_file(): process_args = [ str(java_bin_path), "-cp", cp_paths(), "-Xmx2g", "org.basex.BaseX", f"db:put('max', '{feed_path}', '{feed_path}')", # f"-cOPEN max; REPLACE {feed_path.resolve()}", ] subprocess.run(process_args) elif feed_path.is_dir(): for f in _scan_dir(feed_path, ".xml"): process_args = [ str(java_bin_path), "-cp", cp_paths(), "-Xmx2g", "org.basex.BaseX", f"-cOPEN max; ADD {xml_file.resolve()}", f"db:put('max', '{f}', '{str(f).lstrip(str(feed_path))}')", # f"-cOPEN max; REPLACE {f}", ] subprocess.run(process_args) Loading