From db3f19ed90e63e27d79db08227a2b5bdb1c9d15e Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Thu, 6 Mar 2025 23:05:21 +0100 Subject: [PATCH] net-misc/onedrivegui: fixed * Fixed installation of the package * Removed unwanted and unused files from the package * Fixed package to work as a module: now main interface can be started by a shortcut or by python -m * Limited to single python version only * Other minor fixes Signed-off-by: Evgeny Grin (Karlson2k) --- .../files/OneDriveGUI-fix1.desktop | 7 ++ .../files/setup-onedrivegui-fix1.cfg | 40 ++++++++++++ net-misc/onedrivegui/files/wrapper-module.py | 6 ++ .../onedrivegui/onedrivegui-1.1.1-r2.ebuild | 64 +++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 net-misc/onedrivegui/files/OneDriveGUI-fix1.desktop create mode 100644 net-misc/onedrivegui/files/setup-onedrivegui-fix1.cfg create mode 100644 net-misc/onedrivegui/files/wrapper-module.py create mode 100644 net-misc/onedrivegui/onedrivegui-1.1.1-r2.ebuild diff --git a/net-misc/onedrivegui/files/OneDriveGUI-fix1.desktop b/net-misc/onedrivegui/files/OneDriveGUI-fix1.desktop new file mode 100644 index 0000000..8333bcf --- /dev/null +++ b/net-misc/onedrivegui/files/OneDriveGUI-fix1.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Name=OneDriveGUI +StartupNotify=true +Exec=OneDriveGUI +Terminal=false +Icon=OneDriveGUI +Type=Application diff --git a/net-misc/onedrivegui/files/setup-onedrivegui-fix1.cfg b/net-misc/onedrivegui/files/setup-onedrivegui-fix1.cfg new file mode 100644 index 0000000..caca52b --- /dev/null +++ b/net-misc/onedrivegui/files/setup-onedrivegui-fix1.cfg @@ -0,0 +1,40 @@ +[metadata] +name = OneDriveGUI +version = _VERSION +author = bpozdena +author_email = bpozdena@example.org +description = A simple GUI for OneDrive Linux client with multi-account support. +long_description = file: README.md +license = GPL-3.0 +license_files = LICENSE +long_description_content_type = text/markdown +url = https://github.com/bpozdena/OneDriveGUI +project_urls = + Bug Tracker = https://github.com/bpozdena/OneDriveGUI/-/issues + repository = https://github.com/bpozdena/OneDriveGUI +classifiers = + Programming Language :: Python :: 3 + +[options] +python_requires = >=3.8 +package_dir = + OneDriveGUI = src +install_requires= + PySide6_Essentials + requests + +[options.entry_points] +console_scripts = + OneDriveGUI = OneDriveGUI:OneDriveGUI.main + +[options.package_data] +OneDriveGUI = + resources/default_config + resources/images/*.png + resources/images/*.ico + +[options.data_files] +share/applications/ = + src/OneDriveGUI.desktop +share/icons/hicolor/48x48/apps/ = + src/resources/images/OneDriveGUI.png diff --git a/net-misc/onedrivegui/files/wrapper-module.py b/net-misc/onedrivegui/files/wrapper-module.py new file mode 100644 index 0000000..8a81a12 --- /dev/null +++ b/net-misc/onedrivegui/files/wrapper-module.py @@ -0,0 +1,6 @@ +"""Wrapper to allow starting by python -m OneDriveGUI""" + +from .OneDriveGUI import main + +if __name__ == "__main__": + main() diff --git a/net-misc/onedrivegui/onedrivegui-1.1.1-r2.ebuild b/net-misc/onedrivegui/onedrivegui-1.1.1-r2.ebuild new file mode 100644 index 0000000..63937de --- /dev/null +++ b/net-misc/onedrivegui/onedrivegui-1.1.1-r2.ebuild @@ -0,0 +1,64 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +M_PN=OneDriveGUI + +DISTUTILS_SINGLE_IMPL=1 +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=(python3_{9..13}) + +inherit desktop distutils-r1 +if [[ ${PV} == "9999" ]]; then + EGIT_REPO_URI="https://github.com/bpozdena/${M_PN}.git" + inherit git-r3 +else + SRC_URI="https://github.com/bpozdena/${M_PN}/archive/refs/tags/v${PV}.tar.gz -> ${PN}-${PV}.tar.gz" + KEYWORDS="~amd64" + S="${WORKDIR}/${M_PN}-${PV}" +fi + +DESCRIPTION="A simple GUI for OneDrive Linux client, with multi-account support." +HOMEPAGE="https://github.com/bpozdena/OneDriveGUI" + +RDEPEND=">=net-misc/onedrive-2.5 + !net-misc/onedrivegui-bin + dev-python/requests + dev-python/pyside[gui(+),webengine(+),widgets(+)] +" + +LICENSE="GPL-3" +SLOT="0" + +src_prepare() { + cp "${FILESDIR}/setup-onedrivegui.py" "${S}/setup.py" || die + cp "${FILESDIR}/setup-onedrivegui-fix1.cfg" "${S}/setup.cfg" || die + cp "${FILESDIR}/OneDriveGUI-fix1.desktop" "${S}/src/OneDriveGUI.desktop" || die + cp "${FILESDIR}/wrapper-module.py" "${S}/src/__main__.py" || die + + #fix python package version + sed -i "s/^version = _VERSION$/version = ${PV}/g" "${S}/setup.cfg" || die + + # Remove unused leftovers + rm -f "${S}/src/ui/"*_ui.py || die + + # Fix broken image references + sed -i \ + -e 's|\.\./\.\./\.\./OneDriveGUI_POC_recovered-multi/|../resources/images/|g' \ + "${S}/src/ui/"*.py || die + + # Patch file to make it work as a module + sed -i \ + -e 's/^from version\b/from .version/' \ + -e 's/^from ui\./from .ui./' \ + -e '/^GUI_SETTINGS_FILE =/a\'$'\n''gui_settings = None\nglobal_config = None\ntemp_global_config = None\main_window = None' \ + -e '/^if __name__ == "__main__":/a\'$'\n'' global gui_settings, global_config, temp_global_config, main_window' \ + -e 's/if __name__ == "__main__":/def main():/' \ + -e '$a\'$'\n''\nif __name__ == "__main__":\n main()' \ + "${S}/src/OneDriveGUI.py" || die + + python_fix_shebang "${S}/src/OneDriveGUI.py" + + default +}