Compare commits

..

10 Commits

Author SHA1 Message Date
127f03c434 download tar.gz files 2022-08-04 16:27:16 +03:00
086085d031 need to add '/' after nexus_host 2022-08-04 10:46:52 +03:00
0f0366341d need to add '/' end of nexus_host 2022-08-03 22:28:33 +03:00
d6d97ebc33 hide some files 2022-08-03 22:26:41 +03:00
6bd277aee7 download with depens 2022-08-03 16:46:54 +03:00
260c96402e remove urls.txt 2022-06-01 16:11:08 +03:00
3fcdffd727 update the search function 2022-06-01 16:10:33 +03:00
5364e3e3e1 add readme 2022-05-29 10:14:17 +03:00
2b02598b42 remove comments from code 2022-05-29 10:09:54 +03:00
61fa31c3ec fix script 2022-05-29 10:09:24 +03:00
2 changed files with 52 additions and 4 deletions

13
README.md Normal file → Executable file
View File

@@ -0,0 +1,13 @@
# Usage
# Download
### Specific Package
1. Run `./pip-install <your-package>`.
## Publish
1. Make sure have the all package you will publish in the same folder (`whl` files).
2. Run `./pip-install <nexus_host> <repository>`.
3. After published, the all packages and json file will remove.

View File

@@ -12,9 +12,13 @@ print_help() {
echo -e
}
download_package() {
search_package() {
local package=$1
pip download $package
curl https://pypi.org/project/$package/\#files -s | grep -Eo https://files\.+\.+tar.gz > urls.txt
}
download_package() {
wget -nc -i urls.txt
}
# insert nexus_host, repository and package to upload
@@ -33,6 +37,7 @@ upload_packages() {
local packages=$(ls *.whl *.tar.gz)
for package in $packages; do
upload_package $@ $package
rm $package
done
}
@@ -42,9 +47,39 @@ 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
download_package $1
init_venv
install_requriments $@
create_new_requriments
remove_venv
cat .new_requirments.txt | while read line; do
search_package $line
download_package
done
rm .new_requirments.txt urls.txt
elif [[ $# -eq 2 ]]; then
upload_packages $@
remove_all_packages
@@ -53,4 +88,4 @@ main() {
fi
}
main $@
main $@