mirror of https://github.com/9001/r0c.git
pypi publish script
This commit is contained in:
parent
3ffe573b68
commit
cfc4d589d7
|
@ -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
|
|
@ -1,5 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
VERSION = (1,0,3)
|
||||
BUILD_DT = (2018,3,20)
|
||||
|
||||
|
|
|
@ -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
|
7
setup.py
7
setup.py
|
@ -76,8 +76,11 @@ class clean2(Command):
|
|||
def run(self):
|
||||
os.system('{0} setup.py clean --all'.format(sys.executable))
|
||||
|
||||
rmtree('./dist')
|
||||
rmtree('./r0c.egg-info')
|
||||
try: rmtree('./dist')
|
||||
except: pass
|
||||
|
||||
try: rmtree('./r0c.egg-info')
|
||||
except: pass
|
||||
|
||||
nuke = []
|
||||
for (dirpath, dirnames, filenames) in os.walk('.'):
|
||||
|
|
Loading…
Reference in New Issue