diff --git a/.gitignore b/.gitignore index 2639a6f..ffb6949 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,25 @@ /bids-specification-schema-1.0.4.tar.gz /bids-examples-f21306744fd57bfd5c8e8e91d907fa8448f9eca5-filtered.tar.zst /bids-specification-schema-1.0.5.tar.gz +/bids-specification-schema-1.0.7.tar.gz +/bids-specification-schema-1.0.8.tar.gz +/bids-specification-schema-1.0.9.tar.gz +/bids-specification-schema-1.0.10.tar.gz +/bids-examples-54355d2bbfec3fc126dd3cb80c3db9813505e3df-filtered.tar.zst +/bids-specification-schema-1.0.11.tar.gz +/bids-examples-e742618e66cce8fa16bf1066caa47d543508857c-filtered.tar.zst +/bids-specification-schema-1.0.12.tar.gz +/bids-specification-schema-1.0.13.tar.gz +/bids-examples-ce064b0868cf5ccd0098850be12e5205bedfa671-filtered.tar.zst +/bids-specification-schema-1.0.14.tar.gz +/bids-specification-schema-1.1.0.tar.gz +/bids-examples-546cb454ca33327fb27474edb508ead17c4053ac-filtered.tar.zst +/bids-specification-schema-1.1.1.tar.gz +/bids-examples-8f916644b973b44c946b7617e96b04b7be312f89-filtered.tar.zst +/bids-specification-schema-1.1.2.tar.gz +/bids-specification-schema-1.1.3.tar.gz +/bids-examples-0410c4114bd819c403309b1d210983ddbed271ec-filtered.tar.zst +/bids-specification-schema-1.1.4.tar.gz +/bids-examples-9d114380a6cf4c24526eb71259b3f52d43a08ad7-filtered.tar.zst +/bids-specification-schema-1.1.5.tar.gz +/bids-examples-c68d3afa54b3271d4718de7abf6cb6d5e603fceb-filtered.tar.zst diff --git a/bids-schema.rpmlintrc b/bids-schema.rpmlintrc index d02664e..90379c3 100644 --- a/bids-schema.rpmlintrc +++ b/bids-schema.rpmlintrc @@ -1,8 +1,3 @@ -# It is normal that extras metapackages should not have documentation, or any -# files at all. -addFilter(r"\+\w+.noarch: W: no-documentation") -# This is not a spelling error -addFilter(r" spelling-error \('([Mm]etapackage)s?',") # There are no URLs for these sources because we must generate them with scripts: addFilter(r" invalid-url Source[1-9]: .*\.tar\.zst$") # These are fine; rpmlint does not understand .tar.zst diff --git a/bids-schema.spec b/bids-schema.spec index 759effe..0872964 100644 --- a/bids-schema.spec +++ b/bids-schema.spec @@ -1,5 +1,9 @@ +# Removable test dependency, not yet packaged: +# https://pypi.org/project/check-jsonschema +%bcond check_jsonschema 0 + Name: bids-schema -Version: 1.0.5 +Version: 1.1.5 Release: %autorelease Summary: BIDS schema description @@ -12,7 +16,7 @@ Summary: BIDS schema description # https://github.com/bids-standard/bids-schema/raw/refs/heads/main/… # versions/%%{bidsversion}/schema/SCHEMA_VERSION # should match or nearly match the schema version packaged here. -%global bidsversion 1.10.0 +%global bidsversion 1.10.1 # The specification, and the schema data derived from it, are CC-BY-4.0. # @@ -47,7 +51,7 @@ Source0: %{url}/archive/schema-%{srcversion}/bids-specification-schema-%{ # tools/schemacode/src/bidsschematools/conftest.py, which contains code to download # these if they are not present. %global examples_url https://github.com/bids-standard/bids-examples -%global examples_commit f21306744fd57bfd5c8e8e91d907fa8448f9eca5 +%global examples_commit c68d3afa54b3271d4718de7abf6cb6d5e603fceb %global error_examples_url https://github.com/bids-standard/bids-error-examples %global error_examples_commit ac0a2f58f34ce284847dde5bd3b90d7ea048c141 # @@ -80,6 +84,9 @@ BuildRequires: python3-devel # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters, # it is easier to enumerate test dependencies by hand. BuildRequires: %{py3_dist pytest} +%if %{with check_jsonschema} +BuildRequires: %{py3_dist check-jsonschema} +%endif %description Portions of the BIDS specification are defined using YAML files in order to @@ -113,7 +120,7 @@ Features: • simple CLI bindings (e.g. bst export) -%pyproject_extras_subpkg -n python3-bidsschematools render expressions +%pyproject_extras_subpkg -n python3-bidsschematools validation render expressions %prep @@ -133,7 +140,7 @@ rm -rf src/js/ src/css/ %generate_buildrequires pushd tools/schemacode >/dev/null -%pyproject_buildrequires -x render,expressions +%pyproject_buildrequires -x validation,render,expressions popd >/dev/null @@ -158,17 +165,21 @@ install -t '%{buildroot}%{_datadir}/bids-schema/versions/%{bidsversion}' \ pushd tools/schemacode >/dev/null %pyproject_install -%pyproject_save_files -l bidsschematools +%pyproject_save_files -L bidsschematools popd +# Include a copy of the “exported” JSON version of the schema in the base +# package to imitate the structure of +# https://github.com/bids-standard/bids-schema. See readthedocs.yml. +install -p -m 0644 \ + -t '%{buildroot}%{_datadir}/bids-schema/versions/%{bidsversion}' \ + '%{buildroot}%{python3_sitelib}/bidsschematools/data/schema.json' + # Unbundle the schema data from the Python library. -# Since the schema directory is replaced by a symbolic link into the base -# package, we must remove its contents from the files list, and we must remove -# the directory itself so that we can list it manually without %%dir. sed -r -i '/\/bidsschematools\/data\/schema(\/|$)/d' %{pyproject_files} -for thing in metaschema.json schema +for thing in metaschema.json schema.json do - rm -rv "%{buildroot}%{python3_sitelib}/bidsschematools/data/${thing}" + rm "%{buildroot}%{python3_sitelib}/bidsschematools/data/${thing}" # Create an absolute symlink into the buildroot and then convert it to a # relative one; the relative symlink works both in %%check and after the # package is actually installed. @@ -178,14 +189,6 @@ do symlinks -c -o "%{buildroot}%{python3_sitelib}/bidsschematools/data/${thing}" done -# Generate and include a copy of the “exported” JSON version of the schema to -# imitate the structure of https://github.com/bids-standard/bids-schema. See -# readthedocs.yml. We do this in %%install rather than %%build because we need -# to use the generated “bst” entry point. -PYTHONDONTWRITEBYTECODE=1 PYTHONPATH='%{buildroot}%{python3_sitelib}' \ - %{buildroot}%{_bindir}/bst -v export --output \ - '%{buildroot}%{_datadir}/bids-schema/versions/%{bidsversion}/schema.json' - # Do not ship the tests. sed -r -i '/\/bidsschematools\/tests(\/|$)/d' %{pyproject_files} sed -r -i '/bidsschematools\.tests(\.|$)/d' '%{_pyproject_modules}' @@ -230,35 +233,16 @@ ln -s "${PWD}/bids-examples-%{examples_commit}" \ tools/schemacode/tests/data/bids-examples ln -s "${PWD}/bids-error-examples-%{error_examples_commit}" \ tools/schemacode/tests/data/bids-error-examples -# We also link the actual schema data, as unbundled and installed in the -# buildroot. -rm -rvf 'tools/schemacode/src/bidsschematools/data' -ln -s '%{buildroot}%{python3_sitelib}/bidsschematools/data' \ - 'tools/schemacode/src/bidsschematools/data' # All of this manipulation is OK here in %%check because we already built the # wheel and installed the library to the buildroot. +%if %{without check_jsonschema} +k="${k-}${k+ and }not test_valid_schema_with_check_jsonschema" +%endif + %pytest ${ignore-} -k "${k-}" -v -# https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/#_scriptlet_to_replace_a_directory -# Added for F42; can be removed in F45 (upgrade path for three releases) -%pretrans -p -n python3-bidsschematools -path = "%{python3_sitelib}/bidsschematools/data/schema" -st = posix.stat(path) -if st and st.type == "directory" then - status = os.rename(path, path .. ".rpmmoved") - if not status then - suffix = 0 - while not status do - suffix = suffix + 1 - status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) - end - os.rename(path, path .. ".rpmmoved") - end -end - - %files %license LICENSE %doc %dir %{_pkgdocdir} @@ -285,15 +269,10 @@ end %files -n python3-bidsschematools -f %{pyproject_files} +%license tools/schemacode/LICENSE %doc %dir %{_docdir}/python3-bidsschematools %doc %{_docdir}/python3-bidsschematools/README.md -# Symbolic link into the appropriate directory in the base package: -%{python3_sitelib}/bidsschematools/data/schema -# https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/#_scriptlet_to_replace_a_directory -# Added for F42; can be removed in F45 (upgrade path for three releases) -%ghost %{python3_sitelib}/bidsschematools/data/schema.rpmmoved - %{_bindir}/bst %{_mandir}/man1/bst.1* %{_mandir}/man1/bst-*.1* diff --git a/sources b/sources index 6d256cb..c4254aa 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (bids-specification-schema-1.0.5.tar.gz) = a140e0f22a5ad857e6a6678ab2a9dfb699fd4db0f9492ba3f97d373a31c2488201665f02ffe5d57cc0d6c269f0f4ff844a72fea0169d2afcc5d2cdeee8fdf3eb -SHA512 (bids-examples-f21306744fd57bfd5c8e8e91d907fa8448f9eca5-filtered.tar.zst) = 94afdcfe08c9bfa5b764fd21d14695a0c34cb66310dcb3332b3976b9bcfe431dc2d5101eda7bd70827be708e3054cdfb933bfbaa473ae55645590e2c4f14e38d -SHA512 (bids-error-examples-ac0a2f58f34ce284847dde5bd3b90d7ea048c141-filtered.tar.zst) = b8281f6120731d72d2271869414f88edb94c7a54dd732e689cf331f011a4caaad7372556cee1b58d9a91ee1ee3644933d59cbad304a3b291d846610a7897af8e +SHA512 (bids-specification-schema-1.1.5.tar.gz) = 4bc394cff2f7cd966ca570609ecc3fc99996ff056c74e8bde482402f8e221bf863d9e90ce2a0383de64dc1102b671f79d9cb1232f4df7647b0d5d0992a01c4e1 +SHA512 (bids-examples-c68d3afa54b3271d4718de7abf6cb6d5e603fceb-filtered.tar.zst) = dc269c261c2d9dda8ab66e3670575c2337d9c6d4d2dbc8ed3c8b2d119dcfd726fb75b8411cfd63b5d956ede7d94de74b9c4bcc157370b1d2b2a1d94ecab2dc9b +SHA512 (bids-error-examples-ac0a2f58f34ce284847dde5bd3b90d7ea048c141-filtered.tar.zst) = d6ce411fbc24259a6587cea189b7eb043e1267cee085346a0bda125a31a9081a518772e3b5f07ed3cae182cd6a2422eaa66d6ff5f5018dfa4212fe90d7365a12