Repository: conda/conda

Issue:
Compatibility shims for future releases
* filter loaded repodata on repodata_version
* split matchspec on `" if "`


Discussion:

Resolving patch:
diff --git a/conda/cli/common.py b/conda/cli/common.py
--- a/conda/cli/common.py
+++ b/conda/cli/common.py
@@ -93,17 +93,14 @@ def specs_from_args(args, json=False):
     return [arg2spec(arg, json=json) for arg in args]
 
 
-spec_pat = re.compile(r'''         # lgtm [py/regex/unmatchable-dollar]
-(?P<name>[^=<>!\s]+)               # package name
-\s*                                # ignore spaces
-(
-  (?P<cc>=[^=]+(=[^=]+)?)          # conda constraint
-  |
-  (?P<pc>(?:[=!]=|[><]=?).+)       # new (pip-style) constraint(s)
-)?
-$                                  # end-of-line
-''', re.VERBOSE)  # lgtm [py/regex/unmatchable-dollar]
-# This logic has been here for four years. Even if it's wrong, we're not changing it now.
+spec_pat = re.compile(r'(?P<name>[^=<>!\s]+)'  # package name  # lgtm [py/regex/unmatchable-dollar]
+                      r'\s*'  # ignore spaces
+                      r'('
+                      r'(?P<cc>=[^=]+(=[^=]+)?)'  # conda constraint
+                      r'|'
+                      r'(?P<pc>(?:[=!]=|[><]=?).+)'  # new (pip-style) constraint(s)
+                      r')?$',
+                      re.VERBOSE)  # lgtm [py/regex/unmatchable-dollar]
 
 
 def strip_comment(line):
diff --git a/conda/core/subdir_data.py b/conda/core/subdir_data.py
--- a/conda/core/subdir_data.py
+++ b/conda/core/subdir_data.py
@@ -363,6 +363,10 @@ def _process_raw_repodata_str(self, raw_repodata_str):
             if add_pip and info['name'] == 'python' and info['version'].startswith(('2.', '3.')):
                 info['depends'].append('pip')
             info.update(meta_in_common)
+            if info.get('record_version', 0) > 1:
+                log.debug("Ignoring record_version %d from %s",
+                          info["record_version"], info['url'])
+                continue
             package_record = PackageRecord(**info)
 
             _package_records.append(package_record)
diff --git a/conda/models/match_spec.py b/conda/models/match_spec.py
--- a/conda/models/match_spec.py
+++ b/conda/models/match_spec.py
@@ -6,6 +6,7 @@
 from abc import ABCMeta, abstractmethod, abstractproperty
 from collections import Mapping
 from functools import reduce
+from logging import getLogger
 from operator import attrgetter
 from os.path import basename
 import re
@@ -27,6 +28,7 @@
 except ImportError:  # pragma: no cover
     from .._vendor.toolz.itertoolz import concat, concatv, groupby  # NOQA
 
+log = getLogger(__name__)
 
 class MatchSpecType(type):
 
@@ -559,6 +561,12 @@ def _parse_spec_str(spec_str):
         spec_str, _ = spec_str[:ndx], spec_str[ndx:]
         spec_str.strip()
 
+    # Step 1.b strip ' if ' anticipating future compatibility issues
+    spec_split = spec_str.split(' if ', 1)
+    if len(spec_split) > 1:
+        log.debug("Ignoring conditional in spec %s", spec_str)
+    spec_str = spec_split[0]
+
     # Step 2. done if spec_str is a tarball
     if spec_str.endswith(CONDA_TARBALL_EXTENSION):
         # treat as a normal url


Test patch: