download with depens

This commit is contained in:
2022-08-03 16:46:54 +03:00
parent 260c96402e
commit 6bd277aee7

View File

@@ -14,7 +14,7 @@ print_help() {
search_package() {
local package=$1
curl https://pypi.org/project/$package/\#files -s | grep -Eo https://files\.+\.+whl > urls.txt
curl https://pypi.org/project/$package/\#files -s | grep -Eo https://files\.+\.+whl | grep -Ev 'macos|arch|arm' > urls.txt
}
download_package() {
@@ -47,10 +47,38 @@ remove_all_packages() {
}
init_venv() {
python3.9 -m venv venv
source venv/bin/activate
pip install freeze
}
install_requriments() {
pip install -r $1
}
create_new_requriments() {
pip freeze > requirments.txt
grep -Eo '^\w[^==]+' requirments.txt > new_requirments.txt
rm requirments.txt
}
remove_venv() {
rm -r venv/
}
main() {
if [[ $# -eq 1 ]]; then
search_package $@
init_venv
install_requriments $@
create_new_requriments
remove_venv
cat new_requirments.txt | while read line; do
search_package $line
download_package
done
elif [[ $# -eq 2 ]]; then
upload_packages $@
remove_all_packages