Repository: conda/conda

Issue:
Errors with conda 4.7.6 on conda-forge builds: AttributeError: 'Dist' object has no attribute 'package_type'
It seems that the conda 4.7.6 or conda-build 3.17.8 upgrade is causing errors on all recent conda-forge builds: https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49363&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=256&lineEnd=274&colStart=1&colEnd=62

```
+ xargs -n1 cat
+ xargs -r /usr/bin/sudo -n yum install -y
+ find /home/conda/conda-recipes -mindepth 2 -maxdepth 2 -type f -name yum_requirements.txt
+ grep -v -e '^#' -e '^$'
+ test 1 == 1
+ python /home/conda/.ci_support/build_all.py /home/conda/conda-recipes
Building ipymidicontrols with conda-forge/label/main
Traceback (most recent call last):
  File "/home/conda/.ci_support/build_all.py", line 131, in <module>
    build_all(args.recipes_dir, args.arch)
  File "/home/conda/.ci_support/build_all.py", line 68, in build_all
    build_folders(recipes_dir, new_comp_folders, arch, channel_urls)
  File "/home/conda/.ci_support/build_all.py", line 94, in build_folders
    conda_resolve = conda_build.conda_interface.Resolve(index)
  File "/opt/conda/lib/python3.7/site-packages/conda/resolve.py", line 116, in __init__
    self._system_precs = {_ for _ in index if _.package_type == PackageType.VIRTUAL_SYSTEM}
  File "/opt/conda/lib/python3.7/site-packages/conda/resolve.py", line 116, in <setcomp>
    self._system_precs = {_ for _ in index if _.package_type == PackageType.VIRTUAL_SYSTEM}
AttributeError: 'Dist' object has no attribute 'package_type'
```

Some examples of builds having this error, all having conda 4.7.6, conda-build 3.18.7:

* https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49404&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=183&lineEnd=185&colStart=1&colEnd=1
* https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49419&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=183&lineEnd=185&colStart=1&colEnd=1
* https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49420&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=183&lineEnd=185&colStart=1&colEnd=1

Examples of successful builds just before these, all having conda 4.7.5, conda-build 3.17.8:

* https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49197&view=logs&jobId=240f1fee-52bc-5498-a14a-8361bde76ba0&taskId=2fb5b0a7-737c-5f5c-8f3f-f6db6174bacf&lineStart=99&lineEnd=101&colStart=1&colEnd=1
* https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49327&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=183&lineEnd=185&colStart=1&colEnd=1
* https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=49127&view=logs&jobId=10bda42a-d420-5c28-a43f-bc4e66405e5c&taskId=bef775d0-a1a2-55a3-9721-17147029baf0&lineStart=183&lineEnd=185&colStart=1&colEnd=1


Discussion:

Resolving patch:
diff --git a/conda/resolve.py b/conda/resolve.py
--- a/conda/resolve.py
+++ b/conda/resolve.py
@@ -113,7 +113,8 @@ def __init__(self, index, processed=False, channels=()):
         self._pool_cache = {}
         self._strict_channel_cache = {}
 
-        self._system_precs = {_ for _ in index if _.package_type == PackageType.VIRTUAL_SYSTEM}
+        self._system_precs = {_ for _ in index if (
+            hasattr(_, 'package_type') and _.package_type == PackageType.VIRTUAL_SYSTEM)}
 
         # sorting these in reverse order is effectively prioritizing
         # contstraint behavior from newer packages. It is applying broadening


Test patch: