mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Use bash for manage.sh
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
function publish {
|
||||
check
|
||||
test
|
||||
bump
|
||||
readme
|
||||
doc
|
||||
push
|
||||
}
|
||||
|
||||
function check {
|
||||
pep8 --ignore=E501 github setup.py || exit
|
||||
}
|
||||
|
||||
function test {
|
||||
python3 setup.py test --quiet || exit
|
||||
|
||||
coverage run --branch --include=github/*.py --omit=github/tests/*.py setup.py test --quiet || exit
|
||||
coverage report --show-missing || exit
|
||||
}
|
||||
|
||||
function bump {
|
||||
previousVersion=$( grep '^version =' setup.py | sed 's/version = \"\(.*\)\"/\1/' )
|
||||
echo "Next version number? (previous: '$previousVersion')"
|
||||
read version
|
||||
sed -i -b "s/version = .*/version = \"$version\"/" setup.py
|
||||
}
|
||||
|
||||
function readme {
|
||||
git log v$previousVersion.. --oneline
|
||||
|
||||
echo "Edit README.rst and doc/changes.rst now, then press enter"
|
||||
read foobar
|
||||
}
|
||||
|
||||
function doc {
|
||||
rm -rf doc/build
|
||||
mkdir doc/build
|
||||
cd doc/build
|
||||
git init
|
||||
sphinx-build -b html -d doctrees .. . || exit
|
||||
touch .nojekyll
|
||||
echo /doctrees/ > .gitignore
|
||||
git add . || exit
|
||||
git commit --message "Automatic generation" || exit
|
||||
git push --force ../.. HEAD:gh-pages || exit
|
||||
}
|
||||
|
||||
function push {
|
||||
echo "Break (Ctrl+c) here if something is wrong. Else, press enter"
|
||||
read foobar
|
||||
|
||||
git commit -am "Publish version $version"
|
||||
|
||||
cp COPYING* github
|
||||
python setup.py sdist upload
|
||||
rm -rf github/COPYING*
|
||||
|
||||
git tag -m "Version $version" v$version
|
||||
|
||||
git push github master master:develop
|
||||
git push --force github gh-pages
|
||||
git push --tags
|
||||
}
|
||||
|
||||
$1
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
python setup.py publish || exit
|
||||
|
||||
### @todo make_doc AFTER having incremented version
|
||||
|
||||
previousVersion=$( grep '^version =' setup.py | sed 's/version = \"\(.*\)\"/\1/' )
|
||||
echo "Next version number? (previous: '$previousVersion')"
|
||||
read version
|
||||
sed -i -b "s/version = .*/version = \"$version\"/" setup.py
|
||||
git add setup.py
|
||||
|
||||
git log v$previousVersion.. --oneline
|
||||
|
||||
echo "Edit README.rst and doc/changes.rst now, then press enter"
|
||||
read foobar
|
||||
git add README.rst doc/changes.rst
|
||||
|
||||
git commit -m "Publish version $version"
|
||||
|
||||
echo "Break (Ctrl+c) here if something is wrong. Else, press enter"
|
||||
read foobar
|
||||
|
||||
cp COPYING* github
|
||||
python setup.py sdist upload
|
||||
rm -rf github/COPYING*
|
||||
|
||||
git tag -m "Version $version" v$version
|
||||
|
||||
git push github master master:develop
|
||||
git push --force github gh-pages
|
||||
git push --tags
|
||||
@@ -23,61 +23,6 @@ import os.path
|
||||
version = "1.12.2"
|
||||
|
||||
|
||||
def execute(*args):
|
||||
subprocess.check_call(args)
|
||||
|
||||
|
||||
class SimpleCommand(setuptools.Command):
|
||||
user_options = []
|
||||
|
||||
def __init__(self, dist, *args, **kwds):
|
||||
setuptools.Command.__init__(self, dist, *args, **kwds)
|
||||
self.dist = dist
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
|
||||
class Check(SimpleCommand):
|
||||
def run(self):
|
||||
execute("pep8", "--ignore=E501", "github", "setup.py") # pip install pep8
|
||||
|
||||
|
||||
class Coverage(SimpleCommand):
|
||||
def run(self):
|
||||
execute("coverage", "run", "--branch", "--include=github/*.py", "--omit=github/tests/*.py", "setup.py", "test", "--quiet")
|
||||
execute("python3", "setup.py", "test", "--quiet")
|
||||
execute("coverage", "report", "--show-missing")
|
||||
|
||||
|
||||
class MakeDoc(SimpleCommand):
|
||||
def run(self):
|
||||
d = "doc/build"
|
||||
if os.path.exists(d):
|
||||
shutil.rmtree(d)
|
||||
os.makedirs(d)
|
||||
os.chdir(d)
|
||||
execute("git", "init")
|
||||
execute("sphinx-build", "-b", "html", "-d", "doctrees", "..", ".")
|
||||
open(".nojekyll", "w").close()
|
||||
f = open(".gitignore", "w")
|
||||
f.write("/doctrees/\n")
|
||||
f.close()
|
||||
execute("git", "add", ".")
|
||||
execute("git", "commit", "--message", "Automatic generation")
|
||||
execute("git", "push", "--force", "../..", "HEAD:gh-pages")
|
||||
|
||||
|
||||
class Publish(SimpleCommand):
|
||||
def run(self):
|
||||
Check(self.dist).run()
|
||||
Coverage(self.dist).run()
|
||||
MakeDoc(self.dist).run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
setuptools.setup(
|
||||
name="PyGithub",
|
||||
@@ -132,11 +77,5 @@ if __name__ == "__main__":
|
||||
"Topic :: Software Development",
|
||||
],
|
||||
test_suite="github.tests.AllTests",
|
||||
cmdclass={
|
||||
"check_": Check,
|
||||
"coverage": Coverage,
|
||||
"make_doc": MakeDoc,
|
||||
"publish": Publish,
|
||||
},
|
||||
use_2to3=True
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user