Projects
openEuler:Mainline
python-colorama
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
_service:tar_scm:python-colorama.spec
Changed
@@ -1,11 +1,11 @@ %global _empty_manifest_terminate_build 0 Name: python-colorama -Version: 0.4.4 +Version: 0.4.6 Release: 1 Summary: Cross-platform colored terminal text. License: BSD URL: https://github.com/tartley/colorama -Source0: https://files.pythonhosted.org/packages/1f/bb/5d3246097ab77fa083a61bd8d3d527b7ae063c7d8e8671b1cf8c4ec10cbe/colorama-0.4.4.tar.gz +Source0: https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz BuildArch: noarch %description Makes ANSI escape character sequences (for producing colored terminal @@ -14,69 +14,45 @@ %package -n python3-colorama Summary: Cross-platform colored terminal text. Provides: python-colorama +Obsoletes: python-colorama-help < 0.4.6 # Base build requires BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pbr BuildRequires: python3-pip -BuildRequires: python3-wheel -%description -n python3-colorama -Makes ANSI escape character sequences (for producing colored terminal -text and cursor positioning) work under MS Windows. +BuildRequires: python3-wheel python3-hatchling python3-hatch-vcs python3dist(pytest) -%package help -Summary: Cross-platform colored terminal text. -Provides: python3-colorama-doc -%description help +%description -n python3-colorama Makes ANSI escape character sequences (for producing colored terminal text and cursor positioning) work under MS Windows. %prep -%autosetup -n colorama-0.4.4 +%autosetup -n colorama-0.4.6 %build -%py3_build - +%pyproject_build %install -%py3_install +%pyproject_install colorama==%{version} install -d -m755 %{buildroot}/%{_pkgdocdir} if -d doc ; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if -d docs ; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if -d example ; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi -if -d examples ; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi -pushd %{buildroot} -if -d usr/lib ; then - find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst -fi -if -d usr/lib64 ; then - find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst -fi -if -d usr/bin ; then - find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst -fi -if -d usr/sbin ; then - find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst -fi -touch doclist.lst -if -d usr/share/man ; then - find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst -fi -popd -mv %{buildroot}/filelist.lst . -mv %{buildroot}/doclist.lst . %check -%{__python3} setup.py test +pytest -%files -n python3-colorama -f filelist.lst -%dir %{python3_sitelib}/* +%files -n python3-colorama +%{python3_sitelib}/* +%changelog +* Tue Apr 25 2023 wangkai <13474090681@163.com> - 0.4.6-1 +- Update to 0.4.6 +- Obsoletes python-colorama-help package -%files help -f doclist.lst -%{_docdir}/* +* Wed Sep 14 2022 Qiao Jijun <qiaojijun@kylinos.cn> - 0.4.5-1 +- Update to 0.4.5 -%changelog * Tue Jul 13 2021 OpenStack_SIG <openstack@openeuler.org> - 0.4.4-1 - Upgrade to version 0.4.4
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="scm">git</param> <param name="url">git@gitee.com:src-openeuler/python-colorama.git</param> - <param name="revision">51e5755a183eb1bca49703a3d3d7d0f1971bb2d7</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:colorama-0.4.4.tar.gz/.
Deleted
-(directory)
View file
_service:tar_scm:colorama-0.4.4.tar.gz/MANIFEST.in
Deleted
@@ -1,2 +0,0 @@ -include LICENSE.txt CHANGELOG.rst -recursive-include demos *.py *.bat *.sh
View file
_service:tar_scm:colorama-0.4.4.tar.gz/colorama
Deleted
-(directory)
View file
_service:tar_scm:colorama-0.4.4.tar.gz/colorama.egg-info
Deleted
-(directory)
View file
_service:tar_scm:colorama-0.4.4.tar.gz/colorama.egg-info/PKG-INFO
Deleted
@@ -1,433 +0,0 @@ -Metadata-Version: 1.2 -Name: colorama -Version: 0.4.4 -Summary: Cross-platform colored terminal text. -Home-page: https://github.com/tartley/colorama -Author: Jonathan Hartley -Author-email: tartley@tartley.com -Maintainer: Arnon Yaari -License: BSD -Description: .. image:: https://img.shields.io/pypi/v/colorama.svg - :target: https://pypi.org/project/colorama/ - :alt: Latest Version - - .. image:: https://img.shields.io/pypi/pyversions/colorama.svg - :target: https://pypi.org/project/colorama/ - :alt: Supported Python versions - - .. image:: https://travis-ci.org/tartley/colorama.svg?branch=master - :target: https://travis-ci.org/tartley/colorama - :alt: Build Status - - Colorama - ======== - - Makes ANSI escape character sequences (for producing colored terminal text and - cursor positioning) work under MS Windows. - - .. |donate| image:: https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif - :target: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2MZ9D2GMLYCUJ&item_name=Colorama¤cy_code=USD - :alt: Donate with Paypal - - `PyPI for releases <https://pypi.org/project/colorama/>`_ · - `Github for source <https://github.com/tartley/colorama>`_ · - `Colorama for enterprise on Tidelift <https://github.com/tartley/colorama/blob/master/ENTERPRISE.md>`_ - - If you find Colorama useful, please |donate| to the authors. Thank you! - - - Installation - ------------ - - .. code-block:: bash - - pip install colorama - # or - conda install -c anaconda colorama - - - Description - ----------- - - ANSI escape character sequences have long been used to produce colored terminal - text and cursor positioning on Unix and Macs. Colorama makes this work on - Windows, too, by wrapping ``stdout``, stripping ANSI sequences it finds (which - would appear as gobbledygook in the output), and converting them into the - appropriate win32 calls to modify the state of the terminal. On other platforms, - Colorama does nothing. - - This has the upshot of providing a simple cross-platform API for printing - colored terminal text from Python, and has the happy side-effect that existing - applications or libraries which use ANSI sequences to produce colored output on - Linux or Macs can now also work on Windows, simply by calling - ``colorama.init()``. - - An alternative approach is to install ``ansi.sys`` on Windows machines, which - provides the same behaviour for all applications running in terminals. Colorama - is intended for situations where that isn't easy (e.g., maybe your app doesn't - have an installer.) - - Demo scripts in the source code repository print some colored text using - ANSI sequences. Compare their output under Gnome-terminal's built in ANSI - handling, versus on Windows Command-Prompt using Colorama: - - .. image:: https://github.com/tartley/colorama/raw/master/screenshots/ubuntu-demo.png - :width: 661 - :height: 357 - :alt: ANSI sequences on Ubuntu under gnome-terminal. - - .. image:: https://github.com/tartley/colorama/raw/master/screenshots/windows-demo.png - :width: 668 - :height: 325 - :alt: Same ANSI sequences on Windows, using Colorama. - - These screenshots show that, on Windows, Colorama does not support ANSI 'dim - text'; it looks the same as 'normal text'. - - Usage - ----- - - Initialisation - .............. - - Applications should initialise Colorama using: - - .. code-block:: python - - from colorama import init - init() - - On Windows, calling ``init()`` will filter ANSI escape sequences out of any - text sent to ``stdout`` or ``stderr``, and replace them with equivalent Win32 - calls. - - On other platforms, calling ``init()`` has no effect (unless you request other - optional functionality; see "Init Keyword Args", below). By design, this permits - applications to call ``init()`` unconditionally on all platforms, after which - ANSI output should just work. - - To stop using Colorama before your program exits, simply call ``deinit()``. - This will restore ``stdout`` and ``stderr`` to their original values, so that - Colorama is disabled. To resume using Colorama again, call ``reinit()``; it is - cheaper than calling ``init()`` again (but does the same thing). - - - Colored Output - .............. - - Cross-platform printing of colored text can then be done using Colorama's - constant shorthand for ANSI escape sequences: - - .. code-block:: python - - from colorama import Fore, Back, Style - print(Fore.RED + 'some red text') - print(Back.GREEN + 'and with a green background') - print(Style.DIM + 'and in dim text') - print(Style.RESET_ALL) - print('back to normal now') - - ...or simply by manually printing ANSI sequences from your own code: - - .. code-block:: python - - print('\03331m' + 'some red text') - print('\03339m') # and reset to default color - - ...or, Colorama can be used in conjunction with existing ANSI libraries - such as the venerable `Termcolor <https://pypi.org/project/termcolor/>`_ - or the fabulous `Blessings <https://pypi.org/project/blessings/>`_. - This is highly recommended for anything more than trivial coloring: - - .. code-block:: python - - from colorama import init - from termcolor import colored - - # use Colorama to make Termcolor work on Windows too - init() - - # then use Termcolor for all colored text output - print(colored('Hello, World!', 'green', 'on_red')) - - Available formatting constants are:: - - Fore: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. - Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. - Style: DIM, NORMAL, BRIGHT, RESET_ALL - - ``Style.RESET_ALL`` resets foreground, background, and brightness. Colorama will - perform this reset automatically on program exit. - - - Cursor Positioning - .................. - - ANSI codes to reposition the cursor are supported. See ``demos/demo06.py`` for - an example of how to generate them. - - - Init Keyword Args - ................. - - ``init()`` accepts some ``**kwargs`` to override default behaviour. - - init(autoreset=False): - If you find yourself repeatedly sending reset sequences to turn off color - changes at the end of every print, then ``init(autoreset=True)`` will - automate that: - - .. code-block:: python - - from colorama import init - init(autoreset=True) - print(Fore.RED + 'some red text') - print('automatically back to default color again') - - init(strip=None): - Pass ``True`` or ``False`` to override whether ANSI codes should be - stripped from the output. The default behaviour is to strip if on Windows - or if output is redirected (not a tty). - - init(convert=None): - Pass ``True`` or ``False`` to override whether to convert ANSI codes in the - output into win32 calls. The default behaviour is to convert if on Windows - and output is to a tty (terminal). - - init(wrap=True): - On Windows, Colorama works by replacing ``sys.stdout`` and ``sys.stderr`` - with proxy objects, which override the ``.write()`` method to do their work.
View file
_service:tar_scm:colorama-0.4.4.tar.gz/colorama.egg-info/SOURCES.txt
Deleted
@@ -1,27 +0,0 @@ -CHANGELOG.rst -LICENSE.txt -MANIFEST.in -README.rst -setup.cfg -setup.py -colorama/__init__.py -colorama/ansi.py -colorama/ansitowin32.py -colorama/initialise.py -colorama/win32.py -colorama/winterm.py -colorama.egg-info/PKG-INFO -colorama.egg-info/SOURCES.txt -colorama.egg-info/dependency_links.txt -colorama.egg-info/top_level.txt -demos/demo.bat -demos/demo.sh -demos/demo01.py -demos/demo02.py -demos/demo03.py -demos/demo04.py -demos/demo05.py -demos/demo06.py -demos/demo07.py -demos/demo08.py -demos/fixpath.py \ No newline at end of file
View file
_service:tar_scm:colorama-0.4.4.tar.gz/colorama.egg-info/dependency_links.txt
Deleted
@@ -1,1 +0,0 @@ -
View file
_service:tar_scm:colorama-0.4.4.tar.gz/colorama.egg-info/top_level.txt
Deleted
@@ -1,1 +0,0 @@ -colorama
View file
_service:tar_scm:colorama-0.4.4.tar.gz/demos
Deleted
-(directory)
View file
_service:tar_scm:colorama-0.4.4.tar.gz/setup.cfg
Deleted
@@ -1,10 +0,0 @@ -bdist_wheel -universal = 1 - -metadata -license_file = LICENSE.txt - -egg_info -tag_build = -tag_date = 0 -
View file
_service:tar_scm:colorama-0.4.4.tar.gz/setup.py
Deleted
@@ -1,64 +0,0 @@ -#!/usr/bin/env python -# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. - -from __future__ import with_statement - -import os -import re -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - - -NAME = 'colorama' - - -def read_file(path): - with open(os.path.join(os.path.dirname(__file__), path)) as fp: - return fp.read() - -def _get_version_match(content): - # Search for lines of the form: # __version__ = 'ver' - regex = r"^__version__ = '\"(^'\"*)'\"" - version_match = re.search(regex, content, re.M) - if version_match: - return version_match.group(1) - raise RuntimeError("Unable to find version string.") - -def get_version(path): - return _get_version_match(read_file(path)) - -setup( - name=NAME, - version=get_version(os.path.join('colorama', '__init__.py')), - description='Cross-platform colored terminal text.', - long_description=read_file('README.rst'), - keywords='color colour terminal text ansi windows crossplatform xplatform', - author='Jonathan Hartley', - author_email='tartley@tartley.com', - maintainer='Arnon Yaari', - url='https://github.com/tartley/colorama', - license='BSD', - packages=NAME, - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', - # see classifiers https://pypi.org/pypi?%3Aaction=list_classifiers - classifiers= - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Terminals', - -)
View file
_service:tar_scm:colorama-0.4.6.tar.gz/.gitignore
Added
@@ -0,0 +1,13 @@ +*.pyc +*.egg-info +.coverage +.tox/ +/MANIFEST +/build/ +/dist/ +/sandbox/ +/tags +virtualenv + +# PyCharm +.idea
View file
_service:tar_scm:colorama-0.4.4.tar.gz/CHANGELOG.rst -> _service:tar_scm:colorama-0.4.6.tar.gz/CHANGELOG.rst
Changed
@@ -1,8 +1,46 @@ +0.4.6 Current release + * https://github.com/tartley/colorama/pull/139 Add alternative to 'init()', + called 'just_fix_windows_console'. This fixes many longstanding problems + with 'init', such as working incorrectly on modern Windows terminals, and + wonkiness when init gets called multiple times. The intention is that it + just makes all Windows terminals treat ANSI the same way as other terminals + do. Many thanks the njsmith for fixing our messes. + * https://github.com/tartley/colorama/pull/352 Support Windows 10's ANSI/VT + console. This didn't exist when Colorama was created, and avoiding us + causing havok there is long overdue. Thanks to segeviner for the initial + approach, and to njsmith for getting it merged. + * https://github.com/tartley/colorama/pull/338 Internal overhaul of package + metadata declaration, which abolishes our use of the now heavily + discouraged setuptools (and hence setup.py, setup.cfg and MANIFEST.in), in + favor of hatchling (and hence pyproject.toml), generously contributed by + ofek (author of hatchling). This includes dropping support Python3.5 and + 3.6, which are EOL, and were already dropped from setuptools, so this + should not affect our users. + * https://github.com/tartley/colorama/pull/353 Attention to detail award to + LqdBcnAtWork for a spelling fix in demo06 +0.4.5 + * Catch a racy ValueError that could occur on exit. + * Create README-hacking.md, for Colorama contributors. + * Tweak some README unicode characters that don't render correctly on PyPI. + * Fix some tests that were failing on some operating systems. + * Add support for Python 3.9. + * Add support for PyPy3. + * Add support for pickling with the ``dill`` module. +0.4.4 + * Re-org of README, to put the most insteresting parts near the top. + * Added Linux makefile targets and Windows powershell scripts to automate + bootstrapping a development environment, and automate the process of + testing wheels before they are uploaded to PyPI. + * Use stdlib unittest.mock where available + * Travis CI now also builds on arm64 + * Demo06 demonstrates existing cursor positioning feature + * Fix OSC regex & handling to prevent hang or crash + * Document enterprise support by Tidelift 0.4.3 * Fix release 0.4.2 which was uploaded with missing files. -0.4.2 - * #228: Drop support for EOL Python 3.4, and add 3.7 and 3.8. - Thanks to hugovk. +0.4.2 BROKEN DO NOT USE + * #228: Drop support for EOL Python 3.4, and add 3.7 and 3.8. Thanks to + hugovk. * Several additions and fixes to documentation and metadata. * Added Tidelift subscription information. 0.4.1 @@ -11,18 +49,18 @@ 0.4.0 * Fix issue #142: reset LIGHT_EX colors with RESET_ALL. Reported by Delgan * Fix issue #147: ignore invalid "erase" ANSI codes. Reported by shin- - * Fix issues #163 and #164: fix stream wrapping under PyCharm. Contributed - by veleek and Delgan. + * Fix issues #163 and #164: fix stream wrapping under PyCharm. Contributed by + veleek and Delgan. * Thanks to jdufresne for various code cleanup and updates to documentation - and project metadata. - (pull requests #171, #172, #173, #174, #176, #177, #189, #190, #192) + and project metadata. (pull requests #171, #172, #173, #174, #176, #177, + #189, #190, #192) * #186: added contextlib magic methods to ansitowin32.StreamWrapper. Contributed by hoefling. * Fix issue #131: don't cache stdio handles, since they might be closed/changed by fd redirection. This fixes an issue with pytest. Contributed by segevfiner. - * #146, #157: Drop support for EOL Python 2.5, 2.6, 3.1, 3.2 and 3.3, - and add 3.6. Thanks to hugovk. + * #146, #157: Drop support for EOL Python 2.5, 2.6, 3.1, 3.2 and 3.3, and add + 3.6. Thanks to hugovk. 0.3.9 * Revert fix for issue #103 which causes problems for dependent applications 0.3.8 @@ -41,11 +79,11 @@ * Fix issue #47 and #80 - stream redirection now strips ANSI codes on Linux * Fix issue #53 - strip readline markers * Fix issue #32 - assign orig_stdout and orig_stderr when initialising - * Fix issue #57 - Fore.RESET did not reset style of LIGHT_EX colors. - Fixed by Andy Neff + * Fix issue #57 - Fore.RESET did not reset style of LIGHT_EX colors. Fixed by + Andy Neff * Fix issue #51 - add context manager syntax. Thanks to Matt Olsen. - * Fix issue #48 - colorama didn't work on Windows when environment - variable 'TERM' was set. + * Fix issue #48 - colorama didn't work on Windows when environment variable + 'TERM' was set. * Fix issue #54 - fix pylint errors in client code. * Changes to readme and other improvements by Marc Abramowitz and Zearin 0.3.3 @@ -67,8 +105,8 @@ * Thanks to Charles Merriam for adding documentation to demos 0.3.2 * Thanks to Marc Schlaich (schlamar) for a setup.py fix for Python2.5 - * Thanks to Jurko for fix on 64-bit Windows CPython2.5 w/o ctypes - (Google Code issue #56) + * Thanks to Jurko for fix on 64-bit Windows CPython2.5 w/o ctypes (Google + Code issue #56) * Thanks to Remi Rampin for: * better github integration, incl rendered README and Travis config. * fixed forward slashes in README @@ -76,8 +114,8 @@ * Thanks to Simeon Visser for: * closing a file handle using 'with' * updating classifiers to include Python 3.3 and 3.4 - * Thanks to Thomas Weininger for fix ValueError on Windows - (Google Code issue #50) + * Thanks to Thomas Weininger for fix ValueError on Windows (Google Code issue + #50) 0.3.1 * Fixed crash on exit with closed stdout, with thanks to Marc Abramowitz. * Now uses setuptools if available, and falls back to distutils if not. @@ -89,9 +127,8 @@ * Fix always-crash on non-Windows platforms, reported by Matt McCormick. * Fix Google Code issue #47, incompatible with pyreadline. 0.2.7 - * Fix problem under 64-bit windows due to ctypes HANDLE size. - Submitted by the rather magnificent Ben Hoyt. - This fixes Google Code issue #43 + * Fix problem under 64-bit windows due to ctypes HANDLE size. Submitted by + the rather magnificent Ben Hoyt. This fixes Google Code issue #43 0.2.6 * Add copyright & licensing info to every file, as requested by a large downstream project which has problems making sure that all 3rd party @@ -106,9 +143,9 @@ * Split changelog out into separate file. 0.2.2 * Fix bug which caused init() to raise, introduced in 0.2.1. - * Remove asserts which cause problems in various circumstances. At least - some users saw asserts fail on 'success' returned from win32 functions, - even though the win32 functions appear to have worked correctly. + * Remove asserts which cause problems in various circumstances. At least some + users saw asserts fail on 'success' returned from win32 functions, even + though the win32 functions appear to have worked correctly. 0.2.1 * Completely broken: I added a bug which caused init() to raise. * Added some documentation for cursor positioning and clear screen to README. @@ -132,9 +169,9 @@ file from building on a different platform. * Fix python3 incompatibility kindly reported by G |uumlaut| nter Kolousek 0.1.14 - * Fix hard-coded reset to white-on-black colors. Fore.RESET, Back.RESET - and Style.RESET_ALL now revert to the colors as they were when init() - was called. Some lessons hopefully learned about testing prior to release. + * Fix hard-coded reset to white-on-black colors. Fore.RESET, Back.RESET and + Style.RESET_ALL now revert to the colors as they were when init() was + called. Some lessons hopefully learned about testing prior to release. 0.1.13 * Completely broken: barfed when installed using pip. 0.1.12 @@ -150,11 +187,11 @@ * Remove setup.py dependency on setuptools, now uses stdlib distutils. 0.1.8 * Fix ghastly errors all over the place on Ubuntu. - * Add init kwargs 'convert' and 'strip', which supercede the old 'wrap'. + * Add init kwargs 'convert' and 'strip', which supersede the old 'wrap'. 0.1.7 * Python 3 compatible. - * Fix: Now strips ansi on windows without necessarily converting it to - win32 calls (eg. if output is not a tty.) + * Fix: Now strips ansi on windows without necessarily converting it to win32 + calls (eg. if output is not a tty.) * Fix: Flaky interaction of interleaved ansi sent to stdout and stderr. * Improved demo.sh (hg checkout only.) 0.1.6
View file
_service:tar_scm:colorama-0.4.4.tar.gz/PKG-INFO -> _service:tar_scm:colorama-0.4.6.tar.gz/PKG-INFO
Changed
@@ -1,419 +1,11 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: colorama -Version: 0.4.4 +Version: 0.4.6 Summary: Cross-platform colored terminal text. -Home-page: https://github.com/tartley/colorama -Author: Jonathan Hartley -Author-email: tartley@tartley.com -Maintainer: Arnon Yaari -License: BSD -Description: .. image:: https://img.shields.io/pypi/v/colorama.svg - :target: https://pypi.org/project/colorama/ - :alt: Latest Version - - .. image:: https://img.shields.io/pypi/pyversions/colorama.svg - :target: https://pypi.org/project/colorama/ - :alt: Supported Python versions - - .. image:: https://travis-ci.org/tartley/colorama.svg?branch=master - :target: https://travis-ci.org/tartley/colorama - :alt: Build Status - - Colorama - ======== - - Makes ANSI escape character sequences (for producing colored terminal text and - cursor positioning) work under MS Windows. - - .. |donate| image:: https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif - :target: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2MZ9D2GMLYCUJ&item_name=Colorama¤cy_code=USD - :alt: Donate with Paypal - - `PyPI for releases <https://pypi.org/project/colorama/>`_ · - `Github for source <https://github.com/tartley/colorama>`_ · - `Colorama for enterprise on Tidelift <https://github.com/tartley/colorama/blob/master/ENTERPRISE.md>`_ - - If you find Colorama useful, please |donate| to the authors. Thank you! - - - Installation - ------------ - - .. code-block:: bash - - pip install colorama - # or - conda install -c anaconda colorama - - - Description - ----------- - - ANSI escape character sequences have long been used to produce colored terminal - text and cursor positioning on Unix and Macs. Colorama makes this work on - Windows, too, by wrapping ``stdout``, stripping ANSI sequences it finds (which - would appear as gobbledygook in the output), and converting them into the - appropriate win32 calls to modify the state of the terminal. On other platforms, - Colorama does nothing. - - This has the upshot of providing a simple cross-platform API for printing - colored terminal text from Python, and has the happy side-effect that existing - applications or libraries which use ANSI sequences to produce colored output on - Linux or Macs can now also work on Windows, simply by calling - ``colorama.init()``. - - An alternative approach is to install ``ansi.sys`` on Windows machines, which - provides the same behaviour for all applications running in terminals. Colorama - is intended for situations where that isn't easy (e.g., maybe your app doesn't - have an installer.) - - Demo scripts in the source code repository print some colored text using - ANSI sequences. Compare their output under Gnome-terminal's built in ANSI - handling, versus on Windows Command-Prompt using Colorama: - - .. image:: https://github.com/tartley/colorama/raw/master/screenshots/ubuntu-demo.png - :width: 661 - :height: 357 - :alt: ANSI sequences on Ubuntu under gnome-terminal. - - .. image:: https://github.com/tartley/colorama/raw/master/screenshots/windows-demo.png - :width: 668 - :height: 325 - :alt: Same ANSI sequences on Windows, using Colorama. - - These screenshots show that, on Windows, Colorama does not support ANSI 'dim - text'; it looks the same as 'normal text'. - - Usage - ----- - - Initialisation - .............. - - Applications should initialise Colorama using: - - .. code-block:: python - - from colorama import init - init() - - On Windows, calling ``init()`` will filter ANSI escape sequences out of any - text sent to ``stdout`` or ``stderr``, and replace them with equivalent Win32 - calls. - - On other platforms, calling ``init()`` has no effect (unless you request other - optional functionality; see "Init Keyword Args", below). By design, this permits - applications to call ``init()`` unconditionally on all platforms, after which - ANSI output should just work. - - To stop using Colorama before your program exits, simply call ``deinit()``. - This will restore ``stdout`` and ``stderr`` to their original values, so that - Colorama is disabled. To resume using Colorama again, call ``reinit()``; it is - cheaper than calling ``init()`` again (but does the same thing). - - - Colored Output - .............. - - Cross-platform printing of colored text can then be done using Colorama's - constant shorthand for ANSI escape sequences: - - .. code-block:: python - - from colorama import Fore, Back, Style - print(Fore.RED + 'some red text') - print(Back.GREEN + 'and with a green background') - print(Style.DIM + 'and in dim text') - print(Style.RESET_ALL) - print('back to normal now') - - ...or simply by manually printing ANSI sequences from your own code: - - .. code-block:: python - - print('\03331m' + 'some red text') - print('\03339m') # and reset to default color - - ...or, Colorama can be used in conjunction with existing ANSI libraries - such as the venerable `Termcolor <https://pypi.org/project/termcolor/>`_ - or the fabulous `Blessings <https://pypi.org/project/blessings/>`_. - This is highly recommended for anything more than trivial coloring: - - .. code-block:: python - - from colorama import init - from termcolor import colored - - # use Colorama to make Termcolor work on Windows too - init() - - # then use Termcolor for all colored text output - print(colored('Hello, World!', 'green', 'on_red')) - - Available formatting constants are:: - - Fore: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. - Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. - Style: DIM, NORMAL, BRIGHT, RESET_ALL - - ``Style.RESET_ALL`` resets foreground, background, and brightness. Colorama will - perform this reset automatically on program exit. - - - Cursor Positioning - .................. - - ANSI codes to reposition the cursor are supported. See ``demos/demo06.py`` for - an example of how to generate them. - - - Init Keyword Args - ................. - - ``init()`` accepts some ``**kwargs`` to override default behaviour. - - init(autoreset=False): - If you find yourself repeatedly sending reset sequences to turn off color - changes at the end of every print, then ``init(autoreset=True)`` will - automate that: - - .. code-block:: python - - from colorama import init - init(autoreset=True) - print(Fore.RED + 'some red text') - print('automatically back to default color again') - - init(strip=None): - Pass ``True`` or ``False`` to override whether ANSI codes should be - stripped from the output. The default behaviour is to strip if on Windows - or if output is redirected (not a tty). - - init(convert=None): - Pass ``True`` or ``False`` to override whether to convert ANSI codes in the - output into win32 calls. The default behaviour is to convert if on Windows - and output is to a tty (terminal). - - init(wrap=True):
View file
_service:tar_scm:colorama-0.4.4.tar.gz/README.rst -> _service:tar_scm:colorama-0.4.6.tar.gz/README.rst
Changed
@@ -6,8 +6,8 @@ :target: https://pypi.org/project/colorama/ :alt: Supported Python versions -.. image:: https://travis-ci.org/tartley/colorama.svg?branch=master - :target: https://travis-ci.org/tartley/colorama +.. image:: https://github.com/tartley/colorama/actions/workflows/test.yml/badge.svg + :target: https://github.com/tartley/colorama/actions/workflows/test.yml :alt: Build Status Colorama @@ -20,23 +20,25 @@ :target: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2MZ9D2GMLYCUJ&item_name=Colorama¤cy_code=USD :alt: Donate with Paypal -`PyPI for releases <https://pypi.org/project/colorama/>`_ · -`Github for source <https://github.com/tartley/colorama>`_ · +`PyPI for releases <https://pypi.org/project/colorama/>`_ | +`Github for source <https://github.com/tartley/colorama>`_ | `Colorama for enterprise on Tidelift <https://github.com/tartley/colorama/blob/master/ENTERPRISE.md>`_ If you find Colorama useful, please |donate| to the authors. Thank you! - Installation ------------ +Tested on CPython 2.7, 3.7, 3.8, 3.9 and 3.10 and Pypy 2.7 and 3.8. + +No requirements other than the standard library. + .. code-block:: bash pip install colorama # or conda install -c anaconda colorama - Description ----------- @@ -51,7 +53,8 @@ colored terminal text from Python, and has the happy side-effect that existing applications or libraries which use ANSI sequences to produce colored output on Linux or Macs can now also work on Windows, simply by calling -``colorama.init()``. +``colorama.just_fix_windows_console()`` (since v0.4.6) or ``colorama.init()`` +(all versions, but may have other side-effects – see below). An alternative approach is to install ``ansi.sys`` on Windows machines, which provides the same behaviour for all applications running in terminals. Colorama @@ -81,33 +84,72 @@ Initialisation .............. -Applications should initialise Colorama using: +If the only thing you want from Colorama is to get ANSI escapes to work on +Windows, then run: + +.. code-block:: python + + from colorama import just_fix_windows_console + just_fix_windows_console() + +If you're on a recent version of Windows 10 or better, and your stdout/stderr +are pointing to a Windows console, then this will flip the magic configuration +switch to enable Windows' built-in ANSI support. + +If you're on an older version of Windows, and your stdout/stderr are pointing to +a Windows console, then this will wrap ``sys.stdout`` and/or ``sys.stderr`` in a +magic file object that intercepts ANSI escape sequences and issues the +appropriate Win32 calls to emulate them. + +In all other circumstances, it does nothing whatsoever. Basically the idea is +that this makes Windows act like Unix with respect to ANSI escape handling. + +It's safe to call this function multiple times. It's safe to call this function +on non-Windows platforms, but it won't do anything. It's safe to call this +function when one or both of your stdout/stderr are redirected to a file – it +won't do anything to those streams. + +Alternatively, you can use the older interface with more features (but also more +potential footguns): .. code-block:: python from colorama import init init() -On Windows, calling ``init()`` will filter ANSI escape sequences out of any -text sent to ``stdout`` or ``stderr``, and replace them with equivalent Win32 -calls. +This does the same thing as ``just_fix_windows_console``, except for the +following differences: + +- It's not safe to call ``init`` multiple times; you can end up with multiple + layers of wrapping and broken ANSI support. + +- Colorama will apply a heuristic to guess whether stdout/stderr support ANSI, + and if it thinks they don't, then it will wrap ``sys.stdout`` and + ``sys.stderr`` in a magic file object that strips out ANSI escape sequences + before printing them. This happens on all platforms, and can be convenient if + you want to write your code to emit ANSI escape sequences unconditionally, and + let Colorama decide whether they should actually be output. But note that + Colorama's heuristic is not particularly clever. -On other platforms, calling ``init()`` has no effect (unless you request other -optional functionality; see "Init Keyword Args", below). By design, this permits -applications to call ``init()`` unconditionally on all platforms, after which -ANSI output should just work. +- ``init`` also accepts explicit keyword args to enable/disable various + functionality – see below. To stop using Colorama before your program exits, simply call ``deinit()``. This will restore ``stdout`` and ``stderr`` to their original values, so that Colorama is disabled. To resume using Colorama again, call ``reinit()``; it is cheaper than calling ``init()`` again (but does the same thing). +Most users should depend on ``colorama >= 0.4.6``, and use +``just_fix_windows_console``. The old ``init`` interface will be supported +indefinitely for backwards compatibility, but we don't plan to fix any issues +with it, also for backwards compatibility. Colored Output .............. Cross-platform printing of colored text can then be done using Colorama's -constant shorthand for ANSI escape sequences: +constant shorthand for ANSI escape sequences. These are deliberately +rudimentary, see below. .. code-block:: python @@ -127,16 +169,25 @@ ...or, Colorama can be used in conjunction with existing ANSI libraries such as the venerable `Termcolor <https://pypi.org/project/termcolor/>`_ -or the fabulous `Blessings <https://pypi.org/project/blessings/>`_. -This is highly recommended for anything more than trivial coloring: +the fabulous `Blessings <https://pypi.org/project/blessings/>`_, +or the incredible `_Rich <https://pypi.org/project/rich/>`_. + +If you wish Colorama's Fore, Back and Style constants were more capable, +then consider using one of the above highly capable libraries to generate +colors, etc, and use Colorama just for its primary purpose: to convert +those ANSI sequences to also work on Windows: + +SIMILARLY, do not send PRs adding the generation of new ANSI types to Colorama. +We are only interested in converting ANSI codes to win32 API calls, not +shortcuts like the above to generate ANSI characters. .. code-block:: python - from colorama import init + from colorama import just_fix_windows_console from termcolor import colored # use Colorama to make Termcolor work on Windows too - init() + just_fix_windows_console() # then use Termcolor for all colored text output print(colored('Hello, World!', 'green', 'on_red')) @@ -150,6 +201,10 @@ ``Style.RESET_ALL`` resets foreground, background, and brightness. Colorama will perform this reset automatically on program exit. +These are fairly well supported, but not part of the standard:: + + Fore: LIGHTBLACK_EX, LIGHTRED_EX, LIGHTGREEN_EX, LIGHTYELLOW_EX, LIGHTBLUE_EX, LIGHTMAGENTA_EX, LIGHTCYAN_EX, LIGHTWHITE_EX + Back: LIGHTBLACK_EX, LIGHTRED_EX, LIGHTGREEN_EX, LIGHTYELLOW_EX, LIGHTBLUE_EX, LIGHTMAGENTA_EX, LIGHTCYAN_EX, LIGHTWHITE_EX Cursor Positioning .................. @@ -157,7 +212,6 @@ ANSI codes to reposition the cursor are supported. See ``demos/demo06.py`` for an example of how to generate them. - Init Keyword Args ................. @@ -209,7 +263,6 @@ # Python 3 print(Fore.BLUE + 'blue text on stderr', file=stream) - Recognised ANSI Sequences ......................... @@ -278,15 +331,17 @@ them though. Let me know if it would be useful for you, via the Issues on GitHub. - Status & Known Problems ----------------------- I've personally only tested it on Windows XP (CMD, Console2), Ubuntu (gnome-terminal, xterm), and OS X.
View file
_service:tar_scm:colorama-0.4.4.tar.gz/colorama/__init__.py -> _service:tar_scm:colorama-0.4.6.tar.gz/colorama/__init__.py
Changed
@@ -1,6 +1,7 @@ # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. -from .initialise import init, deinit, reinit, colorama_text +from .initialise import init, deinit, reinit, colorama_text, just_fix_windows_console from .ansi import Fore, Back, Style, Cursor from .ansitowin32 import AnsiToWin32 -__version__ = '0.4.4' +__version__ = '0.4.6' +
View file
_service:tar_scm:colorama-0.4.4.tar.gz/colorama/ansitowin32.py -> _service:tar_scm:colorama-0.4.6.tar.gz/colorama/ansitowin32.py
Changed
@@ -4,7 +4,7 @@ import os from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style, BEL -from .winterm import WinTerm, WinColor, WinStyle +from .winterm import enable_vt_processing, WinTerm, WinColor, WinStyle from .win32 import windll, winapi_test @@ -37,6 +37,12 @@ def __exit__(self, *args, **kwargs): return self.__wrapped.__exit__(*args, **kwargs) + def __setstate__(self, state): + self.__dict__ = state + + def __getstate__(self): + return self.__dict__ + def write(self, text): self.__convertor.write(text) @@ -57,7 +63,9 @@ stream = self.__wrapped try: return stream.closed - except AttributeError: + # AttributeError in the case that the stream doesn't support being closed + # ValueError for the case that the stream has already been detached when atexit runs + except (AttributeError, ValueError): return True @@ -86,15 +94,22 @@ # (e.g. Cygwin Terminal). In this case it's up to the terminal # to support the ANSI codes. conversion_supported = on_windows and winapi_test() + try: + fd = wrapped.fileno() + except Exception: + fd = -1 + system_has_native_ansi = not on_windows or enable_vt_processing(fd) + have_tty = not self.stream.closed and self.stream.isatty() + need_conversion = conversion_supported and not system_has_native_ansi # should we strip ANSI sequences from our output? if strip is None: - strip = conversion_supported or (not self.stream.closed and not self.stream.isatty()) + strip = need_conversion or not have_tty self.strip = strip # should we should convert ANSI sequences into win32 calls? if convert is None: - convert = conversion_supported and not self.stream.closed and self.stream.isatty() + convert = need_conversion and have_tty self.convert = convert # dict of ansi codes to win32 functions and parameters @@ -256,3 +271,7 @@ if params0 in '02': winterm.set_title(params1) return text + + + def flush(self): + self.wrapped.flush()
View file
_service:tar_scm:colorama-0.4.4.tar.gz/colorama/initialise.py -> _service:tar_scm:colorama-0.4.6.tar.gz/colorama/initialise.py
Changed
@@ -6,13 +6,27 @@ from .ansitowin32 import AnsiToWin32 -orig_stdout = None -orig_stderr = None +def _wipe_internal_state_for_tests(): + global orig_stdout, orig_stderr + orig_stdout = None + orig_stderr = None + + global wrapped_stdout, wrapped_stderr + wrapped_stdout = None + wrapped_stderr = None -wrapped_stdout = None -wrapped_stderr = None + global atexit_done + atexit_done = False + + global fixed_windows_console + fixed_windows_console = False -atexit_done = False + try: + # no-op if it wasn't registered + atexit.unregister(reset_all) + except AttributeError: + # python 2: no atexit.unregister. Oh well, we did our best. + pass def reset_all(): @@ -55,6 +69,29 @@ sys.stderr = orig_stderr +def just_fix_windows_console(): + global fixed_windows_console + + if sys.platform != "win32": + return + if fixed_windows_console: + return + if wrapped_stdout is not None or wrapped_stderr is not None: + # Someone already ran init() and it did stuff, so we won't second-guess them + return + + # On newer versions of Windows, AnsiToWin32.__init__ will implicitly enable the + # native ANSI support in the console as a side-effect. We only need to actually + # replace sys.stdout/stderr if we're in the old-style conversion mode. + new_stdout = AnsiToWin32(sys.stdout, convert=None, strip=None, autoreset=False) + if new_stdout.convert: + sys.stdout = new_stdout + new_stderr = AnsiToWin32(sys.stderr, convert=None, strip=None, autoreset=False) + if new_stderr.convert: + sys.stderr = new_stderr + + fixed_windows_console = True + @contextlib.contextmanager def colorama_text(*args, **kwargs): init(*args, **kwargs) @@ -78,3 +115,7 @@ if wrapper.should_wrap(): stream = wrapper.stream return stream + + +# Use this for initial setup as well, to reduce code duplication +_wipe_internal_state_for_tests()
View file
_service:tar_scm:colorama-0.4.6.tar.gz/colorama/tests/__init__.py
Added
@@ -0,0 +1,1 @@ +# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
View file
_service:tar_scm:colorama-0.4.6.tar.gz/colorama/tests/ansi_test.py
Added
@@ -0,0 +1,76 @@ +# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. +import sys +from unittest import TestCase, main + +from ..ansi import Back, Fore, Style +from ..ansitowin32 import AnsiToWin32 + +stdout_orig = sys.stdout +stderr_orig = sys.stderr + + +class AnsiTest(TestCase): + + def setUp(self): + # sanity check: stdout should be a file or StringIO object. + # It will only be AnsiToWin32 if init() has previously wrapped it + self.assertNotEqual(type(sys.stdout), AnsiToWin32) + self.assertNotEqual(type(sys.stderr), AnsiToWin32) + + def tearDown(self): + sys.stdout = stdout_orig + sys.stderr = stderr_orig + + + def testForeAttributes(self): + self.assertEqual(Fore.BLACK, '\03330m') + self.assertEqual(Fore.RED, '\03331m') + self.assertEqual(Fore.GREEN, '\03332m') + self.assertEqual(Fore.YELLOW, '\03333m') + self.assertEqual(Fore.BLUE, '\03334m') + self.assertEqual(Fore.MAGENTA, '\03335m') + self.assertEqual(Fore.CYAN, '\03336m') + self.assertEqual(Fore.WHITE, '\03337m') + self.assertEqual(Fore.RESET, '\03339m') + + # Check the light, extended versions. + self.assertEqual(Fore.LIGHTBLACK_EX, '\03390m') + self.assertEqual(Fore.LIGHTRED_EX, '\03391m') + self.assertEqual(Fore.LIGHTGREEN_EX, '\03392m') + self.assertEqual(Fore.LIGHTYELLOW_EX, '\03393m') + self.assertEqual(Fore.LIGHTBLUE_EX, '\03394m') + self.assertEqual(Fore.LIGHTMAGENTA_EX, '\03395m') + self.assertEqual(Fore.LIGHTCYAN_EX, '\03396m') + self.assertEqual(Fore.LIGHTWHITE_EX, '\03397m') + + + def testBackAttributes(self): + self.assertEqual(Back.BLACK, '\03340m') + self.assertEqual(Back.RED, '\03341m') + self.assertEqual(Back.GREEN, '\03342m') + self.assertEqual(Back.YELLOW, '\03343m') + self.assertEqual(Back.BLUE, '\03344m') + self.assertEqual(Back.MAGENTA, '\03345m') + self.assertEqual(Back.CYAN, '\03346m') + self.assertEqual(Back.WHITE, '\03347m') + self.assertEqual(Back.RESET, '\03349m') + + # Check the light, extended versions. + self.assertEqual(Back.LIGHTBLACK_EX, '\033100m') + self.assertEqual(Back.LIGHTRED_EX, '\033101m') + self.assertEqual(Back.LIGHTGREEN_EX, '\033102m') + self.assertEqual(Back.LIGHTYELLOW_EX, '\033103m') + self.assertEqual(Back.LIGHTBLUE_EX, '\033104m') + self.assertEqual(Back.LIGHTMAGENTA_EX, '\033105m') + self.assertEqual(Back.LIGHTCYAN_EX, '\033106m') + self.assertEqual(Back.LIGHTWHITE_EX, '\033107m') + + + def testStyleAttributes(self): + self.assertEqual(Style.DIM, '\0332m') + self.assertEqual(Style.NORMAL, '\03322m') + self.assertEqual(Style.BRIGHT, '\0331m') + + +if __name__ == '__main__': + main()
View file
_service:tar_scm:colorama-0.4.6.tar.gz/colorama/tests/ansitowin32_test.py
Added
@@ -0,0 +1,294 @@ +# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. +from io import StringIO, TextIOWrapper +from unittest import TestCase, main +try: + from contextlib import ExitStack +except ImportError: + # python 2 + from contextlib2 import ExitStack + +try: + from unittest.mock import MagicMock, Mock, patch +except ImportError: + from mock import MagicMock, Mock, patch + +from ..ansitowin32 import AnsiToWin32, StreamWrapper +from ..win32 import ENABLE_VIRTUAL_TERMINAL_PROCESSING +from .utils import osname + + +class StreamWrapperTest(TestCase): + + def testIsAProxy(self): + mockStream = Mock() + wrapper = StreamWrapper(mockStream, None) + self.assertTrue( wrapper.random_attr is mockStream.random_attr ) + + def testDelegatesWrite(self): + mockStream = Mock() + mockConverter = Mock() + wrapper = StreamWrapper(mockStream, mockConverter) + wrapper.write('hello') + self.assertTrue(mockConverter.write.call_args, (('hello',), {})) + + def testDelegatesContext(self): + mockConverter = Mock() + s = StringIO() + with StreamWrapper(s, mockConverter) as fp: + fp.write(u'hello') + self.assertTrue(s.closed) + + def testProxyNoContextManager(self): + mockStream = MagicMock() + mockStream.__enter__.side_effect = AttributeError() + mockConverter = Mock() + with self.assertRaises(AttributeError) as excinfo: + with StreamWrapper(mockStream, mockConverter) as wrapper: + wrapper.write('hello') + + def test_closed_shouldnt_raise_on_closed_stream(self): + stream = StringIO() + stream.close() + wrapper = StreamWrapper(stream, None) + self.assertEqual(wrapper.closed, True) + + def test_closed_shouldnt_raise_on_detached_stream(self): + stream = TextIOWrapper(StringIO()) + stream.detach() + wrapper = StreamWrapper(stream, None) + self.assertEqual(wrapper.closed, True) + +class AnsiToWin32Test(TestCase): + + def testInit(self): + mockStdout = Mock() + auto = Mock() + stream = AnsiToWin32(mockStdout, autoreset=auto) + self.assertEqual(stream.wrapped, mockStdout) + self.assertEqual(stream.autoreset, auto) + + @patch('colorama.ansitowin32.winterm', None) + @patch('colorama.ansitowin32.winapi_test', lambda *_: True) + def testStripIsTrueOnWindows(self): + with osname('nt'): + mockStdout = Mock() + stream = AnsiToWin32(mockStdout) + self.assertTrue(stream.strip) + + def testStripIsFalseOffWindows(self): + with osname('posix'): + mockStdout = Mock(closed=False) + stream = AnsiToWin32(mockStdout) + self.assertFalse(stream.strip) + + def testWriteStripsAnsi(self): + mockStdout = Mock() + stream = AnsiToWin32(mockStdout) + stream.wrapped = Mock() + stream.write_and_convert = Mock() + stream.strip = True + + stream.write('abc') + + self.assertFalse(stream.wrapped.write.called) + self.assertEqual(stream.write_and_convert.call_args, (('abc',), {})) + + def testWriteDoesNotStripAnsi(self): + mockStdout = Mock() + stream = AnsiToWin32(mockStdout) + stream.wrapped = Mock() + stream.write_and_convert = Mock() + stream.strip = False + stream.convert = False + + stream.write('abc') + + self.assertFalse(stream.write_and_convert.called) + self.assertEqual(stream.wrapped.write.call_args, (('abc',), {})) + + def assert_autoresets(self, convert, autoreset=True): + stream = AnsiToWin32(Mock()) + stream.convert = convert + stream.reset_all = Mock() + stream.autoreset = autoreset + stream.winterm = Mock() + + stream.write('abc') + + self.assertEqual(stream.reset_all.called, autoreset) + + def testWriteAutoresets(self): + self.assert_autoresets(convert=True) + self.assert_autoresets(convert=False) + self.assert_autoresets(convert=True, autoreset=False) + self.assert_autoresets(convert=False, autoreset=False) + + def testWriteAndConvertWritesPlainText(self): + stream = AnsiToWin32(Mock()) + stream.write_and_convert( 'abc' ) + self.assertEqual( stream.wrapped.write.call_args, (('abc',), {}) ) + + def testWriteAndConvertStripsAllValidAnsi(self): + stream = AnsiToWin32(Mock()) + stream.call_win32 = Mock() + data = + 'abc\033mdef', + 'abc\0330mdef', + 'abc\0332mdef', + 'abc\03302mdef', + 'abc\033002mdef', + 'abc\03340mdef', + 'abc\033040mdef', + 'abc\0330;1mdef', + 'abc\03340;50mdef', + 'abc\03350;30;40mdef', + 'abc\033Adef', + 'abc\0330Gdef', + 'abc\0331;20;128Hdef', + + for datum in data: + stream.wrapped.write.reset_mock() + stream.write_and_convert( datum ) + self.assertEqual( + args0 for args in stream.wrapped.write.call_args_list, + ('abc',), ('def',) + ) + + def testWriteAndConvertSkipsEmptySnippets(self): + stream = AnsiToWin32(Mock()) + stream.call_win32 = Mock() + stream.write_and_convert( '\03340m\03341m' ) + self.assertFalse( stream.wrapped.write.called ) + + def testWriteAndConvertCallsWin32WithParamsAndCommand(self): + stream = AnsiToWin32(Mock()) + stream.convert = True + stream.call_win32 = Mock() + stream.extract_params = Mock(return_value='params') + data = { + 'abc\033adef': ('a', 'params'), + 'abc\033;;bdef': ('b', 'params'), + 'abc\0330cdef': ('c', 'params'), + 'abc\033;;0;;Gdef': ('G', 'params'), + 'abc\0331;20;128Hdef': ('H', 'params'), + } + for datum, expected in data.items(): + stream.call_win32.reset_mock() + stream.write_and_convert( datum ) + self.assertEqual( stream.call_win32.call_args0, expected ) + + def test_reset_all_shouldnt_raise_on_closed_orig_stdout(self): + stream = StringIO() + converter = AnsiToWin32(stream) + stream.close() + + converter.reset_all() + + def test_wrap_shouldnt_raise_on_closed_orig_stdout(self): + stream = StringIO() + stream.close() + with \ + patch("colorama.ansitowin32.os.name", "nt"), \ + patch("colorama.ansitowin32.winapi_test", lambda: True): + converter = AnsiToWin32(stream) + self.assertTrue(converter.strip) + self.assertFalse(converter.convert) + + def test_wrap_shouldnt_raise_on_missing_closed_attr(self): + with \ + patch("colorama.ansitowin32.os.name", "nt"), \
View file
_service:tar_scm:colorama-0.4.6.tar.gz/colorama/tests/initialise_test.py
Added
@@ -0,0 +1,189 @@ +# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. +import sys +from unittest import TestCase, main, skipUnless + +try: + from unittest.mock import patch, Mock +except ImportError: + from mock import patch, Mock + +from ..ansitowin32 import StreamWrapper +from ..initialise import init, just_fix_windows_console, _wipe_internal_state_for_tests +from .utils import osname, replace_by + +orig_stdout = sys.stdout +orig_stderr = sys.stderr + + +class InitTest(TestCase): + + @skipUnless(sys.stdout.isatty(), "sys.stdout is not a tty") + def setUp(self): + # sanity check + self.assertNotWrapped() + + def tearDown(self): + _wipe_internal_state_for_tests() + sys.stdout = orig_stdout + sys.stderr = orig_stderr + + def assertWrapped(self): + self.assertIsNot(sys.stdout, orig_stdout, 'stdout should be wrapped') + self.assertIsNot(sys.stderr, orig_stderr, 'stderr should be wrapped') + self.assertTrue(isinstance(sys.stdout, StreamWrapper), + 'bad stdout wrapper') + self.assertTrue(isinstance(sys.stderr, StreamWrapper), + 'bad stderr wrapper') + + def assertNotWrapped(self): + self.assertIs(sys.stdout, orig_stdout, 'stdout should not be wrapped') + self.assertIs(sys.stderr, orig_stderr, 'stderr should not be wrapped') + + @patch('colorama.initialise.reset_all') + @patch('colorama.ansitowin32.winapi_test', lambda *_: True) + @patch('colorama.ansitowin32.enable_vt_processing', lambda *_: False) + def testInitWrapsOnWindows(self, _): + with osname("nt"): + init() + self.assertWrapped() + + @patch('colorama.initialise.reset_all') + @patch('colorama.ansitowin32.winapi_test', lambda *_: False) + def testInitDoesntWrapOnEmulatedWindows(self, _): + with osname("nt"): + init() + self.assertNotWrapped() + + def testInitDoesntWrapOnNonWindows(self): + with osname("posix"): + init() + self.assertNotWrapped() + + def testInitDoesntWrapIfNone(self): + with replace_by(None): + init() + # We can't use assertNotWrapped here because replace_by(None) + # changes stdout/stderr already. + self.assertIsNone(sys.stdout) + self.assertIsNone(sys.stderr) + + def testInitAutoresetOnWrapsOnAllPlatforms(self): + with osname("posix"): + init(autoreset=True) + self.assertWrapped() + + def testInitWrapOffDoesntWrapOnWindows(self): + with osname("nt"): + init(wrap=False) + self.assertNotWrapped() + + def testInitWrapOffIncompatibleWithAutoresetOn(self): + self.assertRaises(ValueError, lambda: init(autoreset=True, wrap=False)) + + @patch('colorama.win32.SetConsoleTextAttribute') + @patch('colorama.initialise.AnsiToWin32') + def testAutoResetPassedOn(self, mockATW32, _): + with osname("nt"): + init(autoreset=True) + self.assertEqual(len(mockATW32.call_args_list), 2) + self.assertEqual(mockATW32.call_args_list11'autoreset', True) + self.assertEqual(mockATW32.call_args_list01'autoreset', True) + + @patch('colorama.initialise.AnsiToWin32') + def testAutoResetChangeable(self, mockATW32): + with osname("nt"): + init() + + init(autoreset=True) + self.assertEqual(len(mockATW32.call_args_list), 4) + self.assertEqual(mockATW32.call_args_list21'autoreset', True) + self.assertEqual(mockATW32.call_args_list31'autoreset', True) + + init() + self.assertEqual(len(mockATW32.call_args_list), 6) + self.assertEqual( + mockATW32.call_args_list41'autoreset', False) + self.assertEqual( + mockATW32.call_args_list51'autoreset', False) + + + @patch('colorama.initialise.atexit.register') + def testAtexitRegisteredOnlyOnce(self, mockRegister): + init() + self.assertTrue(mockRegister.called) + mockRegister.reset_mock() + init() + self.assertFalse(mockRegister.called) + + +class JustFixWindowsConsoleTest(TestCase): + def _reset(self): + _wipe_internal_state_for_tests() + sys.stdout = orig_stdout + sys.stderr = orig_stderr + + def tearDown(self): + self._reset() + + @patch("colorama.ansitowin32.winapi_test", lambda: True) + def testJustFixWindowsConsole(self): + if sys.platform != "win32": + # just_fix_windows_console should be a no-op + just_fix_windows_console() + self.assertIs(sys.stdout, orig_stdout) + self.assertIs(sys.stderr, orig_stderr) + else: + def fake_std(): + # Emulate stdout=not a tty, stderr=tty + # to check that we handle both cases correctly + stdout = Mock() + stdout.closed = False + stdout.isatty.return_value = False + stdout.fileno.return_value = 1 + sys.stdout = stdout + + stderr = Mock() + stderr.closed = False + stderr.isatty.return_value = True + stderr.fileno.return_value = 2 + sys.stderr = stderr + + for native_ansi in False, True: + with patch( + 'colorama.ansitowin32.enable_vt_processing', + lambda *_: native_ansi + ): + self._reset() + fake_std() + + # Regular single-call test + prev_stdout = sys.stdout + prev_stderr = sys.stderr + just_fix_windows_console() + self.assertIs(sys.stdout, prev_stdout) + if native_ansi: + self.assertIs(sys.stderr, prev_stderr) + else: + self.assertIsNot(sys.stderr, prev_stderr) + + # second call without resetting is always a no-op + prev_stdout = sys.stdout + prev_stderr = sys.stderr + just_fix_windows_console() + self.assertIs(sys.stdout, prev_stdout) + self.assertIs(sys.stderr, prev_stderr) + + self._reset() + fake_std() + + # If init() runs first, just_fix_windows_console should be a no-op + init() + prev_stdout = sys.stdout + prev_stderr = sys.stderr + just_fix_windows_console() + self.assertIs(prev_stdout, sys.stdout) + self.assertIs(prev_stderr, sys.stderr) + + +if __name__ == '__main__': + main()
View file
_service:tar_scm:colorama-0.4.6.tar.gz/colorama/tests/isatty_test.py
Added
@@ -0,0 +1,57 @@ +# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. +import sys +from unittest import TestCase, main + +from ..ansitowin32 import StreamWrapper, AnsiToWin32 +from .utils import pycharm, replace_by, replace_original_by, StreamTTY, StreamNonTTY + + +def is_a_tty(stream): + return StreamWrapper(stream, None).isatty() + +class IsattyTest(TestCase): + + def test_TTY(self): + tty = StreamTTY() + self.assertTrue(is_a_tty(tty)) + with pycharm(): + self.assertTrue(is_a_tty(tty)) + + def test_nonTTY(self): + non_tty = StreamNonTTY() + self.assertFalse(is_a_tty(non_tty)) + with pycharm(): + self.assertFalse(is_a_tty(non_tty)) + + def test_withPycharm(self): + with pycharm(): + self.assertTrue(is_a_tty(sys.stderr)) + self.assertTrue(is_a_tty(sys.stdout)) + + def test_withPycharmTTYOverride(self): + tty = StreamTTY() + with pycharm(), replace_by(tty): + self.assertTrue(is_a_tty(tty)) + + def test_withPycharmNonTTYOverride(self): + non_tty = StreamNonTTY() + with pycharm(), replace_by(non_tty): + self.assertFalse(is_a_tty(non_tty)) + + def test_withPycharmNoneOverride(self): + with pycharm(): + with replace_by(None), replace_original_by(None): + self.assertFalse(is_a_tty(None)) + self.assertFalse(is_a_tty(StreamNonTTY())) + self.assertTrue(is_a_tty(StreamTTY())) + + def test_withPycharmStreamWrapped(self): + with pycharm(): + self.assertTrue(AnsiToWin32(StreamTTY()).stream.isatty()) + self.assertFalse(AnsiToWin32(StreamNonTTY()).stream.isatty()) + self.assertTrue(AnsiToWin32(sys.stdout).stream.isatty()) + self.assertTrue(AnsiToWin32(sys.stderr).stream.isatty()) + + +if __name__ == '__main__': + main()
View file
_service:tar_scm:colorama-0.4.6.tar.gz/colorama/tests/utils.py
Added
@@ -0,0 +1,49 @@ +# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. +from contextlib import contextmanager +from io import StringIO +import sys +import os + + +class StreamTTY(StringIO): + def isatty(self): + return True + +class StreamNonTTY(StringIO): + def isatty(self): + return False + +@contextmanager +def osname(name): + orig = os.name + os.name = name + yield + os.name = orig + +@contextmanager +def replace_by(stream): + orig_stdout = sys.stdout + orig_stderr = sys.stderr + sys.stdout = stream + sys.stderr = stream + yield + sys.stdout = orig_stdout + sys.stderr = orig_stderr + +@contextmanager +def replace_original_by(stream): + orig_stdout = sys.__stdout__ + orig_stderr = sys.__stderr__ + sys.__stdout__ = stream + sys.__stderr__ = stream + yield + sys.__stdout__ = orig_stdout + sys.__stderr__ = orig_stderr + +@contextmanager +def pycharm(): + os.environ"PYCHARM_HOSTED" = "1" + non_tty = StreamNonTTY() + with replace_by(non_tty), replace_original_by(non_tty): + yield + del os.environ"PYCHARM_HOSTED"
View file
_service:tar_scm:colorama-0.4.6.tar.gz/colorama/tests/winterm_test.py
Added
@@ -0,0 +1,131 @@ +# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. +import sys +from unittest import TestCase, main, skipUnless + +try: + from unittest.mock import Mock, patch +except ImportError: + from mock import Mock, patch + +from ..winterm import WinColor, WinStyle, WinTerm + + +class WinTermTest(TestCase): + + @patch('colorama.winterm.win32') + def testInit(self, mockWin32): + mockAttr = Mock() + mockAttr.wAttributes = 7 + 6 * 16 + 8 + mockWin32.GetConsoleScreenBufferInfo.return_value = mockAttr + term = WinTerm() + self.assertEqual(term._fore, 7) + self.assertEqual(term._back, 6) + self.assertEqual(term._style, 8) + + @skipUnless(sys.platform.startswith("win"), "requires Windows") + def testGetAttrs(self): + term = WinTerm() + + term._fore = 0 + term._back = 0 + term._style = 0 + self.assertEqual(term.get_attrs(), 0) + + term._fore = WinColor.YELLOW + self.assertEqual(term.get_attrs(), WinColor.YELLOW) + + term._back = WinColor.MAGENTA + self.assertEqual( + term.get_attrs(), + WinColor.YELLOW + WinColor.MAGENTA * 16) + + term._style = WinStyle.BRIGHT + self.assertEqual( + term.get_attrs(), + WinColor.YELLOW + WinColor.MAGENTA * 16 + WinStyle.BRIGHT) + + @patch('colorama.winterm.win32') + def testResetAll(self, mockWin32): + mockAttr = Mock() + mockAttr.wAttributes = 1 + 2 * 16 + 8 + mockWin32.GetConsoleScreenBufferInfo.return_value = mockAttr + term = WinTerm() + + term.set_console = Mock() + term._fore = -1 + term._back = -1 + term._style = -1 + + term.reset_all() + + self.assertEqual(term._fore, 1) + self.assertEqual(term._back, 2) + self.assertEqual(term._style, 8) + self.assertEqual(term.set_console.called, True) + + @skipUnless(sys.platform.startswith("win"), "requires Windows") + def testFore(self): + term = WinTerm() + term.set_console = Mock() + term._fore = 0 + + term.fore(5) + + self.assertEqual(term._fore, 5) + self.assertEqual(term.set_console.called, True) + + @skipUnless(sys.platform.startswith("win"), "requires Windows") + def testBack(self): + term = WinTerm() + term.set_console = Mock() + term._back = 0 + + term.back(5) + + self.assertEqual(term._back, 5) + self.assertEqual(term.set_console.called, True) + + @skipUnless(sys.platform.startswith("win"), "requires Windows") + def testStyle(self): + term = WinTerm() + term.set_console = Mock() + term._style = 0 + + term.style(22) + + self.assertEqual(term._style, 22) + self.assertEqual(term.set_console.called, True) + + @patch('colorama.winterm.win32') + def testSetConsole(self, mockWin32): + mockAttr = Mock() + mockAttr.wAttributes = 0 + mockWin32.GetConsoleScreenBufferInfo.return_value = mockAttr + term = WinTerm() + term.windll = Mock() + + term.set_console() + + self.assertEqual( + mockWin32.SetConsoleTextAttribute.call_args, + ((mockWin32.STDOUT, term.get_attrs()), {}) + ) + + @patch('colorama.winterm.win32') + def testSetConsoleOnStderr(self, mockWin32): + mockAttr = Mock() + mockAttr.wAttributes = 0 + mockWin32.GetConsoleScreenBufferInfo.return_value = mockAttr + term = WinTerm() + term.windll = Mock() + + term.set_console(on_stderr=True) + + self.assertEqual( + mockWin32.SetConsoleTextAttribute.call_args, + ((mockWin32.STDERR, term.get_attrs()), {}) + ) + + +if __name__ == '__main__': + main()
View file
_service:tar_scm:colorama-0.4.4.tar.gz/colorama/win32.py -> _service:tar_scm:colorama-0.4.6.tar.gz/colorama/win32.py
Changed
@@ -4,6 +4,8 @@ STDOUT = -11 STDERR = -12 +ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 + try: import ctypes from ctypes import LibraryLoader @@ -89,6 +91,20 @@ _SetConsoleTitleW.restype = wintypes.BOOL + _GetConsoleMode = windll.kernel32.GetConsoleMode + _GetConsoleMode.argtypes = + wintypes.HANDLE, + POINTER(wintypes.DWORD) + + _GetConsoleMode.restype = wintypes.BOOL + + _SetConsoleMode = windll.kernel32.SetConsoleMode + _SetConsoleMode.argtypes = + wintypes.HANDLE, + wintypes.DWORD + + _SetConsoleMode.restype = wintypes.BOOL + def _winapi_test(handle): csbi = CONSOLE_SCREEN_BUFFER_INFO() success = _GetConsoleScreenBufferInfo( @@ -150,3 +166,15 @@ def SetConsoleTitle(title): return _SetConsoleTitleW(title) + + def GetConsoleMode(handle): + mode = wintypes.DWORD() + success = _GetConsoleMode(handle, byref(mode)) + if not success: + raise ctypes.WinError() + return mode.value + + def SetConsoleMode(handle, mode): + success = _SetConsoleMode(handle, mode) + if not success: + raise ctypes.WinError()
View file
_service:tar_scm:colorama-0.4.4.tar.gz/colorama/winterm.py -> _service:tar_scm:colorama-0.4.6.tar.gz/colorama/winterm.py
Changed
@@ -1,6 +1,12 @@ # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. -from . import win32 +try: + from msvcrt import get_osfhandle +except ImportError: + def get_osfhandle(_): + raise OSError("This isn't windows!") + +from . import win32 # from wincon.h class WinColor(object): @@ -167,3 +173,23 @@ def set_title(self, title): win32.SetConsoleTitle(title) + + +def enable_vt_processing(fd): + if win32.windll is None or not win32.winapi_test(): + return False + + try: + handle = get_osfhandle(fd) + mode = win32.GetConsoleMode(handle) + win32.SetConsoleMode( + handle, + mode | win32.ENABLE_VIRTUAL_TERMINAL_PROCESSING, + ) + + mode = win32.GetConsoleMode(handle) + if mode & win32.ENABLE_VIRTUAL_TERMINAL_PROCESSING: + return True + # Can get TypeError in testsuite where 'fd' is a Mock() + except (OSError, TypeError): + return False
View file
_service:tar_scm:colorama-0.4.4.tar.gz/demos/demo.sh -> _service:tar_scm:colorama-0.4.6.tar.gz/demos/demo.sh
Changed
@@ -27,8 +27,9 @@ # Demonstrate the difference between colorama initialized with wrapping on and off. python demo05.py -# Demonstrate printing colored, random characters at random positions on the screen -python demo06.py +# Skip demo06 +# It is too visually disruptive, +# making it hard to see whether any of the demos are working correctly. # Demonstrate cursor relative movement: UP, DOWN, FORWARD, and BACK in colorama.CURSOR python demo07.py
View file
_service:tar_scm:colorama-0.4.4.tar.gz/demos/demo01.py -> _service:tar_scm:colorama-0.4.6.tar.gz/demos/demo01.py
Changed
@@ -10,9 +10,9 @@ # Add parent dir to sys path, so the following 'import colorama' always finds # the local source in preference to any installed version of colorama. import fixpath -from colorama import init, Fore, Back, Style +from colorama import just_fix_windows_console, Fore, Back, Style -init() +just_fix_windows_console() # Fore, Back and Style are convenience classes for the constant ANSI strings that set # the foreground, background and style. The don't have any magic of their own.
View file
_service:tar_scm:colorama-0.4.4.tar.gz/demos/demo02.py -> _service:tar_scm:colorama-0.4.6.tar.gz/demos/demo02.py
Changed
@@ -5,9 +5,9 @@ from __future__ import print_function import fixpath -from colorama import init, Fore, Back, Style +from colorama import just_fix_windows_console, Fore, Back, Style -init() +just_fix_windows_console() print(Fore.GREEN + 'green, ' + Fore.RED + 'red, '
View file
_service:tar_scm:colorama-0.4.4.tar.gz/demos/demo06.py -> _service:tar_scm:colorama-0.4.6.tar.gz/demos/demo06.py
Changed
@@ -9,7 +9,7 @@ # Demonstrate printing colored, random characters at random positions on the screen # Fore, Back and Style are convenience classes for the constant ANSI strings that set -# the foreground, background and style. The don't have any magic of their own. +# the foreground, background and style. They don't have any magic of their own. FORES = Fore.BLACK, Fore.RED, Fore.GREEN, Fore.YELLOW, Fore.BLUE, Fore.MAGENTA, Fore.CYAN, Fore.WHITE BACKS = Back.BLACK, Back.RED, Back.GREEN, Back.YELLOW, Back.BLUE, Back.MAGENTA, Back.CYAN, Back.WHITE STYLES = Style.DIM, Style.NORMAL, Style.BRIGHT @@ -24,7 +24,7 @@ PASSES = 1000 def main(): - colorama.init() + colorama.just_fix_windows_console() pos = lambda y, x: Cursor.POS(x, y) # draw a white border. print(Back.WHITE, end='')
View file
_service:tar_scm:colorama-0.4.4.tar.gz/demos/demo07.py -> _service:tar_scm:colorama-0.4.6.tar.gz/demos/demo07.py
Changed
@@ -16,7 +16,7 @@ aba 3a4 """ - colorama.init() + colorama.just_fix_windows_console() print("aaa") print("aaa") print("aaa")
View file
_service:tar_scm:colorama-0.4.6.tar.gz/demos/demo09.py
Added
@@ -0,0 +1,21 @@ +# https://www.youtube.com/watch?v=F5a8RLY2N8M&list=PL1_riyn9sOjcKIAYzo7f8drxD-Yg9La-D&index=61 +# Generic colorama demo using command line arguments +# By George Ogden +from colorama import Fore, Back, Style, init +import argparse +parser = argparse.ArgumentParser("colorama demo") + +def format(module): + return list(map(lambda x: x.lower(),module.__dict__.keys())) + +def find(module,item): + return module.__dict__item.upper() + +parser.add_argument("-c","--colour",choices=format(Fore),default="RESET") +parser.add_argument("-b","--background",choices=format(Back),default="RESET") +parser.add_argument("-s","--style",choices=format(Style),default="RESET_ALL") +parser.add_argument("-t","--text",default="Lorem ipsum dolor sit amet") + +args = parser.parse_args() + +print(find(Style,args.style) + find(Fore,args.colour) + find(Back,args.background) + args.text + Style.RESET_ALL) \ No newline at end of file
View file
_service:tar_scm:colorama-0.4.6.tar.gz/pyproject.toml
Added
@@ -0,0 +1,64 @@ +build-system +requires = + "hatchling>=0.25.1", + +build-backend = "hatchling.build" + +project +name = "colorama" +description = "Cross-platform colored terminal text." +readme = "README.rst" +license = "BSD-3-Clause" +requires-python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*" +authors = + { name = "Jonathan Hartley", email = "tartley@tartley.com" }, + +keywords = + "ansi", + "color", + "colour", + "crossplatform", + "terminal", + "text", + "windows", + "xplatform", + +classifiers = + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Terminals", + +dynamic = + "version", + + +project.urls +Homepage = "https://github.com/tartley/colorama" + +tool.hatch.version +path = "colorama/__init__.py" + +tool.hatch.build.targets.sdist +include = + "/colorama", + "/demos", + "/CHANGELOG.rst", + + +tool.hatch.build.targets.wheel +include = + "/colorama/*", +
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2