Repository: conda/conda-build

Issue:
`noarch: True` results in `AttributeError: 'bool' object has no attribute 'lower'`
### What happened?

When building a package with `conda-build 2.23.0` and `noarch: True` we get:

```
Traceback (most recent call last):
  File "/opt/conda/bin/conda-build", line 11, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.9/site-packages/conda_build/cli/main_build.py", line 494, in main
    execute(sys.argv[1:])
  File "/opt/conda/lib/python3.9/site-packages/conda_build/cli/main_build.py", line 474, in execute
    outputs = api.build(
  File "/opt/conda/lib/python3.9/site-packages/conda_build/api.py", line 180, in build
    return build_tree(
  File "/opt/conda/lib/python3.9/site-packages/conda_build/build.py", line 3093, in build_tree
    packages_from_this = build(metadata, stats,
  File "/opt/conda/lib/python3.9/site-packages/conda_build/build.py", line 2368, in build
    newly_built_packages = bundlers[pkg_type](output_d, m, env, stats)
  File "/opt/conda/lib/python3.9/site-packages/conda_build/build.py", line 1670, in bundle_conda
    output['checksums'] = create_info_files(metadata, replacements, files, prefix=metadata.config.host_prefix)
  File "/opt/conda/lib/python3.9/site-packages/conda_build/build.py", line 1267, in create_info_files
    write_link_json(m)
  File "/opt/conda/lib/python3.9/site-packages/conda_build/build.py", line [113](https://github.com/conda/conda/actions/runs/3488604764/jobs/5841775654#step:3:114)0, in write_link_json
    if noarch_type.lower() == "python":
AttributeError: 'bool' object has no attribute 'lower'
```

Xref https://github.com/conda/conda/actions/runs/3488604764/jobs/5841775654#step:3:133

Looks like some of the stringification removed in https://github.com/conda/conda-build/pull/4603 were necessary.

### Tasks

- [x] Re-review #4603 and identify any other stringifications that need to be restored
- [x] Create a PR patch (https://github.com/conda/conda-build/pull/4637)
- [ ] conda-build 3.23.1 release
- [ ] implement a test for `noarch: True`


Discussion:

Resolving patch:
diff --git a/conda_build/build.py b/conda_build/build.py
--- a/conda_build/build.py
+++ b/conda_build/build.py
@@ -1126,8 +1126,9 @@ def write_link_json(m):
     package_metadata = OrderedDict()
     noarch_type = m.get_value('build/noarch')
     if noarch_type:
-        noarch_dict = OrderedDict(type=noarch_type)
-        if noarch_type.lower() == "python":
+        noarch_type_str = str(noarch_type)
+        noarch_dict = OrderedDict(type=noarch_type_str)
+        if noarch_type_str.lower() == "python":
             entry_points = m.get_value('build/entry_points')
             if entry_points:
                 noarch_dict['entry_points'] = entry_points
@@ -1135,7 +1136,7 @@ def write_link_json(m):
 
     preferred_env = m.get_value("build/preferred_env")
     if preferred_env:
-        preferred_env_dict = OrderedDict(name=preferred_env)
+        preferred_env_dict = OrderedDict(name=str(preferred_env))
         executable_paths = m.get_value("build/preferred_env_executable_paths")
         if executable_paths:
             preferred_env_dict["executable_paths"] = executable_paths
diff --git a/conda_build/develop.py b/conda_build/develop.py
--- a/conda_build/develop.py
+++ b/conda_build/develop.py
@@ -141,7 +141,7 @@ def execute(recipe_dirs, prefix=sys.prefix, no_pth_file=False,
     sp_dir = get_site_packages(prefix, '.'.join((str(sys.version_info.major),
                                                  str(sys.version_info.minor))))
 
-    if type(recipe_dirs) == str:
+    if isinstance(recipe_dirs, str):
         recipe_dirs = [recipe_dirs]
 
     for path in recipe_dirs:


Test patch: