|
18 | 18 | import functools
|
19 | 19 | import importlib.machinery
|
20 | 20 | import io
|
21 |
| -import itertools |
22 | 21 | import json
|
23 | 22 | import os
|
24 | 23 | import pathlib
|
@@ -506,30 +505,25 @@ def build(self, directory: Path) -> pathlib.Path:
|
506 | 505 | self._project.install()
|
507 | 506 |
|
508 | 507 | wheel_file = pathlib.Path(directory, f'{self.name}.whl')
|
509 |
| - |
510 | 508 | with mesonpy._wheelfile.WheelFile(wheel_file, 'w') as whl:
|
511 | 509 | self._wheel_write_metadata(whl)
|
512 | 510 |
|
513 |
| - with mesonpy._util.cli_counter( |
514 |
| - len(list(itertools.chain.from_iterable(self._wheel_files.values()))), |
515 |
| - ) as counter: |
516 |
| - # install root scheme files |
517 |
| - root_scheme = 'purelib' if self.is_pure else 'platlib' |
518 |
| - for destination, origin in self._wheel_files[root_scheme]: |
519 |
| - self._install_path(whl, counter, origin, destination) |
520 |
| - |
521 |
| - # install bundled libraries |
522 |
| - for destination, origin in self._wheel_files['mesonpy-libs']: |
523 |
| - destination = pathlib.Path(f'.{self._project.name}.mesonpy.libs', destination) |
524 |
| - self._install_path(whl, counter, origin, destination) |
525 |
| - |
526 |
| - # install the other schemes |
527 |
| - for scheme in self._wheel_files.keys(): |
528 |
| - if scheme in (root_scheme, 'mesonpy-libs'): |
529 |
| - continue |
530 |
| - for destination, origin in self._wheel_files[scheme]: |
531 |
| - destination = pathlib.Path(self.data_dir, scheme, destination) |
532 |
| - self._install_path(whl, counter, origin, destination) |
| 511 | + with mesonpy._util.cli_counter(sum(len(x) for x in self._wheel_files.values())) as counter: |
| 512 | + |
| 513 | + root = 'purelib' if self.is_pure else 'platlib' |
| 514 | + |
| 515 | + for path, entries in self._wheel_files.items(): |
| 516 | + for dst, src in entries: |
| 517 | + |
| 518 | + if path == root: |
| 519 | + pass |
| 520 | + elif path == 'mesonpy-libs': |
| 521 | + # custom installation path for bundled libraries |
| 522 | + dst = pathlib.Path(f'.{self._project.name}.mesonpy.libs', dst) |
| 523 | + else: |
| 524 | + dst = pathlib.Path(self.data_dir, path, dst) |
| 525 | + |
| 526 | + self._install_path(whl, counter, src, dst) |
533 | 527 |
|
534 | 528 | return wheel_file
|
535 | 529 |
|
|
0 commit comments