Repository: conda/conda-build

Issue:
ImportError when trying to import from previously vendored auxlib
<!--
Thanks for opening an issue! A few things to keep in mind:

- This issue tracker is for issues with or enhancements for conda-build.

Anaconda Community Code of Conduct: https://www.anaconda.com/community-code-of-conduct/

For conda issues, you should open an issue at https://github.com/conda/conda/issues
For Anaconda issues, you should open an issue at https://github.com/ContinuumIO/anaconda-issues/issues
For an issue with a particular conda-forge package, you should open an issue on the
corresponding feedstock: https://github.com/conda-forge
-->

### Actual Behavior

conda-build imports from a "vendored" version of the auxlib in conda, which was recently inlined since it diverged significantly from the upstream project. https://github.com/conda/conda/pull/11025

### Expected Behavior

There shouldn't be an ImportError when trying to import from auxlib.

Code in question: https://github.com/conda/conda-build/blob/a3af116b7192a31d000e4b36e766f73368310901/conda_build/environ.py#L191


Discussion:
In case it helps, here is an example stacktrace:

```
Traceback (most recent call last):
File "/opt/conda/bin/conda-build", line 11, in <module>
sys.exit(main())
File "/opt/conda/lib/python3.8/site-packages/conda_build/cli/main_build.py", line 474, in main
execute(sys.argv[1:])
File "/opt/conda/lib/python3.8/site-packages/conda_build/cli/main_build.py", line 463, in execute
outputs = api.build(args.recipe, post=args.post, test_run_post=args.test_run_post,
File "/opt/conda/lib/python3.8/site-packages/conda_build/api.py", line 186, in build
return build_tree(
File "/opt/conda/lib/python3.8/site-packages/conda_build/build.py", line 2987, in build_tree
metadata_tuples = render_recipe(recipe, config=cfg, variants=variants,
File "/opt/conda/lib/python3.8/site-packages/conda_build/render.py", line 832, in render_recipe
rendered_metadata = distribute_variants(m, variants,
File "/opt/conda/lib/python3.8/site-packages/conda_build/render.py", line 728, in distribute_variants
if mv.needs_source_for_render and mv.variant_in_source:
File "/opt/conda/lib/python3.8/site-packages/conda_build/metadata.py", line 1823, in variant_in_source
self.parse_again(permit_undefined_jinja=True, allow_no_other_outputs=True,
File "/opt/conda/lib/python3.8/site-packages/conda_build/metadata.py", line 961, in parse_again
self.meta = parse(self._get_contents(permit_undefined_jinja,
File "/opt/conda/lib/python3.8/site-packages/conda_build/metadata.py", line 1526, in _get_contents
env.globals.update(environ.get_dict(m=self, skip_build_id=skip_build_id))
File "/opt/conda/lib/python3.8/site-packages/conda_build/environ.py", line 282, in get_dict
d.update(meta_vars(m, skip_build_id=skip_build_id))
File "/opt/conda/lib/python3.8/site-packages/conda_build/environ.py", line 486, in meta_vars
d.update(get_git_info(git_exe, git_dir, meta.config.debug))
File "/opt/conda/lib/python3.8/site-packages/conda_build/environ.py", line 193, in get_git_info
from conda._vendor.auxlib.packaging import _get_version_from_git_tag
ModuleNotFoundError: No module named 'conda._vendor.auxlib'
```


Resolving patch:
diff --git a/conda_build/conda_interface.py b/conda_build/conda_interface.py
--- a/conda_build/conda_interface.py
+++ b/conda_build/conda_interface.py
@@ -31,6 +31,7 @@ def try_exports(module, attr):
 conda_46 = parse_version(CONDA_VERSION) >= parse_version("4.6.0a0")
 conda_47 = parse_version(CONDA_VERSION) >= parse_version("4.7.0a0")
 conda_48 = parse_version(CONDA_VERSION) >= parse_version("4.8.0a0")
+conda_411 = parse_version(CONDA_VERSION) >= parse_version("4.11.0a0")
 
 if conda_44:
     from conda.exports import display_actions, execute_actions, execute_plan, install_actions
@@ -47,6 +48,12 @@ def try_exports(module, attr):
     from conda.toposort import _toposort
 _toposort = _toposort
 
+if conda_411:
+    from conda.auxlib.packaging import _get_version_from_git_tag
+else:
+    from conda._vendor.auxlib.packaging import _get_version_from_git_tag
+get_version_from_git_tag = _get_version_from_git_tag
+
 from conda.exports import TmpDownload, download, handle_proxy_407  # NOQA
 from conda.exports import untracked, walk_prefix  # NOQA
 from conda.exports import MatchSpec, NoPackagesFound, Resolve, Unsatisfiable, normalized_version  # NOQA
diff --git a/conda_build/environ.py b/conda_build/environ.py
--- a/conda_build/environ.py
+++ b/conda_build/environ.py
@@ -20,6 +20,7 @@
 from .conda_interface import package_cache, TemporaryDirectory
 from .conda_interface import pkgs_dirs, root_dir, create_default_packages
 from .conda_interface import reset_context
+from .conda_interface import get_version_from_git_tag
 
 from conda_build import utils
 from conda_build.exceptions import BuildLockError, DependencyNeedsBuildingError
@@ -188,8 +189,7 @@ def get_git_info(git_exe, repo, debug):
         parts = output.rsplit('-', 2)
         if len(parts) == 3:
             d.update(dict(zip(keys, parts)))
-        from conda._vendor.auxlib.packaging import _get_version_from_git_tag
-        d['GIT_DESCRIBE_TAG_PEP440'] = str(_get_version_from_git_tag(output))
+        d['GIT_DESCRIBE_TAG_PEP440'] = str(get_version_from_git_tag(output))
     except subprocess.CalledProcessError:
         msg = (
             "Failed to obtain git tag information.\n"


Test patch: