mirror of
https://github.com/szymon-jozef/zutui.git
synced 2026-09-07 12:10:43 +02:00
Compare commits
1 Commits
fix/xdg-pa
...
pkg/nix
| Author | SHA1 | Date | |
|---|---|---|---|
| c3161f5e8e |
8
PKGBUILD
8
PKGBUILD
@@ -1,13 +1,13 @@
|
|||||||
# Maintainer: <szymon_jozef@proton.me>
|
# Maintainer: <szymon_jozef@proton.me>
|
||||||
_pkgname="zutui"
|
_pkgname="zutui"
|
||||||
pkgname="$_pkgname-git"
|
pkgname="$_pkgname-git"
|
||||||
pkgver="1.0.0.r8.ceefa47"
|
pkgver=1.0.0
|
||||||
pkgrel=4
|
pkgrel=1
|
||||||
pkgdesc="TUI for accessing edziekanat of ZUT university"
|
pkgdesc="TUI for accessing edziekanat of ZUT university"
|
||||||
arch=("any")
|
arch=("any")
|
||||||
url="https://github.com/shv187/zutui"
|
url="https://github.com/shv187/zutui"
|
||||||
license=("MIT")
|
license=("MIT")
|
||||||
depends=("python" "python-keyring" "python-textual" "python-appdirs" "python-beautifulsoup4" "python-requests")
|
depends=("python" "python-keyring" "python-textual")
|
||||||
makedepends=("git" "python-build" "python-installer" "python-wheel" "python-setuptools")
|
makedepends=("git" "python-build" "python-installer" "python-wheel" "python-setuptools")
|
||||||
provides=("zutui")
|
provides=("zutui")
|
||||||
conflicts=("zutui")
|
conflicts=("zutui")
|
||||||
@@ -16,7 +16,7 @@ sha256sums=("SKIP")
|
|||||||
|
|
||||||
pkgver() {
|
pkgver() {
|
||||||
cd "$_pkgname"
|
cd "$_pkgname"
|
||||||
printf "1.0.0.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
textual
|
textual
|
||||||
requests
|
requests
|
||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
appdirs
|
|
||||||
];
|
];
|
||||||
|
|
||||||
meta = with pkgs.lib; {
|
meta = with pkgs.lib; {
|
||||||
@@ -47,14 +46,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells = {
|
|
||||||
default = pkgs.mkShell {
|
|
||||||
inputsFrom = [ self.packages.${system}.default ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
3
setup.py
3
setup.py
@@ -9,8 +9,7 @@ setup(
|
|||||||
"beautifulsoup4",
|
"beautifulsoup4",
|
||||||
"textual",
|
"textual",
|
||||||
"keyring",
|
"keyring",
|
||||||
"pywin32; sys_platform == 'win32'",
|
"pywin32; sys_platform == 'win32'"
|
||||||
"appdirs",
|
|
||||||
],
|
],
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
|
|||||||
19
zut_app/config.py
Normal file
19
zut_app/config.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import os
|
||||||
|
import platform
|
||||||
|
|
||||||
|
USER_HOME = os.path.expanduser("~")
|
||||||
|
WINDOWS_PATH = "zutui" # probably should be in %AppData% or something, but I'm not sure, so I won't change it
|
||||||
|
LINUX_PATH = ".config/zutui"
|
||||||
|
|
||||||
|
def get_config_path():
|
||||||
|
system = platform.system()
|
||||||
|
if system == "Windows":
|
||||||
|
APP_DIR = os.path.join(USER_HOME, WINDOWS_PATH)
|
||||||
|
elif system in ["Linux", "Darwin"]:
|
||||||
|
APP_DIR = os.path.join(USER_HOME, LINUX_PATH)
|
||||||
|
else:
|
||||||
|
print(f"System {system} not supported, aborting...")
|
||||||
|
exit(1)
|
||||||
|
if not os.path.exists(APP_DIR):
|
||||||
|
os.makedirs(APP_DIR)
|
||||||
|
return APP_DIR
|
||||||
@@ -1,18 +1,13 @@
|
|||||||
import requests
|
import requests
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
import json
|
import json
|
||||||
from appdirs import user_config_dir, user_cache_dir
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
app_name = "zutui"
|
from .config import get_config_path
|
||||||
app_author = "shv187"
|
|
||||||
|
|
||||||
CONFIG_DIR = user_config_dir(app_name, app_author)
|
APP_DIR = get_config_path()
|
||||||
CACHE_DIR = user_cache_dir(app_name, app_author)
|
|
||||||
os.makedirs(CACHE_DIR, exist_ok=True)
|
|
||||||
os.makedirs(CONFIG_DIR, exist_ok=True)
|
|
||||||
|
|
||||||
CACHE_FILE = os.path.join(CACHE_DIR, "grades_cache.json")
|
CACHE_FILE = os.path.join(APP_DIR, "grades_cache.json")
|
||||||
TIMEOUT = 10
|
TIMEOUT = 10
|
||||||
|
|
||||||
class ZUT:
|
class ZUT:
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import os
|
|||||||
import keyring
|
import keyring
|
||||||
from keyring.errors import KeyringError
|
from keyring.errors import KeyringError
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from appdirs import user_config_dir
|
|
||||||
from textual.app import App, ComposeResult
|
from textual.app import App, ComposeResult
|
||||||
from textual.containers import Container
|
from textual.containers import Container
|
||||||
from textual.widgets import Header, Footer, DataTable, Label, Button, Input
|
from textual.widgets import Header, Footer, DataTable, Label, Button, Input
|
||||||
@@ -11,8 +10,9 @@ from textual.screen import Screen
|
|||||||
from textual.binding import Binding
|
from textual.binding import Binding
|
||||||
|
|
||||||
from .zut_client import ZUT
|
from .zut_client import ZUT
|
||||||
|
from .config import get_config_path
|
||||||
|
|
||||||
APP_DIR = user_config_dir("zutui", "shv187")
|
APP_DIR = get_config_path()
|
||||||
|
|
||||||
CONFIG_FILE = os.path.join(APP_DIR, "config.json")
|
CONFIG_FILE = os.path.join(APP_DIR, "config.json")
|
||||||
REFRESH_INTERVAL = 1800
|
REFRESH_INTERVAL = 1800
|
||||||
|
|||||||
Reference in New Issue
Block a user