Compare commits
8 Commits
2b02598b42
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 127f03c434 | |||
| 086085d031 | |||
| 0f0366341d | |||
| d6d97ebc33 | |||
| 6bd277aee7 | |||
| 260c96402e | |||
| 3fcdffd727 | |||
| 5364e3e3e1 |
13
README.md
Normal file → Executable file
13
README.md
Normal file → Executable 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.
|
||||||
|
|||||||
@@ -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\.+$package\.+whl > urls.txt
|
curl https://pypi.org/project/$package/\#files -s | grep -Eo https://files\.+\.+tar.gz > urls.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
download_package() {
|
download_package() {
|
||||||
@@ -43,14 +43,43 @@ upload_packages() {
|
|||||||
|
|
||||||
|
|
||||||
remove_all_packages() {
|
remove_all_packages() {
|
||||||
rm *.whl *.tar.gz urls.txt
|
rm *.whl *.tar.gz
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
rm .new_requirments.txt urls.txt
|
||||||
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