Repository: pex-tool/pex

Issue:
Pex 1.4.1 installs windows eggs on linux/OSX
I've installed pex with `pip install pex`, then I created a minimal `setup.py` file in a folder named `test` that looks like this:
```py
from setuptools import setup

setup(
    name='test',
    version='0.1',
    install_requires=[
        'netifaces==0.10.6'
    ]
)
```

And then I ran `pex ./test -o /tmp/pex_out -vv` and got this:
```
pex: Warning, using a UrllibContext which is known to be flaky.
pex: Please build pex with the requests module for more reliable downloads.
pex: Building pex :: Resolving distributions :: Fetching file:///private/var/folders/_y/mvhpw5jx7glc0vh5v3rkn1_80000gn/T/tmppBXELx/test-0.1.tar.gz :: Fetching file:///private/var/folpex: Building pex :: Resolving distributions :: Translating /private/var/folders/_y/mvhpw5jx7glc0vh5v3rkn1_80000gn/T/tmpnf6PUI/test-0.1.tar.gz into distribution                      pex: Building pex :: Resolving distributions :: Translating /private/var/folders/_y/mvhpw5jx7glc0vh5v3rkn1_80000gn/T/tmpnf6PUI/test-0.1.tar.gz into distribution :: Packaging test :: pex: Building pex :: Resolving distributions :: Fetching https://files.pythonhosted.org/packages/05/00/c719457bcb8f14f9a7b9244c3c5e203c40d041a364cf784cf554aaef8129/netifaces-0.10.6-ppex: Building pex :: Resolving distributions :: Fetching https://files.pythonhosted.org/packages/05/00/c719457bcb8f14f9a7b9244c3c5e203c40d041a364cf784cf554aaef8129/netifaces-0.10.6-py2.7-win32.egg#sha256=a0c7c19e1fb62ac6018582f72d15ac056e75c3d2ab222fb25369e7766ed67453 :: Fetching https://files.pythonhosted.org/packages/05/00/c719457bcb8f14f9a7b9244c3c5e203c40d04pex: Building pex :: Resolving distributions :: Translating /private/var/folders/_y/mvhpw5jx7glc0vh5v3rkn1_80000gn/T/tmpvIJ86R/netifaces-0.10.6-py2.7-win32.egg into distribution                                                                                                                                                                                             test 0.1
  netifaces 0.10.6
pex: Building pex: 1906.7ms
pex:   Resolving interpreters: 1.5ms
pex:     Setting up interpreter /Users/pavel/dev/venvs/tmp-e6d02aae4c88b079/bin/python: 1.4ms
pex:   Installing /var/folders/_y/mvhpw5jx7glc0vh5v3rkn1_80000gn/T/tmppBXELx: 327.4ms
pex:   Resolving distributions: 1572.9ms
pex:     Fetching file:///private/var/folders/_y/mvhpw5jx7glc0vh5v3rkn1_80000gn/T/tmppBXELx/test-0.1.tar.gz: 10.7ms
pex:       Fetching file:///private/var/folders/_y/mvhpw5jx7glc0vh5v3rkn1_80000gn/T/tmppBXELx/test-0.1.tar.gz: 10.0ms
pex:     Translating /private/var/folders/_y/mvhpw5jx7glc0vh5v3rkn1_80000gn/T/tmpnf6PUI/test-0.1.tar.gz into distribution: 379.7ms
pex:       Packaging test: 368.4ms
pex:         Installing /var/folders/_y/mvhpw5jx7glc0vh5v3rkn1_80000gn/T/tmppFxfJg: 366.5ms
pex:     Fetching https://files.pythonhosted.org/packages/05/00/c719457bcb8f14f9a7b9244c3c5e203c40d041a364cf784cf554aaef8129/netifaces-0.10.6-py2.7-win32.egg#sha256=a0c7c19e1fb62ac6018582f72d15ac056e75c3d2ab222fb25369e7766ed67453: 258.0ms
pex:       Fetching https://files.pythonhosted.org/packages/05/00/c719457bcb8f14f9a7b9244c3c5e203c40d041a364cf784cf554aaef8129/netifaces-0.10.6-py2.7-win32.egg#sha256=a0c7c19e1fb62ac6018582f72d15ac056e75c3d2ab222fb25369e7766ed67453: 257.0ms
pex:     Translating /private/var/folders/_y/mvhpw5jx7glc0vh5v3rkn1_80000gn/T/tmpvIJ86R/netifaces-0.10.6-py2.7-win32.egg into distribution: 1.3ms
Saving PEX file to /tmp/pex_out
```

