Return a wheel object built from a filename. Raise an exception if this is not a valid wheel filename
(cls, filename)
| 1215 | |
| 1216 | @classmethod |
| 1217 | def from_filename(cls, filename): |
| 1218 | """ |
| 1219 | Return a wheel object built from a filename. |
| 1220 | Raise an exception if this is not a valid wheel filename |
| 1221 | """ |
| 1222 | wheel_info = cls.get_wheel_from_filename(filename) |
| 1223 | if not wheel_info: |
| 1224 | raise InvalidDistributionFilename(filename) |
| 1225 | |
| 1226 | name = wheel_info.group("name").replace("_", "-") |
| 1227 | # we'll assume "_" means "-" due to wheel naming scheme |
| 1228 | # (https://github.com/pypa/pip/issues/1150) |
| 1229 | version = wheel_info.group("ver").replace("_", "-") |
| 1230 | build = wheel_info.group("build") |
| 1231 | python_versions = wheel_info.group("pyvers").split(".") |
| 1232 | abis = wheel_info.group("abis").split(".") |
| 1233 | platforms = wheel_info.group("plats").split(".") |
| 1234 | |
| 1235 | # All the tag combinations from this file |
| 1236 | tags = { |
| 1237 | packaging_tags.Tag(x, y, z) for x in python_versions for y in abis for z in platforms |
| 1238 | } |
| 1239 | |
| 1240 | return cls( |
| 1241 | filename=filename, |
| 1242 | type="pypi", |
| 1243 | name=name, |
| 1244 | version=version, |
| 1245 | build=build, |
| 1246 | python_versions=python_versions, |
| 1247 | abis=abis, |
| 1248 | platforms=platforms, |
| 1249 | tags=tags, |
| 1250 | ) |
| 1251 | |
| 1252 | def is_supported_by_tags(self, tags): |
| 1253 | """ |
nothing calls this directly
no test coverage detected