From 23ee88f7f1418fd39e5f001aee2651e6bec40a58 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sat, 2 Apr 2016 14:06:04 +0100 Subject: [PATCH] remove dependency, documentation updates, universal builds --- .gitignore | 2 +- README.rst | 23 ++++++++++++++++------- gitfame/_gitfame.py | 5 ++--- gitfame/_utils.py | 20 +++++++++++++++----- setup.cfg | 2 ++ setup.py | 1 - 6 files changed, 36 insertions(+), 17 deletions(-) create mode 100644 setup.cfg diff --git a/.gitignore b/.gitignore index ce5816e..b141f29 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ gitfame/*.c gitfame/*.so build/ dist/ -gitfame.egg-info/ +git_fame.egg-info/ .coverage diff --git a/README.rst b/README.rst index a2d4c30..febb80a 100644 --- a/README.rst +++ b/README.rst @@ -9,15 +9,15 @@ Pretty-print ``git`` repository collaborators sorted by contributions. ~$ git fame Blame: 100%|███████████████████████████████████| 11/11 [00:00<00:00, 208.43it/s] - Total commits: 30 - Total files: 17 - Total loc: 522 + Total commits: 302 + Total files: 37 + Total loc: 3134 +----------------------+------+------+------+----------------+ | Author | loc | coms | fils | distribution | +======================+======+======+======+================+ | Casper da Costa-Luis | 3123 | 297 | 35 | 99.6/98.3/85.4 | | Not Committed Yet | 7 | 4 | 2 | 0.2/ 1.3/ 4.9 | - | Nikolay Yakimov | 4 | 1 | 1 | 0.1/ 0.3/ 2.4 | + | Evïan Etàcidñys | 4 | 1 | 1 | 0.1/ 0.3/ 2.4 | +----------------------+------+------+------+----------------+ ------------------------------------------ @@ -59,8 +59,17 @@ Usage .. code:: sh - ~$ git fame # If alias registered with git (see above) - ~$ python -m gitfame # Alternative execution as python module + $ git fame # If alias registered with git (see above) + $ python -m gitfame # Alternative execution as python module + $ git fame -h # Print help + +For example, to print statistics regarding all source files in a C++/CUDA +repository (``*.c/h/t(pp), *.cu(h)``), carefully handling whitespace and line +copies: + +.. code:: sh + + $ git fame --incl '\.[cht][puh]{0,2}$' -twMC Documentation @@ -99,7 +108,7 @@ Licence OSI approved. -Copyright (c) 2016 Casper da Costa-Luis . +Copyright (c) 2016 Casper da Costa-Luis. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. diff --git a/gitfame/_gitfame.py b/gitfame/_gitfame.py index 3edec69..10d7ff7 100755 --- a/gitfame/_gitfame.py +++ b/gitfame/_gitfame.py @@ -29,15 +29,14 @@ # from __future__ import absolute_import import subprocess import re -from ._utils import TERM_WIDTH, int_cast_or_len, Max, fext, _str -from tqdm import tqdm +from ._utils import TERM_WIDTH, int_cast_or_len, Max, fext, _str, tqdm __author__ = "Casper da Costa-Luis " __date__ = "2016" __licence__ = "[MPLv2.0](https://mozilla.org/MPL/2.0/)" __all__ = ["main"] __copyright__ = ' '.join(("Copyright (c)", __date__, __author__, __licence__)) -__version__ = "1.0.1" +__version__ = "1.0.2" __license__ = __licence__ # weird foreign language diff --git a/gitfame/_utils.py b/gitfame/_utils.py index 7121eca..998dfd6 100644 --- a/gitfame/_utils.py +++ b/gitfame/_utils.py @@ -1,16 +1,26 @@ import sys +try: + from tqdm import tqdm +except: + print ('warning | module tqdm not found') + + def tqdm(*args, **kwargs): + if args: + return args[0] + return kwargs.get('iterable', None) + __author__ = "Casper da Costa-Luis " __date__ = "2016" __licence__ = "[MPLv2.0](https://mozilla.org/MPL/2.0/)" -__all__ = ["TERM_WIDTH", "int_cast_or_len", "Max", "fext", "_str"] -__copyright__ = ' '.join((__author__, __date__, __licence__)) +__all__ = ["TERM_WIDTH", "int_cast_or_len", "Max", "fext", "_str", "tqdm"] +__copyright__ = ' '.join(("Copyright (c)", __date__, __author__, __licence__)) __license__ = __licence__ # weird foreign language -def _str(s): - try: +def _str(s): # pragma: no cover + try: # python2 return s.decode(encoding='utf-8') - except: + except: # python3 return s diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..2a9acf1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 diff --git a/setup.py b/setup.py index 9dfc18f..53fdf9b 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,6 @@ def cythonize(*args, **kwargs): platforms=['any'], packages=['gitfame'], provides=['gitfame'], - requires=['tqdm'], ext_modules=cythonize(["gitfame/_gitfame.py", "gitfame/_utils.py"], nthreads=2), classifiers=[