Skip to content

Commit

Permalink
fix missing utilities in Windows wheels
Browse files Browse the repository at this point in the history
Some utilities, like `rcc.exe`, were getting filtered-out: handle
the fact that those are "not a Qt executable", as reported by
`windeployqt`, but we still want to include them.
  • Loading branch information
benoit-pierre committed Oct 19, 2021
1 parent 3605008 commit 536dfac
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,10 +714,13 @@ def report_and_check_call(command, *args, cwd=None, shell=False, **kwargs):
for arg in command:
print(' {}'.format(repr(arg)))

if 'check' not in kwargs:
kwargs['check'] = True

sys.stdout.flush()
if cwd is not None:
cwd = fspath(cwd)
return subprocess.run(command, *args, cwd=cwd, check=True, **kwargs)
return subprocess.run(command, *args, cwd=cwd, **kwargs)


@attr.s(frozen=True)
Expand Down Expand Up @@ -1185,20 +1188,28 @@ def windeployqt_list_source(
target: pathlib.Path,
windeployqt: pathlib.Path,
) -> typing.Iterable[pathlib.Path]:
try:
process = report_and_check_call(
command=[
windeployqt,
'--dry-run',
'--list', 'source',
target,
],
stdout=subprocess.PIPE,
# ugh, 3.5
# encoding='utf-8',
)
except subprocess.CalledProcessError as e:
raise DependencyCollectionError(target) from e
process = report_and_check_call(
command=[
windeployqt,
'--dry-run',
'--list', 'source',
target,
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
# ugh, 3.5
# encoding='utf-8',
check=False,
)

if process.returncode:
if (process.returncode > 0 and
'does not seem to be a Qt executable'
in process.stderr.decode('utf-8')):
# This can happen with some utilities like
# `rcc.exe`, which we still want to include.
return []
raise DependencyCollectionError(target, process)

paths = [
pathlib.Path(line)
Expand Down

0 comments on commit 536dfac

Please sign in to comment.