1
0
mirror of https://github.com/ilri/csv-metadata-quality.git synced 2025-05-09 22:56:01 +02:00

Fix path to data/licenses.json
All checks were successful
continuous-integration/drone/push Build is passing

When we install and run this from CI, this file needs to exist in
the package's folder inside site-packages. Then we can use __file__
to get the path relative to the package.

See: https://python-packaging.readthedocs.io/en/latest/non-code-files.html
This commit is contained in:
2023-04-05 15:24:35 +03:00
parent 34142c3e6b
commit 1491e1edb0
3 changed files with 4 additions and 2 deletions

View File

@ -2,7 +2,7 @@
import json
from importlib.resources import files
import os
from ftfy.badness import is_bad
@ -58,7 +58,7 @@ def is_mojibake(field):
def load_spdx_licenses():
"""Returns a Python list of SPDX short license identifiers."""
with open(files("csv_metadata_quality").joinpath("data/licenses.json")) as f:
with open(os.path.join(os.path.dirname(__file__), "data/licenses.json")) as f:
licenses = json.load(f)
# List comprehension to extract the license ID for each license