As you can see, although I'm running on OSX, the netifaces egg that's fetched is a Windows one (https://files.pythonhosted.org/packages/05/00/c719457bcb8f14f9a7b9244c3c5e203c40d041a364cf784cf554aaef8129/netifaces-0.10.6-py2.7-win32.egg).

This works on `pex==1.3.2`


Discussion:
thanks for the bug report. will take a look.
repro on OSX:

```
[omerta pex (master)]$ pex netifaces==0.10.6 -o /tmp/throwaway.pex -vvvvvvvvvvv --no-wheel --disable-cache
pex: Warning, using a UrllibContext which is known to be flaky.                                                         
pex: Please build pex with the requests module for more reliable downloads.
pex: Constructed UrllibContext context <pex.http.UrllibContext object at 0x10547e450>
pex: R: tags for Platform(platform='macosx_10_13_x86_64', impl='cp', version='27', abi='cp27m') x PythonInterpreter('/Users/kwilson/Python/CPython-2.7.13/bin/python2.7', PythonIdentity('CPython', 2, 7, 13), {('pynd', '0.3.6'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('virtualenv', '15.1.0'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('packaging', '16.8'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('tox', '2.6.0'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('pbr', '3.0.0'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('appdirs', '1.4.2'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('setuptools', '33.1.1'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('pycparser', '2.17'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('wheel', '0.29.0'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('wsgiref', '0.1.2'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7', ('pip', '9.0.1'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('six', '1.10.0'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('python', '2.7.13'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/lib-dynload', ('pluggy', '0.4.0'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('cffi', '1.9.1'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('pex', '1.4.1'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('pyparsing', '2.1.10'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages', ('py', '1.4.32'): '/Users/kwilson/Python/CPython-2.7.13/lib/python2.7/site-packages'}) -> [('cp27', 'cp27m', 'macosx_10_13_x86_64'), ('cp27', 'cp27m', 'macosx_10_13_intel'), ('cp27', 'cp27m', 'macosx_10_13_fat64'), ('cp27', 'cp27m', 'macosx_10_13_fat32'), ('cp27', 'cp27m', 'macosx_10_13_universal'), ('cp27', 'cp27m', 'macosx_10_12_x86_64'), ('cp27', 'cp27m', 'macosx_10_12_intel'), ('cp27', 'cp27m', 'macosx_10_12_fat64'), ('cp27', 'cp27m', 'macosx_10_12_fat32'), ('cp27', 'cp27m', 'macosx_10_12_universal'), ('cp27', 'cp27m', 'macosx_10_11_x86_64'), ('cp27', 'cp27m', 'macosx_10_11_intel'), ('cp27', 'cp27m', 'macosx_10_11_fat64'), ('cp27', 'cp27m', 'macosx_10_11_fat32'), ('cp27', 'cp27m', 'macosx_10_11_universal'), ('cp27', 'cp27m', 'macosx_10_10_x86_64'), ('cp27', 'cp27m', 'macosx_10_10_intel'), ('cp27', 'cp27m', 'macosx_10_10_fat64'), ('cp27', 'cp27m', 'macosx_10_10_fat32'), ('cp27', 'cp27m', 'macosx_10_10_universal'), ('cp27', 'cp27m', 'macosx_10_9_x86_64'), ('cp27', 'cp27m', 'macosx_10_9_intel'), ('cp27', 'cp27m', 'macosx_10_9_fat64'), ('cp27', 'cp27m', 'macosx_10_9_fat32'), ('cp27', 'cp27m', 'macosx_10_9_universal'), ('cp27', 'cp27m', 'macosx_10_8_x86_64'), ('cp27', 'cp27m', 'macosx_10_8_intel'), ('cp27', 'cp27m', 'macosx_10_8_fat64'), ('cp27', 'cp27m', 'macosx_10_8_fat32'), ('cp27', 'cp27m', 'macosx_10_8_universal'), ('cp27', 'cp27m', 'macosx_10_7_x86_64'), ('cp27', 'cp27m', 'macosx_10_7_intel'), ('cp27', 'cp27m', 'macosx_10_7_fat64'), ('cp27', 'cp27m', 'macosx_10_7_fat32'), ('cp27', 'cp27m', 'macosx_10_7_universal'), ('cp27', 'cp27m', 'macosx_10_6_x86_64'), ('cp27', 'cp27m', 'macosx_10_6_intel'), ('cp27', 'cp27m', 'macosx_10_6_fat64'), ('cp27', 'cp27m', 'macosx_10_6_fat32'), ('cp27', 'cp27m', 'macosx_10_6_universal'), ('cp27', 'cp27m', 'macosx_10_5_x86_64'), ('cp27', 'cp27m', 'macosx_10_5_intel'), ('cp27', 'cp27m', 'macosx_10_5_fat64'), ('cp27', 'cp27m', 'macosx_10_5_fat32'), ('cp27', 'cp27m', 'macosx_10_5_universal'), ('cp27', 'cp27m', 'macosx_10_4_x86_64'), ('cp27', 'cp27m', 'macosx_10_4_intel'), ('cp27', 'cp27m', 'macosx_10_4_fat64'), ('cp27', 'cp27m', 'macosx_10_4_fat32'), ('cp27', 'cp27m', 'macosx_10_4_universal'), ('cp27', 'cp27m', 'macosx_10_3_fat32'), ('cp27', 'cp27m', 'macosx_10_3_universal'), ('cp27', 'cp27m', 'macosx_10_2_fat32'), ('cp27', 'cp27m', 'macosx_10_2_universal'), ('cp27', 'cp27m', 'macosx_10_1_fat32'), ('cp27', 'cp27m', 'macosx_10_1_universal'), ('cp27', 'cp27m', 'macosx_10_0_fat32'), ('cp27', 'cp27m', 'macosx_10_0_universal'), ('cp27', 'none', 'macosx_10_13_x86_64'), ('cp27', 'none', 'macosx_10_13_intel'), ('cp27', 'none', 'macosx_10_13_fat64'), ('cp27', 'none', 'macosx_10_13_fat32'), ('cp27', 'none', 'macosx_10_13_universal'), ('cp27', 'none', 'macosx_10_12_x86_64'), ('cp27', 'none', 'macosx_10_12_intel'), ('cp27', 'none', 'macosx_10_12_fat64'), ('cp27', 'none', 'macosx_10_12_fat32'), ('cp27', 'none', 'macosx_10_12_universal'), ('cp27', 'none', 'macosx_10_11_x86_64'), ('cp27', 'none', 'macosx_10_11_intel'), ('cp27', 'none', 'macosx_10_11_fat64'), ('cp27', 'none', 'macosx_10_11_fat32'), ('cp27', 'none', 'macosx_10_11_universal'), ('cp27', 'none', 'macosx_10_10_x86_64'), ('cp27', 'none', 'macosx_10_10_intel'), ('cp27', 'none', 'macosx_10_10_fat64'), ('cp27', 'none', 'macosx_10_10_fat32'), ('cp27', 'none', 'macosx_10_10_universal'), ('cp27', 'none', 'macosx_10_9_x86_64'), ('cp27', 'none', 'macosx_10_9_intel'), ('cp27', 'none', 'macosx_10_9_fat64'), ('cp27', 'none', 'macosx_10_9_fat32'), ('cp27', 'none', 'macosx_10_9_universal'), ('cp27', 'none', 'macosx_10_8_x86_64'), ('cp27', 'none', 'macosx_10_8_intel'), ('cp27', 'none', 'macosx_10_8_fat64'), ('cp27', 'none', 'macosx_10_8_fat32'), ('cp27', 'none', 'macosx_10_8_universal'), ('cp27', 'none', 'macosx_10_7_x86_64'), ('cp27', 'none', 'macosx_10_7_intel'), ('cp27', 'none', 'macosx_10_7_fat64'), ('cp27', 'none', 'macosx_10_7_fat32'), ('cp27', 'none', 'macosx_10_7_universal'), ('cp27', 'none', 'macosx_10_6_x86_64'), ('cp27', 'none', 'macosx_10_6_intel'), ('cp27', 'none', 'macosx_10_6_fat64'), ('cp27', 'none', 'macosx_10_6_fat32'), ('cp27', 'none', 'macosx_10_6_universal'), ('cp27', 'none', 'macosx_10_5_x86_64'), ('cp27', 'none', 'macosx_10_5_intel'), ('cp27', 'none', 'macosx_10_5_fat64'), ('cp27', 'none', 'macosx_10_5_fat32'), ('cp27', 'none', 'macosx_10_5_universal'), ('cp27', 'none', 'macosx_10_4_x86_64'), ('cp27', 'none', 'macosx_10_4_intel'), ('cp27', 'none', 'macosx_10_4_fat64'), ('cp27', 'none', 'macosx_10_4_fat32'), ('cp27', 'none', 'macosx_10_4_universal'), ('cp27', 'none', 'macosx_10_3_fat32'), ('cp27', 'none', 'macosx_10_3_universal'), ('cp27', 'none', 'macosx_10_2_fat32'), ('cp27', 'none', 'macosx_10_2_universal'), ('cp27', 'none', 'macosx_10_1_fat32'), ('cp27', 'none', 'macosx_10_1_universal'), ('cp27', 'none', 'macosx_10_0_fat32'), ('cp27', 'none', 'macosx_10_0_universal'), ('py2', 'none', 'macosx_10_13_x86_64'), ('py2', 'none', 'macosx_10_13_intel'), ('py2', 'none', 'macosx_10_13_fat64'), ('py2', 'none', 'macosx_10_13_fat32'), ('py2', 'none', 'macosx_10_13_universal'), ('py2', 'none', 'macosx_10_12_x86_64'), ('py2', 'none', 'macosx_10_12_intel'), ('py2', 'none', 'macosx_10_12_fat64'), ('py2', 'none', 'macosx_10_12_fat32'), ('py2', 'none', 'macosx_10_12_universal'), ('py2', 'none', 'macosx_10_11_x86_64'), ('py2', 'none', 'macosx_10_11_intel'), ('py2', 'none', 'macosx_10_11_fat64'), ('py2', 'none', 'macosx_10_11_fat32'), ('py2', 'none', 'macosx_10_11_universal'), ('py2', 'none', 'macosx_10_10_x86_64'), ('py2', 'none', 'macosx_10_10_intel'), ('py2', 'none', 'macosx_10_10_fat64'), ('py2', 'none', 'macosx_10_10_fat32'), ('py2', 'none', 'macosx_10_10_universal'), ('py2', 'none', 'macosx_10_9_x86_64'), ('py2', 'none', 'macosx_10_9_intel'), ('py2', 'none', 'macosx_10_9_fat64'), ('py2', 'none', 'macosx_10_9_fat32'), ('py2', 'none', 'macosx_10_9_universal'), ('py2', 'none', 'macosx_10_8_x86_64'), ('py2', 'none', 'macosx_10_8_intel'), ('py2', 'none', 'macosx_10_8_fat64'), ('py2', 'none', 'macosx_10_8_fat32'), ('py2', 'none', 'macosx_10_8_universal'), ('py2', 'none', 'macosx_10_7_x86_64'), ('py2', 'none', 'macosx_10_7_intel'), ('py2', 'none', 'macosx_10_7_fat64'), ('py2', 'none', 'macosx_10_7_fat32'), ('py2', 'none', 'macosx_10_7_universal'), ('py2', 'none', 'macosx_10_6_x86_64'), ('py2', 'none', 'macosx_10_6_intel'), ('py2', 'none', 'macosx_10_6_fat64'), ('py2', 'none', 'macosx_10_6_fat32'), ('py2', 'none', 'macosx_10_6_universal'), ('py2', 'none', 'macosx_10_5_x86_64'), ('py2', 'none', 'macosx_10_5_intel'), ('py2', 'none', 'macosx_10_5_fat64'), ('py2', 'none', 'macosx_10_5_fat32'), ('py2', 'none', 'macosx_10_5_universal'), ('py2', 'none', 'macosx_10_4_x86_64'), ('py2', 'none', 'macosx_10_4_intel'), ('py2', 'none', 'macosx_10_4_fat64'), ('py2', 'none', 'macosx_10_4_fat32'), ('py2', 'none', 'macosx_10_4_universal'), ('py2', 'none', 'macosx_10_3_fat32'), ('py2', 'none', 'macosx_10_3_universal'), ('py2', 'none', 'macosx_10_2_fat32'), ('py2', 'none', 'macosx_10_2_universal'), ('py2', 'none', 'macosx_10_1_fat32'), ('py2', 'none', 'macosx_10_1_universal'), ('py2', 'none', 'macosx_10_0_fat32'), ('py2', 'none', 'macosx_10_0_universal'), ('cp27', 'none', 'any'), ('cp2', 'none', 'any'), ('py27', 'none', 'any'), ('py2', 'none', 'any')]
pex: crawling link i=0 link=Link('https://pypi.python.org/simple/netifaces/') follow_links=False
pex: Building pex :: Resolving distributions :: Fetching https://files.pythonhosted.org/packages/05/00/c719457bcb8f14f9a7b9244c3c5e203c4pex: Building pex :: Resolving distributions :: Fetching https://files.pythonhosted.org/packages/05/00/c719457bcb8f14f9a7b9244c3c5e203c40d041a364cf784cf554aaef8129/netifaces-0.10.6-py2.7-win32.egg#sha256=a0c7c19e1fb62ac6018582f72d15ac056e75c3d2ab222fb25369e7766ed67453 :: Fetching https://files.pythonhosted.org/packages/05/00/c719457bcb8f14f9a7b9244c3c5e203c40d041a364cf784cf554aaef8129/netifaces-0.10.6-py2pex: Building pex :: Resolving distributions :: Translating /private/var/folders/kd/k5b__qgs0gl5yzp48gctmhz80000gn/T/tmpe8OmEy/netifaces-0.10.6-py2.7-win32.egg into distribution                                                                                                                                                                                                                                         netifaces 0.10.6                                                                  
pex: Building pex: 415.4ms                                                                                                                                                       
pex:   Resolving interpreters: 0.8ms
pex:     Setting up interpreter /Users/kwilson/Python/CPython-2.7.13/bin/python2.7: 0.7ms
pex:   Resolving distributions: 404.8ms
pex:     Fetching https://files.pythonhosted.org/packages/05/00/c719457bcb8f14f9a7b9244c3c5e203c40d041a364cf784cf554aaef8129/netifaces-0.10.6-py2.7-win32.egg#sha256=a0c7c19e1fb62ac6018582f72d15ac056e75c3d2ab222fb25369e7766ed67453: 88.5ms
pex:       Fetching https://files.pythonhosted.org/packages/05/00/c719457bcb8f14f9a7b9244c3c5e203c40d041a364cf784cf554aaef8129/netifaces-0.10.6-py2.7-win32.egg#sha256=a0c7c19e1fb62ac6018582f72d15ac056e75c3d2ab222fb25369e7766ed67453: 87.7ms
pex:     Translating /private/var/folders/kd/k5b__qgs0gl5yzp48gctmhz80000gn/T/tmpe8OmEy/netifaces-0.10.6-py2.7-win32.egg into distribution: 6.7ms
Saving PEX file to /tmp/throwaway.pex
```

Resolving patch:
diff --git a/pex/package.py b/pex/package.py
--- a/pex/package.py
+++ b/pex/package.py
@@ -85,14 +85,14 @@ def satisfies(self, requirement, allow_prereleases=None):
     return requirement.specifier.contains(self.raw_version, prereleases=allow_prereleases)
 
   def compatible(self, supported_tags):
-    """Is this link compatible with the given tag set?
+    """Is this package compatible with the given tag set?
 
     :param supported_tags: A list of tags that is supported by the target
                            interpeter, as generated by
                            :func:`pex.pep425tags.get_supported`.
     :type supported_tags: list of 3-tuples
     """
-    return not set(supported_tags).isdisjoint(self._supported_tags)
+    raise NotImplementedError()
 
 
 class SourcePackage(Package):
@@ -142,7 +142,34 @@ def compatible(self, supported_tags):
     return True
 
 
-class EggPackage(Package):
+class BinaryPackage(Package):
+  """A Package representing a binary distribution which can be e.g. platform specific."""
+
+  def __init__(self, *args, **kwargs):
+    super(BinaryPackage, self).__init__(*args, **kwargs)
+    self._supported_tags = None
+
+  @property
+  def supported_tags(self):
+    if not self._supported_tags:
+      self._supported_tags = frozenset(self._iter_tags())
+    return self._supported_tags
+
+  def _iter_tags(self):
+    raise NotImplementedError()
+
+  def compatible(self, supported_tags):
+    """Is this package compatible with the given tag set?
+
+    :param supported_tags: A list of tags that is supported by the target
+                           interpeter, as generated by
+                           :func:`pex.pep425tags.get_supported`.
+    :type supported_tags: list of 3-tuples
+    """
+    return not set(supported_tags).isdisjoint(self.supported_tags)
+
+
+class EggPackage(BinaryPackage):
   """A Package representing a built egg."""
 
   def __init__(self, url, **kw):
@@ -161,26 +188,6 @@ def __init__(self, url, **kw):
     if self._raw_version is None or self._py_version is None:
       raise self.InvalidPackage('url with .egg extension but bad name: %s' % url)
 
-    impl = 'py' + self._py_version.replace('.', '')
-    abi_tag = 'none'
-    tag_platform = (self._platform or 'any').replace('-', '_')
-
-    self._supported_tags = set([(impl, abi_tag, tag_platform)])
-    if tag_platform != 'any':
-      self._supported_tags.add((impl, abi_tag, 'any'))
-
-    # Work around PyPy versions being weird in pep425tags.get_supported
-    if self.py_version == '2.7':
-      self._supported_tags.add(('pp2', abi_tag, tag_platform))
-    elif self.py_version == '3.2':
-      self._supported_tags.add(('pp321', abi_tag, tag_platform))
-    elif self.py_version == '3.3':
-      # N.B. PyPy 3.3 maps to `pp352` because of PyPy versioning.
-      # see e.g. http://doc.pypy.org/en/latest/release-pypy3.3-v5.2-alpha1.html
-      self._supported_tags.add(('pp352', abi_tag, tag_platform))
-    elif self.py_version == '3.5':
-      self._supported_tags.add(('pp357', abi_tag, tag_platform))
-
   def __hash__(self):
     return hash((self.name, self.version, self.py_version, self.platform))
 
@@ -200,8 +207,31 @@ def py_version(self):
   def platform(self):
     return self._platform
 
+  def _iter_tags(self):
+    abi_tag = 'none'
+    tag_platform = (self._platform or 'any').replace('-', '_').replace('.', '_')
+    suffix_maj = self._py_version.split('.', 1)[0]
+    suffix_min = self._py_version.replace('.', '')
+
+    for prefix in ('py', 'cp'):
+      for suffix in (suffix_maj, suffix_min):
+        impl = ''.join((prefix, suffix))
+        yield (impl, abi_tag, tag_platform)
+
+    # Work around PyPy versions being weird in pep425tags.get_supported
+    if self.py_version == '2.7':
+      yield ('pp2', abi_tag, tag_platform)
+    elif self.py_version == '3.2':
+      yield ('pp321', abi_tag, tag_platform)
+    elif self.py_version == '3.3':
+      # N.B. PyPy 3.3 maps to `pp352` because of PyPy versioning.
+      # see e.g. http://doc.pypy.org/en/latest/release-pypy3.3-v5.2-alpha1.html
+      yield ('pp352', abi_tag, tag_platform)
+    elif self.py_version == '3.5':
+      yield ('pp357', abi_tag, tag_platform)
+
 
-class WheelPackage(Package):
+class WheelPackage(BinaryPackage):
   """A Package representing a built wheel."""
 
   def __init__(self, url, **kw):
@@ -217,7 +247,6 @@ def __init__(self, url, **kw):
     # See https://github.com/pypa/pip/issues/1150 for why this is unavoidable.
     self._name = self._name.replace('_', '-')
     self._raw_version = self._raw_version.replace('_', '-')
-    self._supported_tags = frozenset(self._iter_tags())
 
   @property
   def name(self):


Test patch:
diff --git a/tests/example_packages/M2Crypto-0.22.3-py2.7-linux-x86_64.egg b/tests/example_packages/M2Crypto-0.22.3-py2.7-linux-x86_64.egg
new file mode 100644
Binary files /dev/null and b/tests/example_packages/M2Crypto-0.22.3-py2.7-linux-x86_64.egg differ
diff --git a/tests/test_integration.py b/tests/test_integration.py
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -834,7 +834,7 @@ def test_pex_manylinux_runtime():
 
 
 @pytest.mark.skipif(NOT_CPYTHON27)
-def test_platform_specific_egg_resolution():
+def test_platform_specific_inline_egg_resolution():
   with temporary_dir() as td:
     pex_out_path = os.path.join(td, 'pex.pex')
     res = run_pex_command(['--disable-cache',
@@ -842,3 +842,30 @@ def test_platform_specific_egg_resolution():
                            'MarkupSafe==1.0',
                            '-o', pex_out_path])
     res.assert_success()
+
+
+@pytest.mark.skipif(NOT_CPYTHON27)
+def test_platform_specific_egg_resolution():
+  with temporary_dir() as td:
+    pex_out_path = os.path.join(td, 'pex.pex')
+    res = run_pex_command(['--disable-cache',
+                           '--no-wheel',
+                           '--no-build',
+                           '--no-pypi',
+                           '--platform=linux-x86_64',
+                           '--find-links=tests/example_packages/',
+                           'M2Crypto==0.22.3',
+                           '-o', pex_out_path])
+    res.assert_success()
+
+
+@pytest.mark.skipif(NOT_CPYTHON27)
+def test_platform_specific_egg_resolution_matching():
+  with temporary_dir() as td:
+    pex_out_path = os.path.join(td, 'pex.pex')
+    res = run_pex_command(['--disable-cache',
+                           '--no-wheel',
+                           '--no-build',
+                           'netifaces==0.10.6',  # Only provides win32 eggs.
+                           '-o', pex_out_path])
+    res.assert_failure()