Skip to content

Commit

Permalink
lib/install.sh: abstract map_python_packages function
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Li <[email protected]>
  • Loading branch information
rli9 committed May 27, 2024
1 parent 78a0e4e commit 9d8e5f1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
27 changes: 16 additions & 11 deletions lib/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,21 @@ get_dependency_file()
[ -f "$file" ] && echo $file
}

map_python_packages()
{
# many python2 pkgs are not available in debian 11 and higher version source anymore
# do a general mapping from python-pkg to python3-pkg
[[ "$distro-$_system_version" =~ debian-1[1-9] ]] && map_python2_to_python3

# many python2 pkgs are not available in ubuntu 20.04 and higher version source anymore
# do a general mapping from python-pkg to python3-pkg
[[ "$distro-$_system_version" =~ ubuntu-2[0-9].* ]] && map_python2_to_python3

[[ "$distro-$_system_version" =~ fedora-[3][8-9] ]] && map_python2_to_python3

[[ "$distro-$_system_version" =~ centos-[9] ]] && map_python2_to_python3
}

get_dependency_packages()
{
local distro=$1
Expand All @@ -144,17 +159,7 @@ get_dependency_packages()
parse_packages_arch
[ "$distro" != "debian" ] && remove_packages_version && remove_packages_repository

# many python2 pkgs are not available in debian 11 and higher version source anymore
# do a general mapping from python-pkg to python3-pkg
[[ "$distro-$_system_version" =~ debian-1[1-9] ]] && map_python2_to_python3

# many python2 pkgs are not available in ubuntu 20.04 and higher version source anymore
# do a general mapping from python-pkg to python3-pkg
[[ "$distro-$_system_version" =~ ubuntu-2[0-9].* ]] && map_python2_to_python3

[[ "$distro-$_system_version" =~ fedora-[3][8-9] ]] && map_python2_to_python3

[[ "$distro-$_system_version" =~ centos-[9] ]] && map_python2_to_python3
map_python_packages

adapt_packages | sort | uniq
}
Expand Down
12 changes: 1 addition & 11 deletions tools/test-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@ map_packages()

[[ "$distro" != "debian" ]] && remove_packages_version && remove_packages_repository

# many python2 pkgs are not available in debian 11 and higher version source anymore
# do a general mapping from python-pkg to python3-pkg
[[ "$distro-$_system_version" =~ debian-1[1-9] ]] && map_python2_to_python3

# many python2 pkgs are not available in ubuntu 20.04 and higher version source anymore
# do a general mapping from python-pkg to python3-pkg
[[ "$distro-$_system_version" =~ ubuntu-2[0-9].* ]] && map_python2_to_python3

[[ "$distro-$_system_version" =~ fedora-[3][8-9] ]] && map_python2_to_python3

[[ "$distro-$_system_version" =~ centos-[9] ]] && map_python2_to_python3
map_python_packages

adapt_packages | sort | uniq
}
Expand Down

0 comments on commit 9d8e5f1

Please sign in to comment.