Skip to content

Commit

Permalink
Merge pull request #78 from datalad/move-procedure
Browse files Browse the repository at this point in the history
Add deprecated metadata config procedure from datalad core
  • Loading branch information
bpoldrack committed Oct 28, 2022
2 parents 4ca57ed + 2a4a677 commit 9d67b22
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![GitHub release](https://img.shields.io/github/release/datalad/datalad-deprecated.svg)](https://GitHub.com/datalad/datalad-deprecated/releases/) [![PyPI version fury.io](https://badge.fury.io/py/datalad-deprecated.svg)](https://pypi.python.org/pypi/datalad-deprecated/) [![Build status](https://ci.appveyor.com/api/projects/status/ulbsyym6ih102gm2/branch/master?svg=true)](https://ci.appveyor.com/project/mih/datalad-deprecated/branch/master) [![codecov.io](https://codecov.io/github/datalad/datalad-deprecated/coverage.svg?branch=master)](https://codecov.io/github/datalad/datalad-deprecated?branch=master) [![crippled-filesystems](https://github.com/datalad/datalad-deprecated/workflows/crippled-filesystems/badge.svg)](https://github.com/datalad/datalad-deprecated/actions?query=workflow%3Acrippled-filesystems) [![Documentation](https://readthedocs.org/projects/datalad-deprecated/badge/?version=latest)](http://docs.datalad.org/projects/deprecated/en/latest/?badge=latest)

Command(s) provided by this extension
Commands provided by this extension

- `annotate-paths` -- analyze and act upon input paths
- `diff` -- old'ish implementation for differences between two states
Expand All @@ -13,6 +13,10 @@ Command(s) provided by this extension
`aggregate-metadata`; moved out of core in favor of the `datalad-metalad`
extension

Procedures provided by this extension

- `cfg_metadatatypes`


In addition, this extension provides the `AutomagicIO` feature that patches Python's
`open()` function to automatically obtain file content, if needed.
Expand Down
2 changes: 1 addition & 1 deletion datalad_deprecated/conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from datalad.conftest import setup_package, capture_logs
from datalad.conftest import *
38 changes: 38 additions & 0 deletions datalad_deprecated/resources/procedures/cfg_metadatatypes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env python3
"""Procedure to configure additional metadata types
Additional arguments: <metadata type label> [...]
"""

import sys
import os.path as op

from datalad.consts import (
DATASET_CONFIG_FILE
)
from datalad.utils import ensure_tuple_or_list
from datalad.distribution.dataset import require_dataset

ds = require_dataset(
sys.argv[1],
check_installed=True,
purpose='configuration')

existing_types = ensure_tuple_or_list(
ds.config.get('datalad.metadata.nativetype', [], get_all=True))

for nt in sys.argv[2:]:
if nt in existing_types:
# do not duplicate
continue
ds.config.add(
'datalad.metadata.nativetype',
nt,
scope='branch',
reload=False)

ds.save(
path=op.join(ds.path, DATASET_CONFIG_FILE),
message="Configure metadata type(s)",
result_renderer='disabled'
)

0 comments on commit 9d67b22

Please sign in to comment.