14 Commits

Author SHA1 Message Date
star:Kenneth Reitz faeacbbfad Merge branch 'develop' 2011-03-24 05:11:47 -04:00
star:Kenneth Reitz 401344ff1e updated version info 2011-03-24 05:09:09 -04:00
star:Kenneth Reitz 598deda4d9 python 2.5 support! 2011-03-24 05:07:14 -04:00
star:Kenneth Reitz bf7b5d0930 2.5 with_statement support! 2011-03-24 05:06:23 -04:00
star:Kenneth Reitz 6404b0e49c no redundant versions 2011-03-24 03:42:20 -04:00
star:Kenneth Reitz b92f3204c9 version bump 2011-03-24 03:42:11 -04:00
star:Kenneth Reitz 61225d90e6 fix all colors example 2011-03-24 03:40:42 -04:00
star:Kenneth Reitz 3688a2a67b list of available colors 2011-03-24 03:40:37 -04:00
star:Kenneth Reitz dda561387c RELASE v0.2.0 2011-03-23 08:52:41 -04:00
star:Kenneth Reitz 06af338874 back to regular adding (thanks to clean()) 2011-03-23 08:43:57 -04:00
star:Kenneth Reitz 9b91cf16b5 v0.2.0 2011-03-23 06:45:01 -04:00
star:Kenneth Reitz ec8fe4a0b7 Added appdirs license 2011-03-23 06:44:56 -04:00
star:Kenneth Reitz dc6a9c63ea prepping for 0.2.0 release 2011-03-23 06:40:38 -04:00
star:Kenneth Reitz 82d31e555f Merge branch 'feature/widths' 2011-03-23 06:35:33 -04:00
17 changed files with 85 additions and 27 deletions
+24 -4
View File
@@ -1,10 +1,28 @@
History History
------- -------
0.1.0 (2011-03-20) 0.2.1 (2011-03-24)
++++++++++++++++++ ++++++++++++++++++
* Initial Release! * Python 2.5 Support
* List of available colors
0.2.0 (2011-03-23)
++++++++++++++++++
* Column Printing!!!
* (Auto/Manual) Disabling of Colors
* Smarter Colors
* max_width, min_width
* Strip cli colors
* bug fixes
0.1.2 (2011-03-21)
++++++++++++++++++
* Bugfixes
0.1.1 (2011-03-20) 0.1.1 (2011-03-20)
@@ -16,7 +34,9 @@ History
* Lots of Examples * Lots of Examples
0.1.2 (2011-03-21)
0.1.0 (2011-03-20)
++++++++++++++++++ ++++++++++++++++++
* Bugfixes * Initial Release!
+28 -1
View File
@@ -1,4 +1,4 @@
Clint includes some vendorized python libraries: appdirs, colorama, ordereddict. Clint includes some vendorized python libraries: appdirs, applib, colorama, ordereddict.
AppDirs License AppDirs License
=============== ===============
@@ -25,6 +25,33 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AppLib License (console width detection functions are from this library)
==============
# This is the MIT license
# Copyright (c) 2010 ActiveState Software Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Colorama License Colorama License
================ ================
+2 -2
View File
@@ -19,8 +19,8 @@ from .pipes import piped_in
__title__ = 'clint' __title__ = 'clint'
__version__ = '0.1.2' __version__ = '0.2.1'
__build__ = 0x000102 __build__ = 0x000201
__author__ = 'Kenneth Reitz' __author__ = 'Kenneth Reitz'
__license__ = 'ISC' __license__ = 'ISC'
__copyright__ = 'Copyright 2011 Kenneth Reitz' __copyright__ = 'Copyright 2011 Kenneth Reitz'
+1
View File
@@ -9,6 +9,7 @@ This module contains the helper functions for dealing with unix pipes.
""" """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import with_statement
import sys import sys
+1
View File
@@ -10,6 +10,7 @@ This module contains all the application resource features of clint.
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import with_statement
import errno import errno
from os import remove, removedirs from os import remove, removedirs
+1 -3
View File
@@ -8,8 +8,6 @@ This module provides the text output helper system.
""" """
from __future__ import absolute_import
from . import colored from . import colored
from .core import * from core import *
+8 -10
View File
@@ -16,18 +16,18 @@ import sys
from ..packages import colorama from ..packages import colorama
DISABLE_COLOR = False
if sys.stdout.isatty():
colorama.init(autoreset=True)
__all__ = ( __all__ = (
'red', 'green', 'yellow', 'blue', 'red', 'green', 'yellow', 'blue',
'black', 'magenta', 'cyan', 'white', 'black', 'magenta', 'cyan', 'white',
'clean', 'disable' 'clean', 'disable'
) )
COLORS = __all__[:-2]
DISABLE_COLOR = False
if sys.stdout.isatty():
colorama.init(autoreset=True)
class ColoredString(object): class ColoredString(object):
"""Enhanced string for __len__ operations on Colored output.""" """Enhanced string for __len__ operations on Colored output."""
@@ -58,12 +58,10 @@ class ColoredString(object):
return self.color_str return self.color_str
def __add__(self, other): def __add__(self, other):
self.s += other return str(self.color_str) + str(other)
return self
def __radd__(self, other): def __radd__(self, other):
self.s = other + self.s return str(other) + str(self.color_str)
return self
def __mul__(self, other): def __mul__(self, other):
return (self.color_str * other) return (self.color_str * other)
+2 -1
View File
@@ -15,10 +15,11 @@ import sys
from .progress import progressbar from .progress import progressbar
from .formatters import max_width, min_width from .formatters import max_width, min_width
from .cols import columns
from ..utils import tsplit from ..utils import tsplit
__all__ = ('puts', 'puts_err', 'indent', 'progressbar', 'max_width', 'min_width') __all__ = ('puts', 'puts_err', 'indent', 'progressbar', 'columns', 'max_width', 'min_width')
STDOUT = sys.stdout.write STDOUT = sys.stdout.write
+2 -1
View File
@@ -9,6 +9,7 @@ Various Python helpers used within clint.
""" """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import with_statement
import sys import sys
import errno import errno
@@ -28,7 +29,7 @@ def mkdir_p(path):
"""Emulates `mkdir -p` behavior.""" """Emulates `mkdir -p` behavior."""
try: try:
makedirs(path) makedirs(path)
except OSError as exc: # Python >2.5 except OSError, exc: # Python >2.5
if exc.errno == errno.EEXIST: if exc.errno == errno.EEXIST:
pass pass
else: else:
+1 -1
View File
@@ -12,5 +12,5 @@ text = 'THIS TEXT IS COLORED %s!'
if __name__ == '__main__': if __name__ == '__main__':
for color in colored.__all__: for color in colored.COLORS:
print getattr(colored, color)(text % color.upper()) print getattr(colored, color)(text % color.upper())
+3
View File
@@ -1,6 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import with_statement
import sys import sys
import os import os
+2
View File
@@ -1,6 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import with_statement
import sys import sys
import os import os
+2
View File
@@ -1,6 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import with_statement
import sys import sys
import os import os
+2
View File
@@ -4,6 +4,8 @@
import sys import sys
import os import os
from __future__ import with_statement
sys.path.insert(0, os.path.abspath('..')) sys.path.insert(0, os.path.abspath('..'))
from clint import piped_in from clint import piped_in
+1 -1
View File
@@ -7,7 +7,7 @@ import os
sys.path.insert(0, os.path.abspath('..')) sys.path.insert(0, os.path.abspath('..'))
from clint.textui import puts, colored from clint.textui import puts, colored
from clint.textui.columns import columns from clint.textui import columns
lorem = 'Lorem ipsum dolor sit amet, consehdfhdfhdfhdfhdfhctetur adi pisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' lorem = 'Lorem ipsum dolor sit amet, consehdfhdfhdfhdfhdfhctetur adi pisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
+5 -3
View File
@@ -6,6 +6,9 @@ import sys
from distutils.core import setup from distutils.core import setup
import clint
def publish(): def publish():
"""Publish to PyPi""" """Publish to PyPi"""
@@ -19,7 +22,7 @@ required = []
setup( setup(
name='clint', name='clint',
version='0.1.2', version=clint.__version__,
description='Python Command-line Application Tools', description='Python Command-line Application Tools',
long_description=open('README.rst').read() + '\n\n' + long_description=open('README.rst').read() + '\n\n' +
open('HISTORY.rst').read(), open('HISTORY.rst').read(),
@@ -29,7 +32,6 @@ setup(
packages= [ packages= [
'clint', 'clint',
'clint.textui', 'clint.textui',
'clint.packages', 'clint.packages.colorama' 'clint.packages', 'clint.packages.colorama'
], ],
install_requires=required, install_requires=required,
@@ -40,7 +42,7 @@ setup(
'Natural Language :: English', 'Natural Language :: English',
'License :: OSI Approved :: ISC License (ISCL)', 'License :: OSI Approved :: ISC License (ISCL)',
'Programming Language :: Python', 'Programming Language :: Python',
# 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
# 'Programming Language :: Python :: 3.0', # 'Programming Language :: Python :: 3.0',