Repository: conda/conda-build

Issue:
conda-build 3.21.x cannot build ruamel.yaml anymore
### Actual Behavior

After https://github.com/conda/conda-build/commit/264663da57afe2c7960376032460966e4d5be1f1, we cannot build `ruamel.yaml` as a package anymore. This is because the final package contains `.yaml` in its path. Thus the test path resolution fails with the following error:

```
TEST START: /Users/uwe/mambaforge/conda-bld/osx-arm64/ruamel.yaml-0.17.4-py39h8a0c2ca_0.tar.bz2
Traceback (most recent call last):
  File "/Users/uwe/mambaforge/bin/conda-mambabuild", line 11, in <module>
    sys.exit(main())
  File "/Users/uwe/mambaforge/lib/python3.9/site-packages/boa/cli/mambabuild.py", line 140, in main
    call_conda_build(action, config)
  File "/Users/uwe/mambaforge/lib/python3.9/site-packages/boa/cli/mambabuild.py", line 118, in call_conda_build
    result = api.build(
  File "/Users/uwe/mambaforge/lib/python3.9/site-packages/conda_build/api.py", line 186, in build
    return build_tree(
  File "/Users/uwe/mambaforge/lib/python3.9/site-packages/conda_build/build.py", line 3079, in build_tree
    test(pkg, config=metadata.config.copy(), stats=stats)
  File "/Users/uwe/mambaforge/lib/python3.9/site-packages/conda_build/build.py", line 2761, in test
    metadata, hash_input = construct_metadata_for_test(recipedir_or_package_or_metadata,
  File "/Users/uwe/mambaforge/lib/python3.9/site-packages/conda_build/build.py", line 2564, in construct_metadata_for_test
    m, hash_input = _construct_metadata_for_test_from_package(recipedir_or_package, config)
  File "/Users/uwe/mambaforge/lib/python3.9/site-packages/conda_build/build.py", line 2448, in _construct_metadata_for_test_from_package
    with open(os.path.join(info_dir, 'index.json')) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/uwe/mambaforge/conda-bld/osx-arm64/info/index.json'
```

### Expected Behavior

The package should build fine (it does so with `conda-build=3.20`).

### Steps to Reproduce

Run conda build on the `ruamel.yaml-feedstock` of conda-forge.

##### `Output of conda info`
<!-- Between the ticks below, paste the output of 'conda info' -->
```
<snip>
conda-build version : 3.21.4
</snip>
```




Discussion:
I have no idea what the reason for https://github.com/conda/conda-build/commit/264663da57afe2c7960376032460966e4d5be1f1 was thus my personal approach would be to revert that change. Knowing the reasoning behind that commit, I would probably be able to propose a better change.
That is a curious change indeed, @chenghlee do you happen the knowledge why Ray changed it?

@xhochy I would also prefer a rollback if it's obvious that some packages can't be built anymore.

Resolving patch:
diff --git a/conda_build/render.py b/conda_build/render.py
--- a/conda_build/render.py
+++ b/conda_build/render.py
@@ -812,7 +812,7 @@ def render_recipe(recipe_path, config, no_download_source=False, variants=None,
             t.extractall(path=recipe_dir)
             t.close()
             need_cleanup = True
-        elif '.yaml' in arg:
+        elif arg.endswith('.yaml'):
             recipe_dir = os.path.dirname(arg)
             need_cleanup = False
         else:
diff --git a/conda_build/utils.py b/conda_build/utils.py
--- a/conda_build/utils.py
+++ b/conda_build/utils.py
@@ -450,7 +450,7 @@ def get_recipe_abspath(recipe):
     # Don't use byte literals for paths in Python 2
     if not PY3:
         recipe = recipe.decode(getpreferredencoding() or 'utf-8')
-    if isfile(recipe) and '.yaml' not in recipe:
+    if isfile(recipe):
         if recipe.lower().endswith(decompressible_exts) or recipe.lower().endswith(CONDA_PACKAGE_EXTENSIONS):
             recipe_dir = tempfile.mkdtemp()
             if recipe.lower().endswith(CONDA_PACKAGE_EXTENSIONS):
@@ -464,11 +464,8 @@ def get_recipe_abspath(recipe):
                 tar_xf(recipe_tarfile, os.path.join(recipe_dir, 'info'))
             need_cleanup = True
         else:
-            print("Ignoring non-recipe file: %s" % recipe)
+            print("Ignoring non-recipe: %s" % recipe)
             return (None, None)
-    elif '.yaml' in recipe:
-        recipe_dir = os.path.dirname(recipe)
-        need_cleanup = False
     else:
         recipe_dir = abspath(os.path.join(os.getcwd(), recipe))
         need_cleanup = False


Test patch: