Compare commits

..

No commits in common. "rawhide" and "f39" have entirely different histories.

5 changed files with 68 additions and 66 deletions

31
.gitignore vendored
View file

@ -6,34 +6,3 @@
/bids-specification-schema-0.11.3.post2.tar.gz
/bids-specification-schema-0.11.3.post3.tar.gz
/bids-examples-507df6626dbbc555ae258ae286885d0a1b18391c-filtered.tar.zst
/bids-specification-schema-1.0.0.tar.gz
/bids-specification-schema-1.0.1.tar.gz
/bids-examples-e52f77fcd1abe7f234ecaec3542082279b043f8a-filtered.tar.zst
/bids-specification-schema-1.0.2.tar.gz
/bids-specification-schema-1.0.3.tar.gz
/bids-examples-5e6fa0ccba46c9701c4aba154b412542d616186c-filtered.tar.zst
/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

View file

@ -1,3 +1,8 @@
# 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

View file

@ -1,9 +1,10 @@
# Removable test dependency, not yet packaged:
# https://pypi.org/project/check-jsonschema
%bcond check_jsonschema 0
# Missing dependencies in EPEL10:
# - python3dist(markdown-it-py)
# - python3dist(tabulate)
%bcond render %{undefined el10}
Name: bids-schema
Version: 1.1.5
Version: 0.11.3^post3
Release: %autorelease
Summary: BIDS schema description
@ -16,15 +17,13 @@ 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.1
%global bidsversion 1.10.0
# The specification, and the schema data derived from it, are CC-BY-4.0.
#
# The Python library in tools/schemacode/, packaged as python3-bidsschematools,
# is MIT.
License: CC-BY-4.0
# CC0-1.0 comes from the filtered test datasets, Source2 and Source3
SourceLicense: CC0-1.0 AND CC-BY-4.0 AND MIT
URL: https://github.com/bids-standard/bids-specification
# The PyPI sdist corresponds to the tools/schemacode directory in git.
Source0: %{url}/archive/schema-%{srcversion}/bids-specification-schema-%{srcversion}.tar.gz
@ -51,7 +50,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 c68d3afa54b3271d4718de7abf6cb6d5e603fceb
%global examples_commit 507df6626dbbc555ae258ae286885d0a1b18391c
%global error_examples_url https://github.com/bids-standard/bids-error-examples
%global error_examples_commit ac0a2f58f34ce284847dde5bd3b90d7ea048c141
#
@ -84,9 +83,6 @@ 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
@ -120,7 +116,7 @@ Features:
simple CLI bindings (e.g. bst export)
%pyproject_extras_subpkg -n python3-bidsschematools validation render expressions
%pyproject_extras_subpkg -n python3-bidsschematools %{?with_render:render} expressions
%prep
@ -140,7 +136,7 @@ rm -rf src/js/ src/css/
%generate_buildrequires
pushd tools/schemacode >/dev/null
%pyproject_buildrequires -x validation,render,expressions
%pyproject_buildrequires -x %{?with_render:render,}expressions
popd >/dev/null
@ -165,21 +161,17 @@ 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.json
for thing in metaschema.json schema
do
rm "%{buildroot}%{python3_sitelib}/bidsschematools/data/${thing}"
rm -rv "%{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.
@ -189,6 +181,14 @@ 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}'
@ -220,7 +220,11 @@ install -t '%{buildroot}%{_docdir}/python3-bidsschematools' -D -p -m 0644 \
verfile='%{_datadir}/bids-schema/versions/%{bidsversion}/schema/SCHEMA_VERSION'
[ '%{srcversion}' = "$(cat "%{buildroot}${verfile}")" ]
%pyproject_check_import
%pyproject_check_import %{?!with_render:-e bidsschematools.render*}
%if %{without render}
ignore="${ignore-} --ignore-glob=tools/schemacode/src/bidsschematools/tests/test_render_*"
%endif
# These tests require example files that were filtered out for license reasons.
k="${k-}${k+ and }not test_bids_datasets[hcp_example_bids]"
@ -233,16 +237,35 @@ 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 <lua> -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}
@ -269,10 +292,15 @@ k="${k-}${k+ and }not test_valid_schema_with_check_jsonschema"
%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*

View file

@ -18,12 +18,12 @@ OUTDIR="${PWD}"
TMPDIR="$(mktemp -d)"
trap "rm -rf '${TMPDIR}'" INT TERM EXIT
SPEC="$(cd "$(dirname "${0}")"; echo "${PWD}")/bids-schema.spec"
SPEC="$(cd "$(dirname $0)"; echo "${PWD}")/bids-schema.spec"
MACROS="$(grep -E '^%global' "${SPEC}")"
get_macro()
{
rpm -E "${MACROS}
%{${1}}"
echo "$(rpm -E "${MACROS}
%{${1}}")"
}
EX_URL="$(get_macro examples_url)"

View file

@ -1,3 +1,3 @@
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
SHA512 (bids-specification-schema-0.11.3.post3.tar.gz) = 483eeec3b333d0d8a1ad41f941e51b0e6fdb1c17501d19ce30cd117e68d12408a86d5ceed0a46ea0daa4210ad34b82737e47c664a1a51557ae782742a45e135f
SHA512 (bids-examples-507df6626dbbc555ae258ae286885d0a1b18391c-filtered.tar.zst) = 632c42ebcaabde85b7b17d3c1e231955b3f54d0fc51b7dd50fc2b26de4062a36ec77ca937e4c70bb5c0214928ee15a9d2731d785fd6f8f867eca1a5a0185f569
SHA512 (bids-error-examples-ac0a2f58f34ce284847dde5bd3b90d7ea048c141-filtered.tar.zst) = 3f70d1a8b922be232778470d01b8364b22f2373d053f9b709916e0023dc588bb40797ee145ccc072acee9e9c6a9e1aa07d26698b08a9377a442ac3dedd97fbec