supported_wheels.py 634 Bytes
Newer Older
1
2
3
4
5
6
7
#!/usr/bin/env python
"""  Filter out wheel filenames not supported on this platform
"""
from __future__ import print_function

import sys

8
9
10
11
try:
    from wheel.install import WheelFile
except ImportError:  # As of Wheel 0.32.0
    from wheel.wheelfile import WheelFile
12
13
14
15
try:
    from pip.pep425tags import get_supported
except ImportError:  # pip 10
    from pip._internal.pep425tags import get_supported
16
17
18
19
20
21
22
23
24
25
26
27


def main():
    supported = set(get_supported())
    for fname in sys.argv[1:]:
        tags = set(WheelFile(fname).tags)
        if supported.intersection(tags):
            print(fname)


if __name__ == '__main__':
    main()