diff --git a/CHANGES.md b/CHANGES.md index c6567fe..214fa1b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # fme-packager changes +# 1.4.4 + +* Improve help validation for packages with hyphenated UIDs. + # 1.4.3 * Improve verify command diff --git a/fme_packager/__init__.py b/fme_packager/__init__.py index aa56ed4..c0f285b 100644 --- a/fme_packager/__init__.py +++ b/fme_packager/__init__.py @@ -1 +1 @@ -__version__ = "1.4.3" +__version__ = "1.4.4" diff --git a/fme_packager/help.py b/fme_packager/help.py index 20d7638..717481f 100644 --- a/fme_packager/help.py +++ b/fme_packager/help.py @@ -120,13 +120,14 @@ def get_expected_help_index(fpkg_metadata: FMEPackageMetadata, format_directions index = {} if not format_directions: format_directions = {} - # dashes in the UIDs get turned to underscores - fpkg_ident = f"{fpkg_metadata.publisher_uid}_{fpkg_metadata.uid}".replace("-", "_") + fpkg_ident = f"{fpkg_metadata.publisher_uid}_{fpkg_metadata.uid}" # Each transformer has only one topic. for xformer in fpkg_metadata.transformers: index[f"fmx_{fpkg_ident}_{xformer.name}"] = f"/{xformer.name}.htm" # Each format has many topics. for fmt in fpkg_metadata.formats: + # dashes in the UIDs get turned to underscores when looking for format help + fpkg_ident = fpkg_ident.replace("-", "_") fmt_ident = f"{fpkg_ident}_{fmt.name}".lower() directions = format_directions.get(fmt.name, "rw") # Format prefix is "rw" even when read-only or write-only diff --git a/tests/fixtures/help/htm/package_help.csv b/tests/fixtures/help/htm/package_help.csv index b9c9e7e..85752f5 100644 --- a/tests/fixtures/help/htm/package_help.csv +++ b/tests/fixtures/help/htm/package_help.csv @@ -1 +1 @@ -fmx_example_package_Transformer,/Transformers/Transformer-pkg.htm +fmx_example_package-hyphen_Transformer,/Transformers/Transformer-pkg.htm diff --git a/tests/test_help.py b/tests/test_help.py index 1525555..88595d5 100644 --- a/tests/test_help.py +++ b/tests/test_help.py @@ -13,7 +13,7 @@ def mock_metadata(): return FMEPackageMetadata( { - "uid": "package", + "uid": "package-hyphen", "publisher_uid": "example", "package_content": {"transformers": [{"name": "Transformer", "version": 1}]}, } @@ -22,35 +22,35 @@ def mock_metadata(): def test_get_expected_help_contexts_transformer(mock_metadata): assert get_expected_help_index(mock_metadata) == { - "fmx_example_package_Transformer": "/Transformer.htm" + "fmx_example_package-hyphen_Transformer": "/Transformer.htm" } def test_get_expected_help_contexts_format(): metadata = FMEPackageMetadata( { - "uid": "package", + "uid": "package-hyphen", "publisher_uid": "example", "package_content": {"formats": [{"name": "demoformat"}]}, } ) assert get_expected_help_index(metadata) == { - "ft_example_package_demoformat_param_r": "/demoformat_ft_param_r.htm", - "ft_example_package_demoformat_param_w": "/demoformat_ft_param_w.htm", - "ft_example_package_demoformat_user_attr": "/demoformat_ft_user_attr.htm", - "param_example_package_demoformat_r": "/demoformat_param_r.htm", - "param_example_package_demoformat_w": "/demoformat_param_w.htm", - "rw_example_package_demoformat_feature_rep": "/demoformat_feature_rep.htm", - "rw_example_package_demoformat_index": "/demoformat.htm", + "ft_example_package_hyphen_demoformat_param_r": "/demoformat_ft_param_r.htm", + "ft_example_package_hyphen_demoformat_param_w": "/demoformat_ft_param_w.htm", + "ft_example_package_hyphen_demoformat_user_attr": "/demoformat_ft_user_attr.htm", + "param_example_package_hyphen_demoformat_r": "/demoformat_param_r.htm", + "param_example_package_hyphen_demoformat_w": "/demoformat_param_w.htm", + "rw_example_package_hyphen_demoformat_feature_rep": "/demoformat_feature_rep.htm", + "rw_example_package_hyphen_demoformat_index": "/demoformat.htm", } assert sorted(get_expected_help_index(metadata)) == [ - "ft_example_package_demoformat_param_r", - "ft_example_package_demoformat_param_w", - "ft_example_package_demoformat_user_attr", - "param_example_package_demoformat_r", - "param_example_package_demoformat_w", - "rw_example_package_demoformat_feature_rep", - "rw_example_package_demoformat_index", + "ft_example_package_hyphen_demoformat_param_r", + "ft_example_package_hyphen_demoformat_param_w", + "ft_example_package_hyphen_demoformat_user_attr", + "param_example_package_hyphen_demoformat_r", + "param_example_package_hyphen_demoformat_w", + "rw_example_package_hyphen_demoformat_feature_rep", + "rw_example_package_hyphen_demoformat_index", ] @@ -101,4 +101,4 @@ def test_md(mock_metadata, tmp_path): index_file = tmp_path / "package_help.csv" assert index_file.is_file() with index_file.open("r") as f: - assert f.read() == "fmx_example_package_Transformer,/Transformer.htm\n" + assert f.read() == "fmx_example_package-hyphen_Transformer,/Transformer.htm\n"