Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Linux on Python 3.12 and update QT version + various fixes #287

Merged
merged 6 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/workflows/lint-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ jobs:
matrix:
os: [windows-latest, ubuntu-22.04]
python-version: ["3.10", "3.11", "3.12"]
# Wayland issue on Ubuntu 22.04 https://bugreports.qt.io/browse/QTBUG-114635
exclude:
- os: ubuntu-22.04
python-version: "3.12"
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -71,10 +67,6 @@ jobs:
matrix:
os: [windows-latest, ubuntu-22.04]
python-version: ["3.10", "3.11", "3.12"]
# Wayland issue on Ubuntu 22.04 https://bugreports.qt.io/browse/QTBUG-114635
exclude:
- os: ubuntu-22.04
python-version: "3.12"
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -100,10 +92,6 @@ jobs:
matrix:
os: [windows-latest, ubuntu-22.04]
python-version: ["3.11", "3.12"]
# Wayland issue on Ubuntu 22.04 https://bugreports.qt.io/browse/QTBUG-114635
exclude:
- os: ubuntu-22.04
python-version: "3.12"
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand Down
21 changes: 3 additions & 18 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ $dev = If ($Env:GITHUB_JOB -eq 'Build') { '' } Else { '-dev' }
If ($IsLinux) {
If (-not $Env:GITHUB_JOB -or $Env:GITHUB_JOB -eq 'Build') {
sudo apt-get update
# python3-tk for splash screen, npm for pyright, the rest for PySide6
sudo apt-get install -y python3-pip python3-tk npm libegl1 libxkbcommon0
# python3-tk for splash screen the rest for PySide6
sudo apt-get install -y python3-pip python3-tk libegl1 libxkbcommon0
# having issues with npm for pyright, maybe let users take care of it themselves? (pyright from pip)
}
}
# Ensures installation tools are up to date. This also aliases pip to pip3 on MacOS.
Expand All @@ -51,22 +52,6 @@ If ($IsLinux) {
# Even then, PyPI with Pillow>=7.2.0 will install 0.1.3 instead of 0.1.5
&"$python" -m pip install PyAutoGUI "D3DShot>=0.1.5 ; sys_platform == 'win32'" --no-deps --upgrade

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

If ($IsWindows) {
# 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
$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"
}
# Because Ubuntu 22.04 is forced to use an older version of PySide6, we do a dirty typing patch
# https://bugreports.qt.io/browse/QTBUG-114635
If ($IsLinux) {
Expand Down
7 changes: 4 additions & 3 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
# Dependencies:
git+https://github.com/boppreh/keyboard.git#egg=keyboard # Fix install on macos and linux-ci https://github.com/boppreh/keyboard/pull/568
Levenshtein>=0.25
numpy>=1.26 # Python 3.12 support
# Some modules used by OpenCV are not compiled for Numpy 2 yet on Linux. Error happens on import at runtime
numpy>=1.26,<2.0 # Python 3.12 support
opencv-python-headless>=4.9.0.80 # Typing fixes
packaging
psutil>=5.9.6 # Python 3.12 fixes
# PyAutoGUI # See install.ps1
PyWinCtl>=0.0.42 # py.typed
# When needed, dev builds can be found at https://download.qt.io/snapshots/ci/pyside/dev?C=M;O=D
PySide6-Essentials>=6.6.0 ; sys_platform == 'win32' # Python 3.12 support
PySide6-Essentials<6.5.1 ; sys_platform == 'linux' # Wayland issue on Ubuntu 22.04 https://bugreports.qt.io/browse/QTBUG-114635
PySide6-Essentials>=6.6.0 # Python 3.12 support
scipy>=1.11.2 # Python 3.12 support
toml
typing-extensions>=4.4.0 # @override decorator support
Expand All @@ -31,4 +31,5 @@ winsdk>=1.0.0b10 ; sys_platform == 'win32' # Python 3.12 support
#
# Linux-only dependencies
PyScreeze ; sys_platform == 'linux'
pillow ; sys_platform == 'linux' # Necessary for PyScreeze. For unknown reasons it's not pulled in on CI
python-xlib ; sys_platform == 'linux'
18 changes: 17 additions & 1 deletion src/AutoSplit.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
#!/usr/bin/python3

import sys

# 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
# QT doesn't call those from Python/ctypes, meaning we can stop other programs from setting it.
if sys.platform == "win32":
import ctypes
# pyautogui._pyautogui_win.py
ctypes.windll.user32.SetProcessDPIAware = lambda: None # pyright: ignore[reportAttributeAccessIssue]
# pymonctl._pymonctl_win.py
# pywinbox._pywinbox_win.py
ctypes.windll.shcore.SetProcessDpiAwareness = ( # pyright: ignore[reportAttributeAccessIssue]
lambda _: None # pyright: ignore[reportUnknownLambdaType]
)

import os
import signal
import sys
from collections.abc import Callable
from copy import deepcopy
from time import time
Expand Down
2 changes: 1 addition & 1 deletion src/menu_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def __setup_bindings(self):
set_hotkey_hotkey_button: QtWidgets.QPushButton = getattr(self, f"set_{hotkey}_hotkey_button")
hotkey_input.setText(self._autosplit_ref.settings_dict.get(f"{hotkey}_hotkey", ""))

set_hotkey_hotkey_button.clicked.connect(partial(set_hotkey, hotkey=hotkey))
set_hotkey_hotkey_button.clicked.connect(partial(set_hotkey, self._autosplit_ref, hotkey=hotkey))
# Make it very clear that hotkeys are not used when auto-controlled
if self._autosplit_ref.is_auto_controlled and hotkey != "toggle_auto_reset_image":
set_hotkey_hotkey_button.setEnabled(False)
Expand Down
2 changes: 1 addition & 1 deletion src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class SubprocessKWArgs(TypedDict):
stdin: int
stdout: int
stderr: int
startupinfo: STARTUPINFO | None
startupinfo: "STARTUPINFO | None"
env: os._Environ[str] | None # pyright: ignore[reportPrivateUsage]


Expand Down
Loading