pypi publish script

This commit is contained in:
ed 2018-03-20 22:49:32 +01:00
parent 3ffe573b68
commit cfc4d589d7
5 changed files with 102 additions and 44 deletions

View File

@ -1,40 +0,0 @@
cat > ~/.pypirc <<EOF
[distutils]
index-servers =
pypi
pypitest
[pypi]
username=qwer
password=asdf
[pypitest]
repository: https://test.pypi.org/legacy/
username=qwer
password=asdf
EOF
# set pypi password
chmod 600 ~/.pypirc
sed -ri 's/qwer/username/;s/asdf/password/' ~/.pypirc
# setup build env
cd ~/dev/r0c &&
virtualenv buildenv
# build and release
function have() { python -c "import $1; $1; $1.__version__"; }
deactivate;
cd ~/dev/r0c &&
rm -rf dist r0c.egg-info/ build/ MANIFEST* &&
. buildenv/bin/activate &&
have setuptools &&
have wheel &&
have m2r &&
./setup.py clean2 &&
./setup.py rstconv &&
./setup.py sdist bdist_wheel --universal &&
./setup.py sdist upload -r pypi &&
deactivate &&
echo all done

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
VERSION = (1,0,3) VERSION = (1,0,3)
BUILD_DT = (2018,3,20) BUILD_DT = (2018,3,20)

97
scripts/make-pypi-release.sh Executable file
View File

@ -0,0 +1,97 @@
#!/bin/bash
set -e
echo
sed=$( which gsed 2>/dev/null || which sed)
find=$(which gfind 2>/dev/null || which find)
sort=$(which gsort 2>/dev/null || which sort)
which md5sum 2>/dev/null >/dev/null &&
md5sum=md5sum ||
md5sum="md5 -r"
mode="$1"
[[ "x$mode" == x ]] &&
{
echo "need argument 1: (D)ry or (U)pload"
echo
exit 1
}
[[ -e r0c/__main__.py ]] || cd ..
[[ -e r0c/__main__.py ]] ||
{
echo "run me from within the r0c folder"
echo
exit 1
}
# one-time stuff, do this manually through copy/paste
true ||
{
cat > ~/.pypirc <<EOF
[distutils]
index-servers =
pypi
pypitest
[pypi]
username=qwer
password=asdf
[pypitest]
repository: https://test.pypi.org/legacy/
username=qwer
password=asdf
EOF
# set pypi password
chmod 600 ~/.pypirc
sed -ri 's/qwer/username/;s/asdf/password/' ~/.pypirc
# setup build env
cd ~/dev/r0c &&
virtualenv buildenv
}
pydir="$(
which python |
sed -r 's@[^/]*$@@'
)"
[[ -e "$pydir/activate" ]] &&
{
echo '`deactivate` your virtualenv'
exit 1
}
function have() {
python -c "import $1; $1; $1.__version__"
}
. buildenv/bin/activate
have setuptools
have wheel
have m2r
./setup.py clean2
./setup.py rstconv
./setup.py sdist bdist_wheel --universal
[[ "x$mode" == "xu" ]] &&
./setup.py sdist upload -r pypi
cat <<EOF
all done!
to clean up the source tree:
cd ~/dev/r0c
./setup.py clean2
EOF

View File

@ -76,8 +76,11 @@ class clean2(Command):
def run(self): def run(self):
os.system('{0} setup.py clean --all'.format(sys.executable)) os.system('{0} setup.py clean --all'.format(sys.executable))
rmtree('./dist') try: rmtree('./dist')
rmtree('./r0c.egg-info') except: pass
try: rmtree('./r0c.egg-info')
except: pass
nuke = [] nuke = []
for (dirpath, dirnames, filenames) in os.walk('.'): for (dirpath, dirnames, filenames) in os.walk('.'):