Improve python virtual environment support (uv) take 2.

This commit is contained in:
Doncho N. Gunchev 2025-03-09 00:25:26 +02:00
parent 86034e3f02
commit 8416585ac7
Signed by: dgunchev
GPG key ID: D30FD19F37E002A9
4 changed files with 15 additions and 15 deletions

View file

@ -3,16 +3,6 @@
This is a collection of /etc/profile.d files used by the gwebu team.
Unless explicitly stated in the file itself, the license is [The Unlicense](https://choosealicense.com/licenses/unlicense/).
## Hooks
## Automation
Create the following hook in your local repository to update the RPM changelog for you:
```bash
echo '#!/usr/bin/env bash
set -eu
./changelog.sh' > .git/hooks/post-commit
chmod a+x .git/hooks/post-commit
```
To update the RPM changelog run ./changelog.sh

View file

@ -18,6 +18,6 @@ sed -i.bak "s/Version: .*/Version: ${rpm_ver}/" gwebu-profile.spec.in
sed -i.bak "s/Release: .*/Release: ${rpm_numeric_rev}/" gwebu-profile.spec.in
rm -f gwebu-profile.spec.in.bak
git add gwebu-profile.spec.in
# git add gwebu-profile.spec.in
echo "gwebu-profile.spec.in changelog updated"

View file

@ -81,7 +81,14 @@ function prompt_command() {
local prompt="--($my_D, Err ${my_P[*]}, $my_TTY)---($PWD)--"
if [ -n "${VIRTUAL_ENV:-}" ] && [ -n "$_OLD_VIRTUAL_PS1" ]; then
export my_VENV="${VIRTUAL_ENV##*/}"
if [ -n "$VIRTUAL_ENV_PROMPT" ]; then
my_VENV="${VIRTUAL_ENV_PROMPT%) }"
my_VENV="${my_VENV%) }"
export my_VENV="${my_VENV#(}"
else
# Best guess
export my_VENV="${VIRTUAL_ENV##*/}"
fi
prompt="--($my_D, Err ${my_P[*]}, $my_TTY, $my_VENV)---($PWD)--"
if [ "${PS1:0:${#my_VENV}+3}" == "($my_VENV) " ]; then
# PS1 will be restored by virtual environment's deactivate script.

View file

@ -1,6 +1,6 @@
Summary: Gwebu profile.d - cool date, prompt with history, aliases
Name: gwebu-profile
Version: 1.0.6
Version: 1.0.7
Release: 0
BuildArch: noarch
License: GPLv2
@ -41,6 +41,9 @@ install -m 0644 etc/profile.d/*.sh %{buildroot}%{_sysconfdir}/profile.d/
%changelog
* Sun Mar 09 2025 Doncho N. Gunchev <dgunchev@gmail.com> - 1.0.7-0
- Improve python virtual environment support (uv) take 2.
* Sat Feb 15 2025 Doncho Gunchev <doncho.gunchev@flyrlabs.com> - 1.0.6-0
- Improve python virtual environment support (uv).