From 6f4fb0be290b6dad9b9ac39b4af77490bb3dddf5 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Tue, 5 Nov 2024 17:03:44 +0000 Subject: [PATCH 1/3] fix(archive): set default omex archive extension if not provided --- pyneuroml/archive/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyneuroml/archive/__init__.py b/pyneuroml/archive/__init__.py index cc04007d..01f31ad1 100644 --- a/pyneuroml/archive/__init__.py +++ b/pyneuroml/archive/__init__.py @@ -14,10 +14,10 @@ import typing from zipfile import ZipFile -from pyneuroml.utils import get_model_file_list -from pyneuroml.utils.cli import build_namespace from pyneuroml.runners import run_jneuroml from pyneuroml.sedml import validate_sedml_files +from pyneuroml.utils import get_model_file_list +from pyneuroml.utils.cli import build_namespace logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) @@ -88,7 +88,7 @@ def cli(a: typing.Optional[typing.Any] = None, **kwargs: str): a = build_namespace(DEFAULTS, a, **kwargs) rootfile = a.rootfile - zipfile_extension = None + zipfile_extension = ".neux.zip" # first generate SED-ML file # use .omex as extension @@ -99,7 +99,7 @@ def cli(a: typing.Optional[typing.Any] = None, **kwargs: str): run_jneuroml("", a.rootfile, "-sedml") rootfile = a.rootfile.replace(".xml", ".sedml") - zipfile_extension = ".omex" + zipfile_extension = ".omex.zip" # validate the generated file validate_sedml_files([rootfile]) From 9953908187103d73299e88b8e80ad8bcd8d0ea25 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Tue, 5 Nov 2024 17:04:09 +0000 Subject: [PATCH 2/3] chore(archive): use `.zip` suffix This will help users. Systems do not know what neux and omex files are, but they do know what files with zip extensions are. --- pyneuroml/archive/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyneuroml/archive/__init__.py b/pyneuroml/archive/__init__.py index 01f31ad1..d57a3bee 100644 --- a/pyneuroml/archive/__init__.py +++ b/pyneuroml/archive/__init__.py @@ -119,7 +119,7 @@ def cli(a: typing.Optional[typing.Any] = None, **kwargs: str): def create_combine_archive( rootfile: str, zipfile_name: typing.Optional[str] = None, - zipfile_extension=".neux", + zipfile_extension=".neux.zip", filelist: typing.List[str] = [], extra_files: typing.List[str] = [], ): From 17c71be4dab949e48e55d8e9b4539e8ae587022d Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Tue, 5 Nov 2024 17:05:46 +0000 Subject: [PATCH 3/3] tests(archive): update test files to include `.zip` suffix --- tests/archive/test_archive.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/archive/test_archive.py b/tests/archive/test_archive.py index 8b63fef9..ec4824e0 100644 --- a/tests/archive/test_archive.py +++ b/tests/archive/test_archive.py @@ -7,7 +7,6 @@ Copyright 2023 NeuroML contributors """ - import logging import pathlib import unittest @@ -109,7 +108,7 @@ def test_create_combine_archive(self): rootfile=dirname + "/HH_example_cell.nml", filelist=filelist, ) - self.assertTrue(pathlib.Path(dirname + "/HH_example.neux").exists()) + self.assertTrue(pathlib.Path(dirname + "/HH_example.neux.zip").exists()) dirname = str(thispath.parent.parent.parent) filelist = [] @@ -119,7 +118,7 @@ def test_create_combine_archive(self): filelist=filelist, ) self.assertTrue( - pathlib.Path(dirname + "/examples/LEMS_NML2_Ex5_DetCell.neux").exists() + pathlib.Path(dirname + "/examples/LEMS_NML2_Ex5_DetCell.neux.zip").exists() ) dirname = str(thispath.parent.parent.parent) @@ -130,5 +129,5 @@ def test_create_combine_archive(self): filelist=filelist, ) self.assertTrue( - pathlib.Path(dirname + "/examples/NML2_SingleCompHHCell.neux").exists() + pathlib.Path(dirname + "/examples/NML2_SingleCompHHCell.neux.zip").exists() )