Repository: conda/conda-build

Issue:
conda index fails to index jansson package
conda build 3.7.0 is failing to index the jansson package.
https://anaconda.org/conda-forge/jansson

JPM discovered this issue while attempting to index a set of packages that included the jansson package.  It is an easy problem to reproduce, just download the package and try to index it.

**Stack trace.**
```
Traceback (most recent call last):
  File "/Users/ilan/miniconda3/bin/conda-index", line 11, in <module>
    sys.exit(main())
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/conda_build/cli/main_index.py", line 75, in main
    return execute(sys.argv[1:])
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/conda_build/cli/main_index.py", line 71, in execute
    channel_name=args.channel_name)
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/conda_build/api.py", line 385, in update_index
    locking=config.locking, timeout=config.timeout, channel_name=channel_name)
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/conda_build/index.py", line 147, in update_index
    channel_name)
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/conda_build/index.py", line 223, in update_subdir_index
    path, lock=lock, locking=locking, timeout=timeout
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/conda_build/index.py", line 311, in _read_index_tar
    recipe_json = yaml.load(recipe_text)
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/yaml/__init__.py", line 72, in load
    return loader.get_single_data()
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/yaml/constructor.py", line 35, in get_single_data
    node = self.get_single_node()
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/yaml/composer.py", line 35, in get_single_node
    if not self.check_event(StreamEndEvent):
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/yaml/parser.py", line 143, in parse_implicit_document_start
    StreamEndToken):
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/Users/ilan/miniconda3/lib/python3.6/site-packages/yaml/scanner.py", line 257, in fetch_more_tokens
    self.get_mark())
yaml.scanner.ScannerError: while scanning for the next token
found character '%' that cannot start any token
  in "<unicode string>", line 2, column 2:
    {% set version = "2.7" %}
     ^

```


Discussion:
It appears that the problem is that jansson was last built at a time when conda-build was recording the raw input recipe, rather than its final, full-rendered form.    I think I can catch this new exception and just stub out the recipe reading without any harm.  I'll try to solve this for the next release - probably later this week.  If you need a faster fix, I recommend triggering a rebuild of the jansson package on conda-forge, or building it locally yourself.

Resolving patch:
diff --git a/conda_build/index.py b/conda_build/index.py
--- a/conda_build/index.py
+++ b/conda_build/index.py
@@ -309,7 +309,7 @@ def _read_index_tar(tar_path, lock, locking=True, timeout=90):
             try:
                 recipe_text = t.extractfile('info/recipe/meta.yaml').read().decode('utf-8')
                 recipe_json = yaml.load(recipe_text)
-            except KeyError:
+            except (KeyError, yaml.scanner.ScannerError):
                 recipe_json = {}
 
             # If a conda package contains an icon, also extract and cache that in an .icon/


Test patch: