-
Notifications
You must be signed in to change notification settings - Fork 3
/
update_pypi.sh
executable file
·54 lines (45 loc) · 1.14 KB
/
update_pypi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /usr/bin/env bash
# Verbose printing
set -o xtrace
deactivate
# Abandon if anything errors
set -e;
# Remove old files
rm -rf .venv3/
rm -rf dist/
rm -rf build/
rm -rf multiwallet.egg-info/
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
# Tests
black --check .
flake8 .
# pytest -v
# Safety
git push
# Virtualenv
python3 --version
# Install virtualenv (if not installed)
# python3 -m pip uninstall virtualenv -y
python3 -m pip install virtualenv
# Create virtualenv and install our software inside it
python3 -m virtualenv .venv3
source .venv3/bin/activate
# python3 -m pip uninstall pyinstaller -y
python3 -m pip install -r requirements.txt
python3 setup.py install
python3 -m pip freeze
# Package
python3 setup.py sdist bdist_wheel
# Upload to PyPI
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*
# Cleanup
rm -rfv dist/
rm -rfv multiwallet.egg-info/
rm -rfv build/
# Hackey timer
# https://askubuntu.com/questions/1028924/how-do-i-use-seconds-inside-a-bash-script
hrs=$(( SECONDS/3600 ))
mins=$(( (SECONDS-hrs*3600)/60))
secs=$(( SECONDS-hrs*3600-mins*60 ))
printf 'Time spent: %02d:%02d:%02d\n' $hrs $mins $secs