|
1 | 1 |
|
2 | 2 | import argparse
|
| 3 | +import glob |
3 | 4 | import logging
|
4 | 5 | import os
|
5 | 6 | import sys
|
6 | 7 |
|
7 | 8 | from itertools import product
|
8 | 9 | from os.path import (abspath, basename, dirname, isfile, join as pjoin, splitext)
|
9 | 10 |
|
10 |
| -from auditwheel.tools import unique_by_index |
11 |
| -from auditwheel.wheeltools import _dist_info_dir, InWheelCtx |
12 | 11 | from wheel.pkginfo import read_pkg_info, write_pkg_info
|
13 | 12 | from wheel.install import WHEEL_INFO_RE
|
| 13 | +from wheeltools.tools import unique_by_index |
| 14 | +from wheeltools.wheeltools import InWheelCtx, WheelToolsError |
14 | 15 |
|
15 | 16 | logger = logging.getLogger(splitext(basename(__file__))[0])
|
16 | 17 |
|
17 | 18 |
|
| 19 | +def _dist_info_dir(bdist_dir): |
| 20 | + """Get the .dist-info directort from an unpacked wheel |
| 21 | +
|
| 22 | + Parameters |
| 23 | + ---------- |
| 24 | + bdist_dir : str |
| 25 | + Path of unpacked wheel file |
| 26 | + """ |
| 27 | + |
| 28 | + info_dirs = glob.glob(pjoin(bdist_dir, '*.dist-info')) |
| 29 | + if len(info_dirs) != 1: |
| 30 | + raise WheelToolsError("Should be exactly one `*.dist_info` directory") |
| 31 | + return info_dirs[0] |
| 32 | + |
| 33 | + |
18 | 34 | def _to_generic_pyver(pyver_tags):
|
19 | 35 | """Convert from CPython implementation to generic python version tags
|
20 | 36 |
|
@@ -44,7 +60,7 @@ def _convert_to_generic_platform_wheel(wheel_ctx):
|
44 | 60 |
|
45 | 61 | abi_tags = ['none']
|
46 | 62 |
|
47 |
| - info_fname = pjoin(_dist_info_dir(wheel_ctx.path), 'WHEEL') |
| 63 | + info_fname = pjoin(_dist_info_dir(wheel_ctx.wheel_path), 'WHEEL') |
48 | 64 | info = read_pkg_info(info_fname)
|
49 | 65 |
|
50 | 66 | # Check what tags we have
|
|
0 commit comments