From 7935d14d61461f89d07e2094c691c400d818eab2 Mon Sep 17 00:00:00 2001 From: clsty Date: Tue, 4 Feb 2025 23:14:04 +0800 Subject: [PATCH] Improvement for python installation --- .../illogical-impulse-python/PKGBUILD | 17 ++++++----- install.sh | 29 +++++-------------- scriptdata/environment-variables | 2 +- scriptdata/installers | 22 ++++++++++++-- 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/arch-packages/illogical-impulse-python/PKGBUILD b/arch-packages/illogical-impulse-python/PKGBUILD index 588c6ca4..6cc66dc1 100644 --- a/arch-packages/illogical-impulse-python/PKGBUILD +++ b/arch-packages/illogical-impulse-python/PKGBUILD @@ -1,15 +1,16 @@ pkgname=illogical-impulse-python pkgver=1.1 -pkgrel=1 +pkgrel=2 pkgdesc='Illogical Impulse Python Dependencies' arch=(any) license=(None) depends=( - gtk4 - libadwaita - libsoup3 - libportal-gtk4 - blueprint-compiler - gobject-introspection - sassc + uv + gtk4 + libadwaita + libsoup3 + libportal-gtk4 + blueprint-compiler + gobject-introspection + sassc ) diff --git a/install.sh b/install.sh index e05ce45a..e609020c 100755 --- a/install.sh +++ b/install.sh @@ -130,28 +130,9 @@ for i in "${metapkgs[@]}"; do v install-local-pkgbuild "$i" "$metainstallflags" done -ags_state_dir=~/.local/state/ags - -showfun install-uv -v install-uv - -x mkdir -p $ags_state_dir -# we need python 3.12 https://github.com/python-pillow/Pillow/issues/8089 -x uv venv --prompt .venv $PYTHON_VENV_PATH -p 3.12 -x source $PYTHON_VENV_PATH/bin/activate -x uv pip install -r scriptdata/requirements.txt - -# install gradience -gradience_dir=/tmp/gradience -x git clone https://github.com/ZeyadMoustafaKamal/Gradience.git $gradience_dir -x cd $gradience_dir -x git submodule update --init --recursive -x uv pip install -r requirements.txt -x meson setup build --prefix=$VIRTUAL_ENV -x meson compile -C build -x meson install -C build -x cd - -x deactivate # We don't need the virtual environment anymore +# These python packages are installed using uv, not pacman. +showfun install-python-packages +v install-python-packages # Why need cleanbuild? see https://github.com/end-4/dots-hyprland/issues/389#issuecomment-2040671585 # Why install deps by running a seperate command? see pinned comment of https://aur.archlinux.org/packages/hyprland-git @@ -321,6 +302,10 @@ case $existed_hypr_conf in printf "\e[33mIf this is your first time installation, you must overwrite \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" with \"$XDG_CONFIG_HOME/hypr/hyprland.conf.new\".\e[0m\n" ;;esac +if [[ -z "${ILLOGICAL_IMPULSE_VIRTUAL_ENV}" ]]; then + printf "\n\e[31m[$0]: \!! Important \!! : Please ensure environment variable \e[0m \$ILLOGICAL_IMPULSE_VIRTUAL_ENV \e[31m is set to proper value (by default \"~/.local/state/ags/.venv\"), or AGS config will not work. We have already provided this configuration in ~/.config/hypr/hyprland/env.conf, but you need to ensure it is included in hyprland.conf, and also a restart is needed for applying it.\e[0m\n" +fi + if [[ ! -z "${warn_files[@]}" ]]; then printf "\n\e[31m[$0]: \!! Important \!! : Please delete \e[0m ${warn_files[*]} \e[31m manually as soon as possible, since we\'re now using AUR package or local PKGBUILD to install them for Arch(based) Linux distros, and they'll take precedence over our installation, or at least take up more space.\e[0m\n" fi diff --git a/scriptdata/environment-variables b/scriptdata/environment-variables index ad1048aa..5c7116b8 100644 --- a/scriptdata/environment-variables +++ b/scriptdata/environment-variables @@ -7,4 +7,4 @@ XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state} BACKUP_DIR=${BACKUP_DIR:-$HOME/backup} UV_NO_MODIFY_PATH=1 PYTHON_VENV_PATH=$XDG_STATE_HOME/ags/.venv -PYTHON_BIN_PATH=$PYTHON_VENV_PATH/bin/python +#PYTHON_BIN_PATH=$PYTHON_VENV_PATH/bin/python diff --git a/scriptdata/installers b/scriptdata/installers index 0feabb60..eddaef6a 100644 --- a/scriptdata/installers +++ b/scriptdata/installers @@ -113,7 +113,23 @@ install-MicroTeX (){ x cd $base } -install-uv (){ - x curl -LsSf https://astral.sh/uv/install.sh | sh -} +# Below command can be used to install uv, but it's already an Arch package so... +# curl -LsSf https://astral.sh/uv/install.sh | sh +install-python-packages (){ + x mkdir -p $PYTHON_VENV_PATH + # we need python 3.12 https://github.com/python-pillow/Pillow/issues/8089 + x uv venv --prompt .venv $PYTHON_VENV_PATH -p 3.12 + x source $PYTHON_VENV_PATH/bin/activate + x uv pip install -r scriptdata/requirements.txt + x mkdir -p $base/cache/gradience && cd $base/cache/gradience + try git init -b main + try git remote add origin https://github.com/clsty/ii-gradience.git + x git pull origin main && git submodule update --init --recursive + x uv pip install -r requirements.txt + x meson setup build --prefix=$VIRTUAL_ENV + x meson compile -C build + x meson install -C build + x cd - + x deactivate # We don't need the virtual environment anymore +}