Repository: conda/conda-build

Issue:
Better default for build/features in bdist_conda
It seems that `conda-build` now expects `build/features` to be an actual list not `None`. So make the default value of `build/features` an empty list. That way it is compliant with `conda-build`, but still has a sensible default that means there are no features.


Discussion:
Without this change, I see an error like the one in this [build]( https://travis-ci.org/nanshe-org/nanshe/jobs/190366895#L595-L597 ). Traceback included below. This happens on both Python 2 and 3 with `conda-build` 2.1.0. Environment details can be found in the build log.

<details>

```python
Traceback (most recent call last):
  File "setup.py", line 158, in <module>
    conda_command_tests=False
  File "/home/travis/miniconda/lib/python3.5/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/travis/miniconda/lib/python3.5/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/home/travis/miniconda/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/travis/miniconda/lib/python3.5/distutils/command/bdist_conda.py", line 262, in run
    api.build(m, build_only=True)
  File "/home/travis/miniconda/lib/python3.5/site-packages/conda_build/api.py", line 86, in build
    need_source_download=need_source_download, config=config)
  File "/home/travis/miniconda/lib/python3.5/site-packages/conda_build/build.py", line 1427, in build_tree
    config=config)
  File "/home/travis/miniconda/lib/python3.5/site-packages/conda_build/build.py", line 948, in build
    config=config)
  File "/home/travis/miniconda/lib/python3.5/site-packages/conda_build/render.py", line 90, in parse_or_try_download
    metadata.parse_again(config=config, permit_undefined_jinja=False)
  File "/home/travis/miniconda/lib/python3.5/site-packages/conda_build/metadata.py", line 444, in parse_again
    self.validate_features()
  File "/home/travis/miniconda/lib/python3.5/site-packages/conda_build/metadata.py", line 871, in validate_features
    if any('-' in feature for feature in self.get_value('build/features')):
TypeError: 'NoneType' object is not iterable
```

</details>
That's fair. I did think about it, but did not have time to dig deeper.

Noticed you added a test for `bdist_conda` a while back. Thanks for doing that by the way. 👍 When looking at the test, I see it is also setting `conda_features` to `[]`. Maybe there is a clue in there somewhere?

xref: https://github.com/conda/conda-build/pull/1245/files#diff-859b8bf4ccbfd04cf1838a5915cbf171R9

Resolving patch:
diff --git a/conda_build/metadata.py b/conda_build/metadata.py
--- a/conda_build/metadata.py
+++ b/conda_build/metadata.py
@@ -868,6 +868,6 @@ def uses_vcs_in_build(self):
         return None
 
     def validate_features(self):
-        if any('-' in feature for feature in self.get_value('build/features')):
+        if any('-' in feature for feature in ensure_list(self.get_value('build/features'))):
             raise ValueError("- is a disallowed character in features.  Please change this "
                              "character in your recipe.")


Test patch: