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

Relax policing license_family to ensure existing recipes don't break #1503

Merged
merged 1 commit into from
Nov 2, 2016
Merged
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions conda_build/license_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from difflib import get_close_matches
import re
import string
from conda_build import exceptions
from conda_build.utils import comma_join

allowed_license_families = """
AGPL
Expand Down Expand Up @@ -94,6 +96,18 @@ def guess_license_family(license_name=None,
return 'OTHER'


def ensure_valid_license_family(meta):
try:
license_family = meta['about']['license_family']
except KeyError:
return
if (remove_special_characters(normalize(license_family))
not in allowed_license_families):
raise RuntimeError(exceptions.indent(
"about/license_family '%s' not allowed. Allowed families are %s." %
(license_family, comma_join(sorted(allowed_license_families)))))


def deprecated_guess_license_family(license_name, recognized=allowed_license_families):
"""Deprecated guess of license_family from license

Expand Down
15 changes: 1 addition & 14 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from conda_build.features import feature_list
from conda_build.config import Config
from conda_build.utils import rec_glob, ensure_list
from conda_build.license_family import allowed_license_families
from conda_build.license_family import ensure_valid_license_family

try:
import yaml
Expand All @@ -30,8 +30,6 @@
sys.exit('Error: could not import yaml (required to read meta.yaml '
'files of conda recipes)')

from conda_build.utils import comma_join

on_win = (sys.platform == 'win32')
log = logging.getLogger(__file__)

Expand Down Expand Up @@ -137,17 +135,6 @@ def yamlize(data):
raise exceptions.UnableToParse(original=e)


def ensure_valid_license_family(meta):
try:
license_family = meta['about']['license_family']
except KeyError:
return
if license_family not in allowed_license_families:
raise RuntimeError(exceptions.indent(
"about/license_family '%s' not allowed. Allowed families are %s." %
(license_family, comma_join(sorted(allowed_license_families)))))


def ensure_valid_fields(meta):
try:
pin_depends = meta['build']['pin_depends']
Expand Down