summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFivePixels <dylan.bolger00@gmail.com>2023-01-26 23:48:25 -0600
committerFivePixels <dylan.bolger00@gmail.com>2023-01-28 10:19:18 -0600
commit6631ba984dc2b8291dcae464d8778fd86ae4b1c8 (patch)
tree98157528e0f7c6d5fc49c0707fcefc69f3d9412b
downloadpip-to-python-packages-6631ba984dc2b8291dcae464d8778fd86ae4b1c8.tar.xz
pip-to-python-packages-6631ba984dc2b8291dcae464d8778fd86ae4b1c8.zip
Initial commit
-rwxr-xr-xpip-to-python-packages.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/pip-to-python-packages.sh b/pip-to-python-packages.sh
new file mode 100755
index 0000000..c225065
--- /dev/null
+++ b/pip-to-python-packages.sh
@@ -0,0 +1,25 @@
+echo "Welcome to pip-to-python-packages!"
+echo "Refreshing pacman..."
+sudo pacman -Sy
+root_path=$(pwd)
+aur_cache_path=$(pwd)/.cache
+python_3_10_packages_path=$HOME/.local/lib/python3.10/site-packages
+if [ -d $python3_10_packages_path]; then
+ echo "Migrating python3.10 pip packages to python-packages"
+ packages=($(ls $python_3_10_packages_path | uniq | grep -v 'dist-info' | grep -v 'egg-info' | grep -v '__*'))
+ for i in "${packages[@]}"; do
+ cd $root_path
+ if pacman_search_results=$(pacman -Ss python-$i); then
+ sudo pacman -S --noconfirm --needed python-$i
+ else
+ echo "Package 'python-$i' not found in pacman mirrors"
+ echo "Searching the AUR..."
+ aur_search_results=$(curl -s -X GET "https://aur.archlinux.org/rpc/?v=5&type=info&arg=python-$i" | jq -r '.resultcount')
+ if [[ "$aur_search_results" -eq 1 ]]; then
+ git clone "https://aur.archlinux.org/python-$i.git" ./.cache/python-$i && cd ./.cache/python-$i && sudo makepkg --needed --noconfirm -si
+ else
+ echo "Package 'python-$i' not found in the AUR. You're on your own for this one."
+ fi
+ fi
+ done
+fi