Skip to content

Commit

Permalink
bump version, merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Jan 28, 2018
2 parents 97b85e0 + 37dda90 commit a569a45
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 65 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ matrix:
- python: 3.6
env: TOXENV=py36
- python: 3.7-dev
env: TOXENV=py37-dev
- python: pypy2.7-5.8.0
env: TOXENV=py37
- python: pypy2.7-5.10.0
env: TOXENV=pypy
- python: pypy3.5-5.8.0
- python: pypy3.5-5.10.0
env: TOXENV=pypy3
- python: 3.6
env: TOXENV=flake8
Expand All @@ -41,6 +41,6 @@ before_install:
- git fetch --tags
install:
- pip install tox
- python setup.py install
- pip install .
script:
- tox
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,24 @@ all:
@+make build

flake8:
@+flake8 --max-line-length=80 --count --statistics --exit-zero --ignore=E111,E114 gitfame/
@+flake8 --max-line-length=80 --count --statistics --exit-zero --ignore=E111,E114 .
@+flake8 --max-line-length=80 --count --statistics --exit-zero --ignore=E111,E114 gitfame/tests/
@+flake8 --max-line-length=80 --ignore=E111,E114 --exclude .tox --count --statistics --exit-zero .

test:
tox --skip-missing-interpreters

testnose:
nosetests argopt -d -v
nosetests gitfame -d -v

testsetup:
python setup.py check --restructuredtext --strict
python setup.py make none

testcoverage:
@make coverclean
nosetests argopt --with-coverage --cover-package=gitfame --cover-erase --cover-min-percentage=80 -d -v
nosetests gitfame --with-coverage --cover-package=gitfame --cover-erase --cover-min-percentage=80 -d -v

testtimer:
nosetests argopt --with-timer -d -v
nosetests gitfame --with-timer -d -v

distclean:
@+make coverclean
Expand All @@ -80,7 +78,11 @@ coverclean:
clean:
@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('*.py[co]')]"
@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('gitfame/*.py[co]')]"
@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('gitfame/*.c')]"
@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('gitfame/tests/*.py[co]')]"
toxclean:
@+python -c "import shutil; shutil.rmtree('.tox', True)"


installdev:
python setup.py develop --uninstall
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ Authors
.. |Build-Status| image:: https://travis-ci.org/casperdcl/git-fame.svg?branch=master
:target: https://travis-ci.org/casperdcl/git-fame
.. |Coverage-Status| image:: https://coveralls.io/repos/casperdcl/git-fame/badge.svg
:target: https://coveralls.io/r/casperdcl/git-fame
.. |Branch-Coverage-Status| image:: https://codecov.io/github/casperdcl/git-fame/coverage.svg?branch=master
:target: https://codecov.io/github/casperdcl/git-fame?branch=master
.. |Coverage-Status| image:: https://coveralls.io/repos/casperdcl/git-fame/badge.svg?branch=master
:target: https://coveralls.io/github/casperdcl/git-fame
.. |Branch-Coverage-Status| image:: https://codecov.io/gh/casperdcl/git-fame/branch/master/graph/badge.svg
:target: https://codecov.io/gh/casperdcl/git-fame
.. |GitHub-Status| image:: https://img.shields.io/github/tag/casperdcl/git-fame.svg?maxAge=2592000
:target: https://github.com/casperdcl/git-fame/releases
.. |PyPI-Status| image:: https://img.shields.io/pypi/v/git-fame.svg
Expand Down
13 changes: 8 additions & 5 deletions gitfame/_gitfame.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
# from __future__ import absolute_import
import subprocess
import re
import logging
try: # pragma: no cover
from tabulate import tabulate as tabber
raise ImportError("alpha feature: tabulate")
except ImportError: # pragma: no cover
tabber = None

from ._utils import TERM_WIDTH, int_cast_or_len, Max, fext, _str, tqdm, \
check_output
import logging
from ._utils import TERM_WIDTH, int_cast_or_len, Max, fext, _str, \
check_output, tqdm, TqdmStream
from ._version import __version__ # NOQA

__author__ = "Casper da Costa-Luis <[email protected]>"
Expand Down Expand Up @@ -204,7 +204,8 @@ def run(args):
log.log(logging.NOTSET, "files:\n" + '\n'.join(file_list))

auth_stats = {}
for fname in tqdm(file_list, desc="Blame", disable=args.silent_progress):
for fname in tqdm(file_list, desc="Blame", disable=args.silent_progress,
unit="file"):
git_blame_cmd = git_cmd + ["blame", "--line-porcelain", branch, fname]
if args.ignore_whitespace:
git_blame_cmd.append("-w")
Expand Down Expand Up @@ -281,7 +282,9 @@ def main():
from argopt import argopt
args = argopt(__doc__ + '\n' + __copyright__,
version=__version__).parse_args()
logging.basicConfig(level=getattr(logging, args.log, logging.INFO))
logging.basicConfig(
level=getattr(logging, args.log, logging.INFO),
stream=TqdmStream)
log = logging.getLogger(__name__)

