Skip to content

Commit

Permalink
Patch out more SetProcessDpiAwareness in libs.
Browse files Browse the repository at this point in the history
May relate to #258
  • Loading branch information
Avasam committed Oct 20, 2023
1 parent 4a97f02 commit 87d080e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ pip install -r "$PSScriptRoot/requirements$dev.txt" --upgrade

# Patch libraries so we don't have to install from git

# Prevent pyautogui from setting Process DPI Awareness, which Qt tries to do then throws warnings about it.
# Prevent pyautogui and pywinctl from setting Process DPI Awareness, which Qt tries to do then throws warnings about it.
# The unittest workaround significantly increases build time, boot time and build size with PyInstaller.
# https://github.com/asweigart/pyautogui/issues/663#issuecomment-1296719464
$pyautoguiPath = python -c 'import pyautogui as _; print(_.__path__[0])'
(Get-Content "$pyautoguiPath/_pyautogui_win.py").replace('ctypes.windll.user32.SetProcessDPIAware()', 'pass') |
Set-Content "$pyautoguiPath/_pyautogui_win.py"
$libPath = python -c 'import pyautogui as _; print(_.__path__[0])'
(Get-Content "$libPath/_pyautogui_win.py").replace('ctypes.windll.user32.SetProcessDPIAware()', 'pass') |
Set-Content "$libPath/_pyautogui_win.py"
$libPath = python -c 'import pymonctl as _; print(_.__path__[0])'
(Get-Content "$libPath/_pymonctl_win.py").replace('ctypes.windll.shcore.SetProcessDpiAwareness(2)', 'pass') |
Set-Content "$libPath/_pymonctl_win.py"
$libPath = python -c 'import pywinbox as _; print(_.__path__[0])'
(Get-Content "$libPath/_pywinbox_win.py").replace('ctypes.windll.shcore.SetProcessDpiAwareness(2)', 'pass') |
Set-Content "$libPath/_pywinbox_win.py"
# Uninstall optional dependencies that PyInstaller picks up
python -m pip uninstall pyscreeze mouseinfo pyperclip -y


Expand Down

0 comments on commit 87d080e

Please sign in to comment.