1
0
mirror of https://github.com/ilri/csv-metadata-quality.git synced 2024-12-22 12:12:18 +01: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:
Alan Orth 2023-04-05 15:24:35 +03:00
parent 34142c3e6b
commit 1491e1edb0
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
3 changed files with 4 additions and 2 deletions

1
MANIFEST.in Normal file
View File

@ -0,0 +1 @@
include csv_metadata_quality/data/licenses.json

View File

@ -2,7 +2,7 @@
import json import json
from importlib.resources import files import os
from ftfy.badness import is_bad from ftfy.badness import is_bad
@ -58,7 +58,7 @@ def is_mojibake(field):
def load_spdx_licenses(): def load_spdx_licenses():
"""Returns a Python list of SPDX short license identifiers.""" """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) licenses = json.load(f)
# List comprehension to extract the license ID for each license # List comprehension to extract the license ID for each license

View File

@ -32,5 +32,6 @@ setuptools.setup(
entry_points={ entry_points={
"console_scripts": ["csv-metadata-quality = csv_metadata_quality.__main__:main"] "console_scripts": ["csv-metadata-quality = csv_metadata_quality.__main__:main"]
}, },
include_package_data=True,
install_requires=install_requires, install_requires=install_requires,
) )