From d3f26ece7d4383df0b22fe9c3cb3e695381ec737 Mon Sep 17 00:00:00 2001 From: Dan Klein Date: Mon, 24 Aug 2015 10:51:13 +0300 Subject: Initial push to external_lib migration --- .../python_lib/termstyle/MANIFEST.in | 1 - .../python_lib/termstyle/Makefile | 9 - .../python_lib/termstyle/README.rst | 82 --------- .../python_lib/termstyle/VERSION | 1 - .../python_lib/termstyle/__init__.py | 0 .../python_lib/termstyle/python-termstyle.xml | 183 --------------------- .../python_lib/termstyle/setup.py | 27 --- .../python_lib/termstyle/termstyle.py | 107 ------------ .../python_lib/termstyle/test2.py | 5 - .../python_lib/termstyle/test3.py | 5 - .../python_lib/termstyle/test_all.sh | 4 - 11 files changed, 424 deletions(-) delete mode 100755 scripts/automation/trex_control_plane/python_lib/termstyle/MANIFEST.in delete mode 100755 scripts/automation/trex_control_plane/python_lib/termstyle/Makefile delete mode 100755 scripts/automation/trex_control_plane/python_lib/termstyle/README.rst delete mode 100755 scripts/automation/trex_control_plane/python_lib/termstyle/VERSION delete mode 100644 scripts/automation/trex_control_plane/python_lib/termstyle/__init__.py delete mode 100755 scripts/automation/trex_control_plane/python_lib/termstyle/python-termstyle.xml delete mode 100755 scripts/automation/trex_control_plane/python_lib/termstyle/setup.py delete mode 100755 scripts/automation/trex_control_plane/python_lib/termstyle/termstyle.py delete mode 100755 scripts/automation/trex_control_plane/python_lib/termstyle/test2.py delete mode 100755 scripts/automation/trex_control_plane/python_lib/termstyle/test3.py delete mode 100755 scripts/automation/trex_control_plane/python_lib/termstyle/test_all.sh (limited to 'scripts/automation/trex_control_plane/python_lib/termstyle') diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/MANIFEST.in b/scripts/automation/trex_control_plane/python_lib/termstyle/MANIFEST.in deleted file mode 100755 index 14dafaf3..00000000 --- a/scripts/automation/trex_control_plane/python_lib/termstyle/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include test* diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/Makefile b/scripts/automation/trex_control_plane/python_lib/termstyle/Makefile deleted file mode 100755 index 02151dca..00000000 --- a/scripts/automation/trex_control_plane/python_lib/termstyle/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -0: - mkzero-gfxmonk \ - -v `cat VERSION` \ - -p termstyle.py \ - -p setup.py \ - python-termstyle.xml - -pypi: - ./setup.py register sdist upload diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/README.rst b/scripts/automation/trex_control_plane/python_lib/termstyle/README.rst deleted file mode 100755 index f3dfa0ab..00000000 --- a/scripts/automation/trex_control_plane/python_lib/termstyle/README.rst +++ /dev/null @@ -1,82 +0,0 @@ -========= -termstyle -========= - -termstyle is a simple python library for adding coloured output to -terminal (console) programs. The definitions come from ECMA-048_, the -"Control Functions for Coded Character Sets" standard. - -Installation: -------------- - -I thoroughly recommend using the zero-install feed (see the project homepage) to manage your dependencies if at all possible. zero-install_ provides a much better system than pip or easy_install, and works with absolutely any language and allows decentralised package management that requires no special privileges to install. - -Example Usage: --------------- -:: - - from termstyle import * - print "%s:%s" % (red('Hey'), green('how are you?')) - print blue('How ', bold('you'), ' doin?') - -or, you can use a colour just as a string:: - - print "%sBlue!%s" % (blue, reset) - -Styles: -------- -:: - - reset or default (no colour / style) - -colour:: - - black - red - green - yellow - blue - magenta - cyan - white - -background colour:: - - bg_black - bg_red - bg_green - bg_yellow - bg_blue - bg_magenta - bg_cyan - bg_white - bg_default - -In terminals supporting transparency ``bg_default`` is often used to set -the background to transparent [#]_. - -weight:: - - bold - inverted - -style:: - - italic - underscore - -Controls: ---------- -:: - - auto() - sets colouring on only if sys.stdout is a terminal - disabe() - disable colours - enable() - enable colours - -.. [#] Supporting terminals include rxvt-unicode_, and Eterm_. - -.. _ECMA-048: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf -.. _rxvt-unicode: http://software.schmorp.de/ -.. _Eterm: http://www.eterm.org/ -.. _zero-install: http://0install.net/ - diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/VERSION b/scripts/automation/trex_control_plane/python_lib/termstyle/VERSION deleted file mode 100755 index 345f8cc0..00000000 --- a/scripts/automation/trex_control_plane/python_lib/termstyle/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1.10 \ No newline at end of file diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/__init__.py b/scripts/automation/trex_control_plane/python_lib/termstyle/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/python-termstyle.xml b/scripts/automation/trex_control_plane/python_lib/termstyle/python-termstyle.xml deleted file mode 100755 index b6b08bd7..00000000 --- a/scripts/automation/trex_control_plane/python_lib/termstyle/python-termstyle.xml +++ /dev/null @@ -1,183 +0,0 @@ - - - - termstyle - console colouring for python - http://github.com/gfxmonk/termstyle - -========= -termstyle -========= - -termstyle is a simple python library for adding coloured output to -terminal (console) programs. The definitions come from ECMA-048_, the -"Control Functions for Coded Character Sets" standard. - -Installation: -------------- - -I thoroughly recommend using the zero-install feed (see the project homepage) to manage your dependencies if at all possible. zero-install_ provides a much better system than pip or easy_install, and works with absolutely any language and allows decentralised package management that requires no special privileges to install. - -Example Usage: --------------- -:: - - from termstyle import * - print "%s:%s" % (red('Hey'), green('how are you?')) - print blue('How ', bold('you'), ' doin?') - -or, you can use a colour just as a string:: - - print "%sBlue!%s" % (blue, reset) - -Styles: -------- -:: - - reset or default (no colour / style) - -colour:: - - black - red - green - yellow - blue - magenta - cyan - white - -background colour:: - - bg_black - bg_red - bg_green - bg_yellow - bg_blue - bg_magenta - bg_cyan - bg_white - bg_default - -In terminals supporting transparency ``bg_default`` is often used to set -the background to transparent [#]_. - -weight:: - - bold - inverted - -style:: - - italic - underscore - -Controls: ---------- -:: - - auto() - sets colouring on only if sys.stdout is a terminal - disabe() - disable colours - enable() - enable colours - -.. [#] Supporting terminals include rxvt-unicode_, and Eterm_. - -.. _ECMA-048: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf -.. _rxvt-unicode: http://software.schmorp.de/ -.. _Eterm: http://www.eterm.org/ -.. _zero-install: http://0install.net/ - - - - -
-

termstyle

-

termstyle is a simple python library for adding coloured output to terminal (console) programs. The definitions come from ECMA-048, the "Control Functions for Coded Character Sets" standard.

-

Installation:

-

I thoroughly recommend using the zero-install feed (see the project homepage) to manage your dependencies if at all possible. zero-install provides a much better system than pip or easy_install, and works with absolutely any language and allows decentralised package management that requires no special privileges to install.

-

Example Usage:

-
from termstyle import *
-print "%s:%s" % (red('Hey'), green('how are you?'))
-print blue('How ', bold('you'), ' doin?')
-
-

or, you can use a colour just as a string:

-
print "%sBlue!%s" % (blue, reset)
-
-

Styles:

-
reset or default (no colour / style)
-
-

colour:

-
black
-red
-green
-yellow
-blue
-magenta
-cyan
-white
-
-

background colour:

-
bg_black
-bg_red
-bg_green
-bg_yellow
-bg_blue
-bg_magenta
-bg_cyan
-bg_white
-bg_default
-
-

In terminals supporting transparency bg_default is often used to set the background to transparent [#]_.

-

weight:

-
bold
-inverted
-
-

style:

-
italic
-underscore
-
-

Controls:

-
auto() - sets colouring on only if sys.stdout is a terminal
-disabe() - disable colours
-enable() - enable colours
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/setup.py b/scripts/automation/trex_control_plane/python_lib/termstyle/setup.py deleted file mode 100755 index 69b11cbb..00000000 --- a/scripts/automation/trex_control_plane/python_lib/termstyle/setup.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python - -## NOTE: ## -## this setup.py was generated by zero2pypi: -## http://gfxmonk.net/dist/0install/zero2pypi.xml - -from setuptools import * -setup( - packages = find_packages(exclude=['test', 'test.*']), - install_requires=['setuptools'], - version='0.1.10', - url='http://gfxmonk.net/dist/0install/python-termstyle.xml', - description='console colouring for python', - long_description='\n**Note**: This package has been built automatically by\n`zero2pypi `_.\nIf possible, you should use the zero-install feed instead:\nhttp://gfxmonk.net/dist/0install/python-termstyle.xml\n\n----------------\n\n=========\ntermstyle\n=========\n\ntermstyle is a simple python library for adding coloured output to\nterminal (console) programs. The definitions come from ECMA-048_, the\n"Control Functions for Coded Character Sets" standard.\n\nInstallation:\n-------------\n\nI thoroughly recommend using the zero-install feed (see the project homepage) to manage your dependencies if at all possible. zero-install_ provides a much better system than pip or easy_install, and works with absolutely any language and allows decentralised package management that requires no special privileges to install.\n\nExample Usage:\n--------------\n::\n\n\tfrom termstyle import *\n\tprint "%s:%s" % (red(\'Hey\'), green(\'how are you?\'))\n\tprint blue(\'How \', bold(\'you\'), \' doin?\')\n\nor, you can use a colour just as a string::\n\n\tprint "%sBlue!%s" % (blue, reset)\n\nStyles:\n-------\n::\n\n\treset or default (no colour / style)\n\ncolour::\n\n\tblack\n\tred\n\tgreen\n\tyellow\n\tblue\n\tmagenta\n\tcyan\n\twhite\n\nbackground colour::\n\n\tbg_black\n\tbg_red\n\tbg_green\n\tbg_yellow\n\tbg_blue\n\tbg_magenta\n\tbg_cyan\n\tbg_white\n\tbg_default\n\nIn terminals supporting transparency ``bg_default`` is often used to set\nthe background to transparent [#]_.\n\nweight::\n\n\tbold\n\tinverted\n\nstyle::\n\n\titalic\n\tunderscore\n\nControls:\n---------\n::\n\n\tauto() - sets colouring on only if sys.stdout is a terminal\n\tdisabe() - disable colours\n\tenable() - enable colours\n\n.. [#] Supporting terminals include rxvt-unicode_, and Eterm_.\n\n.. _ECMA-048: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf\n.. _rxvt-unicode: http://software.schmorp.de/\n.. _Eterm: http://www.eterm.org/\n.. _zero-install: http://0install.net/\n', - name='python-termstyle', - download_url='http://gfxmonk.net/dist/0install/python-termstyle/python-termstyle-0.1.10.tgz', - py_modules=['termstyle'], -classifiers=[ - "License :: OSI Approved :: BSD License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Intended Audience :: Developers", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - keywords='output colour console ansi', - license='BSD', -) diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/termstyle.py b/scripts/automation/trex_control_plane/python_lib/termstyle/termstyle.py deleted file mode 100755 index 62a3a920..00000000 --- a/scripts/automation/trex_control_plane/python_lib/termstyle/termstyle.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2009, Tim Cuthbertson -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of the organisation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY -# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -import sys - -class Style(object): - prefix='\x1b[' - suffix='m' - enabled = True - - def __init__(self, on_codes, off_codes = 0): - self._on = self.sequence(on_codes) - self._off = self.sequence(off_codes) - - def _get_on(self): return self._on if self.enabled else '' - def _get_off(self): return self._off if self.enabled else '' - on = property(_get_on) - off = property(_get_off) - - @classmethod - def sequence(cls, codes): - wrap_single = lambda code: "%s%s%s" % (cls.prefix, code, cls.suffix) - try: - return ''.join([wrap_single(code) for code in codes]) - except TypeError: - return wrap_single(codes) - - def __str__(self): - if not self.enabled: - return '' - return self.on - - def __call__(self, *args): - contents = ''.join(["%s%s" % (self.on, arg) for arg in args]) - return "%s%s" % (contents, self.off) - - -def auto(): - """set colouring on if STDOUT is a terminal device, off otherwise""" - try: - Style.enabled = False - Style.enabled = sys.stdout.isatty() - except (AttributeError, TypeError): - pass - -def enable(): - """force coloured output""" - Style.enabled = True - -def disable(): - """disable coloured output""" - Style.enabled = False - -default = reset = Style(0) - -black = Style(30) -red = Style(31) -green = Style(32) -yellow = Style(33) -blue = Style(34) -magenta = Style(35) -cyan = Style(36) -white = Style(37) - -bg_black = Style(40) -bg_red = Style(41) -bg_green = Style(42) -bg_yellow = Style(43) -bg_blue = Style(44) -bg_magenta = Style(45) -bg_cyan = Style(46) -bg_white = Style(47) -bg_default = Style(49) - -bold = Style(1) -underscore = Style(4) -inverted = Style(7) -italic = Style(3) - diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/test2.py b/scripts/automation/trex_control_plane/python_lib/termstyle/test2.py deleted file mode 100755 index 2d84c375..00000000 --- a/scripts/automation/trex_control_plane/python_lib/termstyle/test2.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python2 - -from termstyle import * - -print green(u"unicod\xe9!") diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/test3.py b/scripts/automation/trex_control_plane/python_lib/termstyle/test3.py deleted file mode 100755 index 861c44f9..00000000 --- a/scripts/automation/trex_control_plane/python_lib/termstyle/test3.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python3 - -from termstyle import * - -print(green("unicod\xe9!")) diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/test_all.sh b/scripts/automation/trex_control_plane/python_lib/termstyle/test_all.sh deleted file mode 100755 index d28545a9..00000000 --- a/scripts/automation/trex_control_plane/python_lib/termstyle/test_all.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -set -ex -./test2.py -./test3.py -- cgit