download with depens
This commit is contained in:
@@ -14,7 +14,7 @@ print_help() {
|
|||||||
|
|
||||||
search_package() {
|
search_package() {
|
||||||
local package=$1
|
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() {
|
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() {
|
main() {
|
||||||
if [[ $# -eq 1 ]]; then
|
if [[ $# -eq 1 ]]; then
|
||||||
search_package $@
|
init_venv
|
||||||
download_package
|
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
|
elif [[ $# -eq 2 ]]; then
|
||||||
upload_packages $@
|
upload_packages $@
|
||||||
remove_all_packages
|
remove_all_packages
|
||||||
|
|||||||
Reference in New Issue
Block a user