aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-06-26 09:10:56 +0200
committerMattias Andrée <maandree@kth.se>2021-06-26 09:10:56 +0200
commit52f78c734724e3670a15630f747cbe37078ad62a (patch)
tree9d7ad43d7fd1b44a891e8c69c60853287647ed70
parentAdd ~/.config/background (diff)
downloaddotfiles-52f78c734724e3670a15630f747cbe37078ad62a.tar.gz
dotfiles-52f78c734724e3670a15630f747cbe37078ad62a.tar.bz2
dotfiles-52f78c734724e3670a15630f747cbe37078ad62a.tar.xz
Alias python to python3 if python is python2
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--python/Makefile7
-rw-r--r--python/bash-aliases3
2 files changed, 10 insertions, 0 deletions
diff --git a/python/Makefile b/python/Makefile
index 271827a..1befb29 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -8,11 +8,18 @@ install:
mkdir -p -- ~/.config/profile.d
test ! -d ~/.config/profile.d/python
ln -sf -- ~/.dotfiles/python/user-profile ~/.config/profile.d/python
+ if test "$$(python --version 2>&1 | cut -d ' ' -f 2 | cut -d . -f 1)" = 2; then \
+ mkdir -p -- ~/.config/bash/aliases.d && \
+ test ! -d ~/.config/bash/aliases.d/python && \
+ ln -sf -- ~/.dotfiles/python/bash-aliases ~/.config/bash/aliases.d/python; \
+ fi
uninstall:
-unlink -- ~/.config/profile.d/python
-rmdir -- ~/.config/profile.d
-unlink -- ~/.var/cache/python_history
-unlink -- ~/.python_history
+ -unlink -- ~/.config/bash/aliases.d/python
+ -rmdir -- ~/.config/bash/aliases.d
.PHONY: install uninstall
diff --git a/python/bash-aliases b/python/bash-aliases
new file mode 100644
index 0000000..90ef57b
--- /dev/null
+++ b/python/bash-aliases
@@ -0,0 +1,3 @@
+# -*- shell-script -*-
+
+alias python="python3"