Repository: conda/conda-build

Issue:
conda-build 2.1.7 fails gives error about valid about valid license_family
Using conda-build 2.1.7, I cannot build https://github.com/ContinuumIO/anaconda-recipes/tree/master/filelock, even though it lists `license_family: Public-Domain`, which is completely valid, as defined here: https://github.com/ContinuumIO/anaconda-verify/blob/master/anaconda_verify/const.py#L10
The error I get is:
```
about/license_family 'Public-Domain' not allowed. Allowed families are
AGPL, APACHE, BSD, GPL, GPL2, GPL3, LGPL, MIT, NONE, OTHER,
PROPRIETARY, PSF, and PUBLIC-DOMAIN.
```
I was under the impression that this had been fixed already recently.


Discussion:
Just ran into this. Error is caused [here](https://github.com/conda/conda-build/blob/master/conda_build/license_family.py#L103) where the input is passed through normalization/punctuation-removing-regex, but the allowed set isn't.

Bonus points for having a *really confusing* error message that says "Public-Domain" isn't allowed, but lists "PUBLIC-DOMAIN" in the allowed set.

Have seen this for a bit as well. Changing it to capitals doesn't seem to fix it either AFAICT.
Changing to capital can't fix it. Input from yaml file has `-` removed while the list in the file (with `Public-Domain`) doesn't. It's literally impossible to specify a form of 'public domain' that passes.
Sorry guys, PRs welcome.  My timeline on this is 1-2 weeks.
I know how that goes, believe me. 

I had planned on submitting a PR, but:

1. Not clear to me what the correct fix is
2. Writing a test for this was going to require doing a bunch of stuff in my conda root env (since you can't install condo-build elsewhere)
3. Too many higher-priority things on the list
no worries @dopplershift, I think the answer is that we need a much better matching scheme (regex-based, ideally).  There is a trick you can do to install conda-build into environments: create an environment with a leading underscore.  Conda will then allow you to install conda and conda-build into that environment.

As for higher priority things, that's why my timeline is what it is.  Understood.
IMHO it would be best to remove all code which is trying to guess the license family entirely.  The license family is only relevant for certain commercial use cases anyway, and needs to be carefully determined.
@ilanschnell The problem isn't about guessing the license family, it's about validating the license family that's specified within the `meta.yml` file.

Resolving patch:
diff --git a/conda_build/license_family.py b/conda_build/license_family.py
--- a/conda_build/license_family.py
+++ b/conda_build/license_family.py
@@ -100,7 +100,9 @@ def ensure_valid_license_family(meta):
         license_family = meta['about']['license_family']
     except KeyError:
         return
-    if remove_special_characters(normalize(license_family)) not in allowed_license_families:
+    allowed_families = [remove_special_characters(normalize(fam))
+                                for fam in allowed_license_families]
+    if remove_special_characters(normalize(license_family)) not in allowed_families:
         raise RuntimeError(exceptions.indent(
             "about/license_family '%s' not allowed. Allowed families are %s." %
             (license_family, comma_join(sorted(allowed_license_families)))))


Test patch:
diff --git a/tests/test_license_family.py b/tests/test_license_family.py
--- a/tests/test_license_family.py
+++ b/tests/test_license_family.py
@@ -1,4 +1,5 @@
-from conda_build.license_family import guess_license_family, allowed_license_families
+from conda_build.license_family import guess_license_family, allowed_license_families, ensure_valid_license_family
+import pytest
 
 
 def test_new_vs_previous_guesses_match():
@@ -129,3 +130,11 @@ def test_other():
     for cens in licenses:
         fam = guess_license_family(cens)
         assert fam == u'OTHER'
+
+
+def test_ensure_valid_family(test_metadata):
+    test_metadata.meta['about']['license_family'] = 'public-domain'
+    ensure_valid_license_family(test_metadata.meta)
+    with pytest.raises(RuntimeError):
+        test_metadata.meta['about']['license_family'] = 'local H'
+        ensure_valid_license_family(test_metadata.meta)