From b85b727606a51b5180ad702f4b5ba52c377c7aec Mon Sep 17 00:00:00 2001 From: Nicolas Pouillard Date: Sat, 20 Apr 2013 00:21:24 +0200 Subject: [PATCH 1/7] Color JSON array markers '[' and ']' --- colout/colout_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colout/colout_json.py b/colout/colout_json.py index bc487b5..724362f 100644 --- a/colout/colout_json.py +++ b/colout/colout_json.py @@ -1,7 +1,7 @@ def theme(): return [ - [ '[{}]' ], + [ '[][{}]' ], [ '[:,]', "blue" ], [ '".*"', "green" ] ] From 37934e9266d05e1519ac16d5269fef0b3f3b38e3 Mon Sep 17 00:00:00 2001 From: Xu Di Date: Mon, 22 Apr 2013 13:34:06 +0800 Subject: [PATCH 2/7] colout/colout.py uses python3, whereas it really needs python2, also add requirement in setup, makes it auto-install requirement package. --- .gitignore | 3 +++ README.md | 7 +++++++ colout/colout.py | 2 +- setup.py | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0d20b64..9839280 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ *.pyc +build/ +dist/ +colout.egg-info/ diff --git a/README.md b/README.md index 884748c..4b8f741 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,13 @@ to it (see also the `-s` switch below). `colout` is released under the GNU Public License v3. +## INSTALLATION + + sudo python setup.py install + +and then soft link `/usr/local/bin/colout` to your colout.py under your installaion directory, which usually like + + /usr/local/lib/python2.7/dist-packages/colout-0.1-py2.7.egg/colout/colout.py ## OPTIONS diff --git a/colout/colout.py b/colout/colout.py index 0f7cfc3..2bdcd71 100755 --- a/colout/colout.py +++ b/colout/colout.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python #encoding: utf-8 # Color Up Arbitrary Command Ouput diff --git a/setup.py b/setup.py index bb9fb52..3145294 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ if sys.argv[-1] == 'publish': packages = ['colout'] -requires = [] +requires = ['argparse', 'pygments', 'babel'] setup( name='colout', From 177c11fd9a71f71625544e4c3e25a1d25cb10d6b Mon Sep 17 00:00:00 2001 From: Martin Ueding Date: Sun, 28 Apr 2013 15:32:03 +0200 Subject: [PATCH 3/7] Add launcher script I tried to package this program in Ubuntu, and found that it has no startup script. So I added a `colout` script that gets installed into the scripts directory with the `setup.py`. --- bin/colout | 11 +++++++++++ setup.py | 1 + 2 files changed, 12 insertions(+) create mode 100644 bin/colout diff --git a/bin/colout b/bin/colout new file mode 100644 index 0000000..8d38565 --- /dev/null +++ b/bin/colout @@ -0,0 +1,11 @@ +#!/bin/bash +# Copyright © 2013 Martin Ueding + +# Small launcher script for the main module. + +# Licence: GPL 3+ + +set -e +set -u + +python -m colout.colout "$@" diff --git a/setup.py b/setup.py index bb9fb52..36d8666 100644 --- a/setup.py +++ b/setup.py @@ -29,6 +29,7 @@ setup( packages=packages, package_data={'': ['LICENSE']}, package_dir={'colout': 'colout'}, + scripts=['bin/colout'], include_package_data=True, install_requires=requires, license=open('LICENSE').read(), From e199f3869854c074dc9c455151c6342a683fa2d4 Mon Sep 17 00:00:00 2001 From: Martin Ueding Date: Tue, 30 Apr 2013 16:42:36 +0200 Subject: [PATCH 4/7] Call Python 3 --- bin/colout | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/colout b/bin/colout index 8d38565..99da3e4 100644 --- a/bin/colout +++ b/bin/colout @@ -8,4 +8,4 @@ set -e set -u -python -m colout.colout "$@" +python3 -m colout.colout "$@" From c9bd98b414d771ed7086a4111aa5e8e5c9e3e393 Mon Sep 17 00:00:00 2001 From: Martin Ueding Date: Tue, 30 Apr 2013 16:43:06 +0200 Subject: [PATCH 5/7] Change License to GPL 3 only It has been 3+ previously, but the remainder of the project is using 3 only. --- bin/colout | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/colout b/bin/colout index 99da3e4..9e09ae9 100644 --- a/bin/colout +++ b/bin/colout @@ -3,7 +3,7 @@ # Small launcher script for the main module. -# Licence: GPL 3+ +# Licence: GPL 3 set -e set -u From 64454e42f1cf5a4f8cd41480adb00ae0aa0c74cb Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 5 May 2013 00:20:24 +0200 Subject: [PATCH 6/7] Use python3 everywhere --- colout/colout.py | 2 +- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/colout/colout.py b/colout/colout.py index 2bdcd71..0f7cfc3 100755 --- a/colout/colout.py +++ b/colout/colout.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 #encoding: utf-8 # Color Up Arbitrary Command Ouput diff --git a/setup.py b/setup.py index 463b4d4..2ad8b72 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys @@ -11,7 +11,7 @@ except ImportError: from distutils.core import setup if sys.argv[-1] == 'publish': - os.system('python setup.py sdist upload') + os.system('python3 setup.py sdist upload') sys.exit() packages = ['colout'] From 894fab9c682508a6fd2854c7e0ccd181bb9954cd Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 5 May 2013 00:30:43 +0200 Subject: [PATCH 7/7] bugfix #27: use default msg marker if no localization found --- colout/colout_g++.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/colout/colout_g++.py b/colout/colout_g++.py index b37e504..d10e320 100644 --- a/colout/colout_g++.py +++ b/colout/colout_g++.py @@ -1,5 +1,8 @@ #encoding: utf-8 +def default_gettext( msg ): + return msg + def theme(): import os import gettext @@ -9,8 +12,12 @@ def theme(): gv = os.popen("g++ -dumpversion").read().strip() # get the current translations of gcc - t = gettext.translation("gcc-"+gv) - _ = t.gettext + try: + t = gettext.translation("gcc-"+gv) + except IOError: + _ = default_gettext + else: + _ = t.gettext # _("msg") will return the given message, translated # if the locale is unicode