log.debug(args)
Expand Down
62 changes: 41 additions & 21 deletions gitfame/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,36 @@
import subprocess
import logging

if True: # pragma: no cover
try:
from tqdm import tqdm
except ImportError:
print ('info | install `tqdm` (https://github.com/tqdm/tqdm) for\n' +
' | a realitme progressbar')

def tqdm(*args, **kwargs):
if args:
return args[0]
return kwargs.get('iterable', None)

try:
_str = unicode # python2
except NameError:
_str = str # python3

try:
_range = xrange # python2
except NameError:
_range = range # python3
try:
# python2
_str = unicode
_range = xrange
except NameError:
# python3
_str = str
_range = range

try:
from tqdm import tqdm
except ImportError:
class tqdm(object):
def __init__(self, iterable=None, **kwargs):
log = logging.getLogger(__name__)
log.info('install `tqdm` (https://github.com/tqdm/tqdm)'
' for a realitme progressbar')
self.iterable = iterable
self.n = 0

def __iter__(self):
for i in self.iterable:
self.n += 1
sys.stderr.write("%d/%d\r" % (self.n, len(self.iterable)))
sys.stderr.flush()
yield i

@classmethod
def write(cls, msg, end='\n'):
sys.stderr.write(msg + end)

__author__ = "Casper da Costa-Luis <[email protected]>"
__date__ = "2016"
Expand All @@ -33,6 +42,17 @@ def tqdm(*args, **kwargs):
__license__ = __licence__ # weird foreign language


class TqdmStream(object):
@classmethod
def write(cls, msg):
tqdm.write(msg, end='')

# is this required?
# @classmethod
# def flush(_):
# pass


def check_output(*a, **k):
log = logging.getLogger(__name__)
log.debug(' '.join(a[0][3:]))
Expand Down
2 changes: 1 addition & 1 deletion gitfame/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
__all__ = ["__version__"]

# major, minor, patch, -extra
version_info = 1, 4, 0
version_info = 1, 4, 1

# Nice string for the version
__version__ = '.'.join(map(str, version_info))
Expand Down
3 changes: 1 addition & 2 deletions gitfame/tests/tests_gitfame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# import re
# from nose import with_setup
# from nose.plugins.skip import SkipTest
from io import IOBase # to support unicode strings
# from io import IOBase # to support unicode strings
try:
from StringIO import StringIO
except ImportError:
Expand Down Expand Up @@ -76,7 +76,6 @@ def test_main():
except:
if """usage: gitfame [-h] [""" not in sys.stdout.getvalue():
raise
pass
else:
raise ValueError("Expected --bad arg to fail")

Expand Down
54 changes: 32 additions & 22 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,59 @@
# and then run "tox" from this directory.

[tox]
# deprecation warning: py26, py32-4
envlist = py26, py27, py33, py34, py35, py36, py37-dev, pypy, pypy3, flake8, nodeps, setup.py
# deprecation warning: py{26,32,33,34}
envlist = py{26,27,33,34,35,36,37,py,py3}, flake8, nodeps, setup.py

[testenv]
passenv = CI TRAVIS TRAVIS_*
[core]
deps =
nose
nose-timer
argopt
commands =
nosetests -d -v gitfame/

[coverage]
deps =
{[core]deps}
coverage
coveralls
commands =
nosetests --with-coverage --cover-package=gitfame -d -v gitfame/
- coveralls

[extra]
deps =
{[coverage]deps}
nose-timer
codecov
argopt
tqdm
tabulate
commands =
nosetests --with-coverage --with-timer --cover-package=gitfame -d -v gitfame/
coveralls
- coveralls
codecov

[testenv:py26]
passenv = {[testenv]passenv}
[testenv]
passenv = CI TRAVIS TRAVIS_*
deps =
nose
coverage
coveralls
argopt
{[extra]deps}
tqdm
tabulate
commands =
nosetests --with-coverage --cover-package=gitfame -d -v gitfame/
coveralls
{[extra]commands}

[testenv:nodeps]
[testenv:py26]
deps =
nose
argopt
{[coverage]deps}
tqdm
tabulate
commands =
nosetests -d -v gitfame/
{[coverage]commands}

[testenv:nodeps]
deps = {[extra]deps}

[testenv:flake8]
deps = flake8
commands =
flake8 --max-line-length=80 --count --statistics --ignore=E111,E114 --exit-zero --exclude .tox .
flake8 --max-line-length=80 --ignore=E111,E114 --count --statistics --exit-zero .

[testenv:setup.py]
deps =
Expand Down

0 comments on commit a569a45

Please sign in to comment.