summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFivePixels <dylan.bolger00@gmail.com>2023-01-28 10:10:04 -0600
committerFivePixels <dylan.bolger00@gmail.com>2023-01-28 10:19:23 -0600
commitc763ef2b55e26464235ba0dea41bd62f310c3346 (patch)
tree2dc219a95b5dcfdb947a0902ed7b0c5ce3e31327
parent6631ba984dc2b8291dcae464d8778fd86ae4b1c8 (diff)
downloadpip-to-python-packages-main.tar.xz
pip-to-python-packages-main.zip
Rename iterator variable, remove sudo from makepkgmain
-rw-r--r--.gitignore1
-rw-r--r--README.md7
-rwxr-xr-xpip-to-python-packages.sh14
3 files changed, 15 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ceddaa3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.cache/
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3dbbcc2
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+# pip-to-python-packages
+Helper script to move existing pip packages installed to Python packages from the AUR or the offical Arch Linux repositories.
+
+## Usage
+`./pip-to-python-packages.sh`
+
+pip-to-python-packages **does not** remove the pip packages being migrated. You will need to remove them to prevent any overlapping packages. \ No newline at end of file
diff --git a/pip-to-python-packages.sh b/pip-to-python-packages.sh
index c225065..0ade695 100755
--- a/pip-to-python-packages.sh
+++ b/pip-to-python-packages.sh
@@ -7,18 +7,18 @@ 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
+ for packagename in "${packages[@]}"; do
cd $root_path
- if pacman_search_results=$(pacman -Ss python-$i); then
- sudo pacman -S --noconfirm --needed python-$i
+ if pacman_search_results=$(pacman -Ss python-$packagename); then
+ sudo pacman -S --noconfirm --needed python-$packagename
else
- echo "Package 'python-$i' not found in pacman mirrors"
+ echo "Package 'python-$packagename' 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')
+ aur_search_results=$(curl -s -X GET "https://aur.archlinux.org/rpc/?v=5&type=info&arg=python-$packagename" | 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
+ git clone "https://aur.archlinux.org/python-$packagename.git" ./.cache/python-$packagename && cd ./.cache/python-$packagename && makepkg --needed --noconfirm -si
else
- echo "Package 'python-$i' not found in the AUR. You're on your own for this one."
+ echo "Package 'python-$packagename' not found in the AUR. You're on your own for this one."
fi
fi
done