Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update license special cases for updated versions. #141

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions src/malloy/utils/third_party_licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
'argon2-cffi-bindings': {
METADATA_LICENSE_FILE: 'LICENSE'
},
'backports-tarfile': {
METADATA_NAME: 'backports.tarfile'
},
'docutils': {
METADATA_LICENSE_FILE: 'COPYING.txt'
},
Expand Down Expand Up @@ -90,6 +93,12 @@
'jaraco-classes': {
METADATA_NAME: 'jaraco.classes'
},
'jaraco-context': {
METADATA_NAME: 'jaraco.context'
},
'jaraco-functools': {
METADATA_NAME: 'jaraco.functools'
},
'jeepney': {
METADATA_LICENSE_FILE: 'LICENSE'
},
Expand Down Expand Up @@ -139,12 +148,25 @@
'pickleshare': {
METADATA_LICENSE_FILE: 'LICENSE'
},
'prompt-toolkit': {
METADATA_NAME: 'prompt_toolkit'
},
'pure-eval': {
METADATA_NAME: 'pure_eval'
},
'pyproject-hooks': {
METADATA_NAME: 'pyproject_hooks'
METADATA_NAME: 'pyproject_hooks',
METADATA_LICENSE_FILE: 'LICENSE'
},
'pyasn1-modules': {
METADATA_NAME: 'pyasn1_modules'
},
'pytest-notebook': {
METADATA_NAME: 'pytest_notebook'
},
'pyzmq': {
METADATA_LICENSE_FILE: 'LICENSE.md'
},
'readme-renderer': {
METADATA_NAME: 'readme_renderer',
METADATA_URL: 'https://github.com/pypa/readme_renderer',
Expand Down Expand Up @@ -192,7 +214,7 @@ def extract_project_url(raw_input):
match = re.match('^(.+)?(https?:/(/[^/]+)(/[^/]+)(/[^/]+))/?(.+)?$',
raw_input)
if match is None:
print(f'ERROR: failed to extract project url: {raw_input}')
print(f'WARN: failed to extract project url: {raw_input}')
return None
url = (f'https:/{match.group(3)}'
f'{match.group(4)}{match.group(5).removesuffix(".git")}')
Expand Down Expand Up @@ -254,7 +276,7 @@ def find_license(req):
license_txt = request.text

if license_txt is None:
print(f'ERROR: License file not found: {req}')
print(f'WARN: License file not found: {req}')

return license_txt

Expand All @@ -267,7 +289,7 @@ def get_metadata(req):
# print('dist.metadata["Name"]=' + dist.metadata.get('Name'))
dist_name = dist.metadata.get('Name')
if dist_name is None:
print('Error: name not included in metadata')
print('WARN: name not included in metadata')
continue

dist_name = dist_name.lower()
Expand Down Expand Up @@ -320,7 +342,7 @@ def get_metadata(req):
license_types.append(value)

if not found:
print('Error: ' + req[METADATA_NAME] + ' not found')
print('WARN: ' + req[METADATA_NAME] + ' not found')

req[METADATA_LICENSE_TYPES] = license_types
return req
Expand Down Expand Up @@ -365,20 +387,19 @@ def validate_data(requirements):
for key in requirements:
if requirements[key].get(METADATA_LICENSE) is None:
issue_found = True
print(f'ERROR: License not found for {key}\n {requirements[key]}')
print(f'WARN: License not found for {key}\n {requirements[key]}')

license_types = requirements[key].get(METADATA_LICENSE_TYPES)
if license_types is None or len(license_types) < 1:
issue_found = True
print(
f'ERROR: Licence type not classified for {key}\n {requirements[key]}'
)
f'WARN: Licence type not classified for {key}\n {requirements[key]}')

if issue_found:
# Python dependencies are not packaged/distributed by us
# re-add failure if this changes
# raise AssertionError('ERROR: License data validation failed')
print('WARNING: issue(s) found with python license information')
print('WARN: issue(s) found with python license information')


def gen_requirements_file(path=f'src/malloy/utils/{THIRD_PARTY_FILENAME}'):
Expand Down
Loading