Skip to content

Commit

Permalink
feat: qt版打包pip
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhldr committed Nov 23, 2024
1 parent c96ab0f commit a649e99
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 7 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ test-deb: clear
mv lfy-${VERSION}-x86_64.deb ${DISK}/lfy-${VERSION}-x86_64-${BUILD_TYPE}.deb


# python-build
test-pip: clear
make PREFIX="/usr" DESTDIR="${PWD}/${BUILD_PKG}/pip" test

cd ${BUILD_PKG}/pip && \
mv usr/lib/lfy ./ && \
mv usr/share/icons/hicolor/scalable/apps ./lfy/resources/ && \
mv usr/share/locale ./lfy/resources/ && \
python -m build



test-flatpak:clear
meson setup build -Dbuild_type=${BUILD_TYPE}
cd ${BUILD_PKG}/flatpak && \
Expand Down
6 changes: 5 additions & 1 deletion lfy/qt/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ def main():

app = QApplication(sys.argv)


icon = QIcon.fromTheme(APP_ID)
if icon.isNull():
# 如果图标未加载成功,使用默认图标
icon = QIcon(os.path.join(os.path.dirname(
__file__), f"../resources/{APP_ID}.svg"))

window = TranslateWindow()
window.setWindowIcon(icon)
tray = TrayIcon(window, app, icon)
Expand Down
1 change: 1 addition & 0 deletions pkg/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ subdir('deb/DEBIAN')
subdir('aur')
subdir('flatpak')
subdir('rpm/SPECS')
subdir('pip')

1 change: 1 addition & 0 deletions pkg/pip/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include @APP_NAME@/resources/*
29 changes: 29 additions & 0 deletions pkg/pip/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
deps0 = '"requests"'
if bt == 'qt'
# opensuse
# deps += ' python3-PyQt6'
deps = deps0 + ' ,"pillow", "PyQt6"'
else
deps = deps0 + ' ,"pillow", "PyGObject'
endif

conf_pkg_pip = configuration_data()
foreach key : conf_pkg.keys()
conf_pkg_pip.set(key, conf_pkg.get(key))
endforeach
conf_pkg_pip.set('DEPS', deps)
conf_pkg_pip.set('BUILD_TYPE', bt)

configure_file(
input: 'pyproject.toml',
output: 'pyproject.toml',
configuration: conf_pkg_pip,
install: false,
)

configure_file(
input: 'MANIFEST.in',
output: 'MANIFEST.in',
configuration: conf_pkg_pip,
install: false,
)
14 changes: 8 additions & 6 deletions pkg/pip/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ build-backend = "setuptools.build_meta"
[project]
name = "@APP_NAME@"
version = "@VERSION@"
description = "听书"
description = "test"
readme = "readme.md"
authors = [{ name = "yuhldr", email = "[email protected]" }]
dependencies = [
@DEPS@
]
dependencies = [@DEPS@]

# 包含的脚本
[project.scripts]
heartale = "heartale:run_play"
@APP_NAME@ = "@APP_NAME@.@[email protected]:main"

[tool.setuptools.packages.find]
where = ["."]
include = ["heartale*"]
include = ["@APP_NAME@*"]


[tool.setuptools.package-data]
"@APP_NAME@" = ["resources/*"]

0 comments on commit a649e99

Please sign in to comment.