Skip to content

Commit b929496

Browse files
committed
Add debug-logging option to case_file
This flag was a useful development aid, and its presence in the Make command lines impacts generated UUID5s. However, at the end of the patch series adding this output, all of the debug statements will be disabled. A follow-on patch (at the end of the series) will regenerate Make-managed files. Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
1 parent a085b62 commit b929496

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

case_utils/case_file/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717

1818
__version__ = "0.3.0"
1919

20+
import argparse
2021
import datetime
2122
import hashlib
23+
import logging
2224
import os
2325
import typing
2426
import warnings
@@ -207,10 +209,9 @@ def create_file_node(
207209

208210

209211
def main() -> None:
210-
import argparse
211-
212212
parser = argparse.ArgumentParser()
213213
parser.add_argument("--base-prefix", default=DEFAULT_PREFIX)
214+
parser.add_argument("--debug", action="store_true")
214215
parser.add_argument("--disable-hashes", action="store_true")
215216
parser.add_argument("--disable-mtime", action="store_true")
216217
parser.add_argument(
@@ -220,6 +221,8 @@ def main() -> None:
220221
parser.add_argument("in_file")
221222
args = parser.parse_args()
222223

224+
logging.basicConfig(level=logging.DEBUG if args.debug else logging.INFO)
225+
223226
case_utils.local_uuid.configure()
224227

225228
NS_BASE = rdflib.Namespace(args.base_prefix)

tests/case_utils/case_file/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ sample.txt.json: \
117117
export DEMO_UUID_REQUESTING_NONRANDOM=NONRANDOM_REQUESTED \
118118
&& source $(tests_srcdir)/venv/bin/activate \
119119
&& case_file \
120+
--debug \
120121
__$@ \
121122
sample.txt
122123
source $(tests_srcdir)/venv/bin/activate \
@@ -149,6 +150,7 @@ sample.txt.ttl: \
149150
export DEMO_UUID_REQUESTING_NONRANDOM=NONRANDOM_REQUESTED \
150151
&& source $(tests_srcdir)/venv/bin/activate \
151152
&& case_file \
153+
--debug \
152154
__$@ \
153155
sample.txt
154156
java -jar $(RDF_TOOLKIT_JAR) \
@@ -172,6 +174,7 @@ sample.txt-disable_hashes.ttl: \
172174
export DEMO_UUID_REQUESTING_NONRANDOM=NONRANDOM_REQUESTED \
173175
&& source $(tests_srcdir)/venv/bin/activate \
174176
&& case_file \
177+
--debug \
175178
--disable-hashes \
176179
__$@ \
177180
sample.txt
@@ -197,6 +200,7 @@ sample.txt-nocompact.json: \
197200
export DEMO_UUID_REQUESTING_NONRANDOM=NONRANDOM_REQUESTED \
198201
&& source $(tests_srcdir)/venv/bin/activate \
199202
&& case_file \
203+
--debug \
200204
_$@ \
201205
sample.txt
202206
# To avoid making noisy, uninformative updates from blank node identifiers, only move the new file into place if it is not isomorphic with the Git-tracked version of the target.

0 commit comments

Comments
 (0)