Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-colorama for openSUSE:Factory
checked in at 2022-10-30 18:28:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-colorama (Old)
and /work/SRC/openSUSE:Factory/.python-colorama.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-colorama"
Sun Oct 30 18:28:31 2022 rev:19 rq:1032202 version:0.4.6
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-colorama/python-colorama.changes
2022-06-29 16:00:18.236530546 +0200
+++
/work/SRC/openSUSE:Factory/.python-colorama.new.2275/python-colorama.changes
2022-10-30 18:28:34.974302337 +0100
@@ -1,0 +2,24 @@
+Sat Oct 29 12:01:57 UTC 2022 - Dirk M??ller <[email protected]>
+
+- update to 0.4.6:
+ * 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
+
+-------------------------------------------------------------------
Old:
----
0.4.5.tar.gz
New:
----
0.4.6.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-colorama.spec ++++++
--- /var/tmp/diff_new_pack.kjv2gx/_old 2022-10-30 18:28:35.990307828 +0100
+++ /var/tmp/diff_new_pack.kjv2gx/_new 2022-10-30 18:28:35.994307850 +0100
@@ -19,15 +19,17 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-colorama
-Version: 0.4.5
+Version: 0.4.6
Release: 0
Summary: Cross-platform colored terminal text
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/tartley/colorama
Source: https://github.com/tartley/colorama/archive/%{version}.tar.gz
+BuildRequires: %{python_module hatchling}
+BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
-BuildRequires: %{python_module setuptools}
+BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: unzip
@@ -53,10 +55,10 @@
%setup -q -n colorama-%{version}
%build
-%python_build
+%pyproject_wheel
%install
-%python_install
+%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
@@ -68,7 +70,6 @@
%doc demos/
%dir %{python_sitelib}/colorama
%{python_sitelib}/colorama/*
-%dir %{python_sitelib}/colorama-%{version}-py*.egg-info
-%{python_sitelib}/colorama-%{version}-py*.egg-info
+%{python_sitelib}/colorama-%{version}*.dist-info
%changelog
++++++ 0.4.5.tar.gz -> 0.4.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/.github/workflows/test.yml
new/colorama-0.4.6/.github/workflows/test.yml
--- old/colorama-0.4.5/.github/workflows/test.yml 2022-06-16
14:17:02.000000000 +0200
+++ new/colorama-0.4.6/.github/workflows/test.yml 2022-10-25
04:26:01.000000000 +0200
@@ -11,15 +11,13 @@
strategy:
fail-fast: false
matrix:
- python-version: ["pypy-2.7", "pypy-3.8", "2.7", "3.5", "3.6", "3.7",
"3.8", "3.9", "3.10"]
+ python-version: ["pypy-2.7", "pypy-3.8", "2.7", "3.7", "3.8", "3.9",
"3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
include:
# Add new helper variables to existing jobs
- {python-version: "pypy-2.7", toxenv: "pypy"}
- {python-version: "pypy-3.8", toxenv: "pypy3"}
- {python-version: "2.7", toxenv: "py27"}
- - {python-version: "3.5", toxenv: "py35"}
- - {python-version: "3.6", toxenv: "py36"}
- {python-version: "3.7", toxenv: "py37"}
- {python-version: "3.8", toxenv: "py38"}
- {python-version: "3.9", toxenv: "py39"}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/CHANGELOG.rst
new/colorama-0.4.6/CHANGELOG.rst
--- old/colorama-0.4.5/CHANGELOG.rst 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/CHANGELOG.rst 2022-10-25 04:26:01.000000000 +0200
@@ -1,4 +1,24 @@
-0.4.5 In progress, unreleased
+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.
@@ -6,11 +26,11 @@
* Add support for Python 3.9.
* Add support for PyPy3.
* Add support for pickling with the ``dill`` module.
-0.4.4 Current release
+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.
+ * 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
@@ -19,8 +39,8 @@
0.4.3
* Fix release 0.4.2 which was uploaded with missing files.
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.
+ * #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
@@ -29,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
@@ -59,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
@@ -85,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
@@ -94,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.
@@ -107,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
@@ -124,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.
@@ -150,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
@@ -171,8 +190,8 @@
* 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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/MANIFEST.in
new/colorama-0.4.6/MANIFEST.in
--- old/colorama-0.4.5/MANIFEST.in 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-include LICENSE.txt CHANGELOG.rst
-recursive-include demos *.py *.bat *.sh
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/Makefile new/colorama-0.4.6/Makefile
--- old/colorama-0.4.5/Makefile 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/Makefile 2022-10-25 04:26:01.000000000 +0200
@@ -15,10 +15,9 @@
virtualenv=~/.virtualenvs/colorama
pip=$(virtualenv)/bin/pip
-syspython=python3.8
+syspython=python3
python=$(virtualenv)/bin/python
twine=$(virtualenv)/bin/twine
-version=$(shell $(python) setup.py --version)
clean: ## Remove build artifacts, .pyc files, virtualenv
-rm -rf build dist MANIFEST colorama.egg-info $(virtualenv)
@@ -51,8 +50,7 @@
# build packages
build: ## Build a release (sdist and wheel)
- $(python) -m pip install --upgrade setuptools wheel
- $(python) setup.py sdist bdist_wheel
+ $(python) -m build
.PHONY: build
test-release: build ## Test a built release
@@ -60,6 +58,5 @@
.PHONY: test-release
release: ## Upload a built release
- $(twine) upload dist/colorama-$(version)*
+ $(twine) upload dist/colorama-*
.PHONY: release
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/README-hacking.md
new/colorama-0.4.6/README-hacking.md
--- old/colorama-0.4.5/README-hacking.md 2022-06-16 14:17:02.000000000
+0200
+++ new/colorama-0.4.6/README-hacking.md 2022-10-25 04:26:01.000000000
+0200
@@ -66,13 +66,17 @@
## Release checklist
-1. Check the CHANGELOG is updated with everything since the last release.
+1. Check the CHANGELOG.rst is updated with everything since the last release,
+ including links to merged PRs. Move the "Current release" comment from the
+ previous version number.
-2. First we'll make a candidate release. Ensure the '-candidate1' suffix is
- present on `__version__` in `colorama/__init.py__.py`.
+2. First we'll make a candidate release. Ensure the '.rc1' suffix is
+ present on `__version__` in `colorama/__init.py__.py`, eg:
+
+ __version__ = '0.4.6rc1'
3. Run the tests locally on your preferred OS, just to save you from doing
- the following time-consuming steps while there are still obvious problems
+ the subsequent time-consuming steps while there are still obvious problems
in the code:
* Windows:
@@ -84,8 +88,7 @@
* `make bootstrap`
* `make test`
-4. Verify you're all committed, merged to master, and pushed to origin (This
- triggers a CI build, which we'll check later on)
+4. Verify you're all committed, merged to master.
5. Tag the current commit with the `__version__` from `colorama/__init__.py`.
We should start using
@@ -94,12 +97,16 @@
git tag -a -m "" $version
git push --follow-tags
-6. Build the distributables (sdist and wheel), on either OS:
+6. Push to origin (This triggers a CI build, which we'll check later on)
+
+ git push origin master
+
+7. Build the distributables (sdist and wheel), on either OS:
* Windows: `.\build.ps1`
* Linux: `make build`
-7. Test the distributables on both OS. Whichever one you do 2nd will get an
+8. Test the distributables on both OS. Whichever one you do 2nd will get an
HTTP 400 response on uploading to test.pypi.org, but outputs a message
saying this is expected and carries on:
@@ -109,26 +116,30 @@
(This currently only tests the wheel, but
[should soon test the sdist
too](https://github.com/tartley/colorama/issues/286).)
-8. Check the [CI builds](https://github.com/tartley/colorama/actions/)
+9. Check the [CI builds](https://github.com/tartley/colorama/actions/)
are complete and all passing.
-9. Upload the distributables to PyPI:
+10. Upload the distributables to PyPI:
* On Windows: `.\release.ps1`
* On Linux: `make release`
-10. Test by installing the candidate version from PyPI, and sanity check it
with
+11. Test by installing the candidate version from PyPI, and sanity check it
with
'demo.sh', making sure this is running against the PyPI installation, not
local source.
-11. Maybe wait a day for anyone using pre-release installs to report any
+12. Maybe wait a day for anyone using pre-release installs to report any
problems?
-12. Remove the '.candidateX' suffix from `__version__` in
+13. Remove the '.rcX' suffix from `__version__` in
`colorama/__init__.py`.
-13. Repeat steps 5 to 10, for the actual (non-candidate) release.
+14. Repeat steps 4 to 10, for the actual (non-candidate) release.
+
+15. Bump the version number in `colorama/__init__.py`, and add a 'dev1'
+ suffix, eg:
+
+ `0.4.5dev1`
-14. Bump the version number in `colorama/__init__.py`, and add the '-pre'
- suffix again, ready for the next release. Commit and push this (directly to
- master is fine.)
+ so that any build artifacts created are clearly labelled as not a real
+ release. Commit and push this (directly to master is fine.)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/README.rst
new/colorama-0.4.6/README.rst
--- old/colorama-0.4.5/README.rst 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/README.rst 2022-10-25 04:26:01.000000000 +0200
@@ -26,11 +26,10 @@
If you find Colorama useful, please |donate| to the authors. Thank you!
-
Installation
------------
-Tested on CPython 2.7, 3.5, 3.6, 3.7, 3.8, 3.9 and 3.10 and Pypy 2.7 and 3.6.
+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.
@@ -40,7 +39,6 @@
# or
conda install -c anaconda colorama
-
Description
-----------
@@ -55,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
@@ -85,30 +84,65 @@
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.
-
-On other platforms, calling ``init()`` has no effect (unless you request other
-optional functionality, see "Init Keyword Args" below; or if output
-is redirected). By design, this permits applications to call ``init()``
-unconditionally on all platforms, after which ANSI output should just work.
+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 all platforms, if output is redirected, ANSI escape sequences are completely
-stripped out.
+- ``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
..............
@@ -143,13 +177,17 @@
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'))
@@ -168,14 +206,12 @@
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
..................
ANSI codes to reposition the cursor are supported. See ``demos/demo06.py`` for
an example of how to generate them.
-
Init Keyword Args
.................
@@ -227,7 +263,6 @@
# Python 3
print(Fore.BLUE + 'blue text on stderr', file=stream)
-
Recognised ANSI Sequences
.........................
@@ -296,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.
-Some presumably valid ANSI sequences aren't recognised (see details below),
-but to my knowledge nobody has yet complained about this. Puzzling.
+Some valid ANSI sequences aren't recognised.
+
+If you're hacking on the code, see `README-hacking.md`_. ESPECIALLY, see the
+explanation there of why we do not want PRs that allow Colorama to generate new
+types of ANSI codes.
See outstanding issues and wish-list:
https://github.com/tartley/colorama/issues
@@ -314,18 +351,14 @@
and would be happy to grant commit access to anyone who submits a working patch
or two.
-If you're hacking on the code, see `README-hacking.md`_.
-
.. _README-hacking.md: README-hacking.md
-
License
-------
Copyright Jonathan Hartley & Arnon Yaari, 2013-2020. BSD 3-Clause license; see
LICENSE file.
-
Professional support
--------------------
@@ -346,10 +379,11 @@
.. _Tidelift Subscription:
https://tidelift.com/subscription/pkg/pypi-colorama?utm_source=pypi-colorama&utm_medium=referral&utm_campaign=readme
-
Thanks
------
+See the CHANGELOG for more thanks!
+
* Marc Schlaich (schlamar) for a ``setup.py`` fix for Python2.5.
* Marc Abramowitz, reported & fixed a crash on exit with closed ``stdout``,
providing a solution to issue #7's setuptools/distutils debate,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/build.ps1 new/colorama-0.4.6/build.ps1
--- old/colorama-0.4.5/build.ps1 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/build.ps1 2022-10-25 04:26:01.000000000 +0200
@@ -1,6 +1,5 @@
$ve="$HOME\.virtualenvs\colorama"
$bin="$ve\Scripts"
-& $bin\python.exe -m pip install --upgrade setuptools wheel
-& $bin\python.exe setup.py sdist bdist_wheel
-
+& $bin\python.exe -m pip install --upgrade build
+& $bin\python.exe -m build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/colorama/__init__.py
new/colorama-0.4.6/colorama/__init__.py
--- old/colorama-0.4.5/colorama/__init__.py 2022-06-16 14:17:02.000000000
+0200
+++ new/colorama-0.4.6/colorama/__init__.py 2022-10-25 04:26:01.000000000
+0200
@@ -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.5'
+__version__ = '0.4.6'
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/colorama/ansitowin32.py
new/colorama-0.4.6/colorama/ansitowin32.py
--- old/colorama-0.4.5/colorama/ansitowin32.py 2022-06-16 14:17:02.000000000
+0200
+++ new/colorama-0.4.6/colorama/ansitowin32.py 2022-10-25 04:26:01.000000000
+0200
@@ -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
@@ -94,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
@@ -264,3 +271,7 @@
if params[0] in '02':
winterm.set_title(params[1])
return text
+
+
+ def flush(self):
+ self.wrapped.flush()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/colorama/initialise.py
new/colorama-0.4.6/colorama/initialise.py
--- old/colorama-0.4.5/colorama/initialise.py 2022-06-16 14:17:02.000000000
+0200
+++ new/colorama-0.4.6/colorama/initialise.py 2022-10-25 04:26:01.000000000
+0200
@@ -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()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/colorama/tests/ansitowin32_test.py
new/colorama-0.4.6/colorama/tests/ansitowin32_test.py
--- old/colorama-0.4.5/colorama/tests/ansitowin32_test.py 2022-06-16
14:17:02.000000000 +0200
+++ new/colorama-0.4.6/colorama/tests/ansitowin32_test.py 2022-10-25
04:26:01.000000000 +0200
@@ -1,6 +1,11 @@
# 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
@@ -8,6 +13,7 @@
from mock import MagicMock, Mock, patch
from ..ansitowin32 import AnsiToWin32, StreamWrapper
+from ..win32 import ENABLE_VIRTUAL_TERMINAL_PROCESSING
from .utils import osname
@@ -239,5 +245,50 @@
stream.write(code)
self.assertEqual(winterm.set_title.call_count, 2)
+ def test_native_windows_ansi(self):
+ with ExitStack() as stack:
+ def p(a, b):
+ stack.enter_context(patch(a, b, create=True))
+ # Pretend to be on Windows
+ p("colorama.ansitowin32.os.name", "nt")
+ p("colorama.ansitowin32.winapi_test", lambda: True)
+ p("colorama.win32.winapi_test", lambda: True)
+ p("colorama.winterm.win32.windll", "non-None")
+ p("colorama.winterm.get_osfhandle", lambda _: 1234)
+
+ # Pretend that our mock stream has native ANSI support
+ p(
+ "colorama.winterm.win32.GetConsoleMode",
+ lambda _: ENABLE_VIRTUAL_TERMINAL_PROCESSING,
+ )
+ SetConsoleMode = Mock()
+ p("colorama.winterm.win32.SetConsoleMode", SetConsoleMode)
+
+ stdout = Mock()
+ stdout.closed = False
+ stdout.isatty.return_value = True
+ stdout.fileno.return_value = 1
+
+ # Our fake console says it has native vt support, so AnsiToWin32
should
+ # enable that support and do nothing else.
+ stream = AnsiToWin32(stdout)
+ SetConsoleMode.assert_called_with(1234,
ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+ self.assertFalse(stream.strip)
+ self.assertFalse(stream.convert)
+ self.assertFalse(stream.should_wrap())
+
+ # Now let's pretend we're on an old Windows console, that doesn't
have
+ # native ANSI support.
+ p("colorama.winterm.win32.GetConsoleMode", lambda _: 0)
+ SetConsoleMode = Mock()
+ p("colorama.winterm.win32.SetConsoleMode", SetConsoleMode)
+
+ stream = AnsiToWin32(stdout)
+ SetConsoleMode.assert_called_with(1234,
ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+ self.assertTrue(stream.strip)
+ self.assertTrue(stream.convert)
+ self.assertTrue(stream.should_wrap())
+
+
if __name__ == '__main__':
main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/colorama/tests/initialise_test.py
new/colorama-0.4.6/colorama/tests/initialise_test.py
--- old/colorama-0.4.5/colorama/tests/initialise_test.py 2022-06-16
14:17:02.000000000 +0200
+++ new/colorama-0.4.6/colorama/tests/initialise_test.py 2022-10-25
04:26:01.000000000 +0200
@@ -3,12 +3,12 @@
from unittest import TestCase, main, skipUnless
try:
- from unittest.mock import patch
+ from unittest.mock import patch, Mock
except ImportError:
- from mock import patch
+ from mock import patch, Mock
from ..ansitowin32 import StreamWrapper
-from ..initialise import init
+from ..initialise import init, just_fix_windows_console,
_wipe_internal_state_for_tests
from .utils import osname, replace_by
orig_stdout = sys.stdout
@@ -23,6 +23,7 @@
self.assertNotWrapped()
def tearDown(self):
+ _wipe_internal_state_for_tests()
sys.stdout = orig_stdout
sys.stderr = orig_stderr
@@ -40,6 +41,7 @@
@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()
@@ -78,14 +80,6 @@
def testInitWrapOffIncompatibleWithAutoresetOn(self):
self.assertRaises(ValueError, lambda: init(autoreset=True, wrap=False))
- @patch('colorama.ansitowin32.winterm', None)
- @patch('colorama.ansitowin32.winapi_test', lambda *_: True)
- def testInitOnlyWrapsOnce(self):
- with osname("nt"):
- init()
- init()
- self.assertWrapped()
-
@patch('colorama.win32.SetConsoleTextAttribute')
@patch('colorama.initialise.AnsiToWin32')
def testAutoResetPassedOn(self, mockATW32, _):
@@ -122,5 +116,74 @@
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()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/colorama/win32.py
new/colorama-0.4.6/colorama/win32.py
--- old/colorama-0.4.5/colorama/win32.py 2022-06-16 14:17:02.000000000
+0200
+++ new/colorama-0.4.6/colorama/win32.py 2022-10-25 04:26:01.000000000
+0200
@@ -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()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/colorama/winterm.py
new/colorama-0.4.6/colorama/winterm.py
--- old/colorama-0.4.5/colorama/winterm.py 2022-06-16 14:17:02.000000000
+0200
+++ new/colorama-0.4.6/colorama/winterm.py 2022-10-25 04:26:01.000000000
+0200
@@ -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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/demos/demo01.py
new/colorama-0.4.6/demos/demo01.py
--- old/colorama-0.4.5/demos/demo01.py 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/demos/demo01.py 2022-10-25 04:26:01.000000000 +0200
@@ -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.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/demos/demo02.py
new/colorama-0.4.6/demos/demo02.py
--- old/colorama-0.4.5/demos/demo02.py 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/demos/demo02.py 2022-10-25 04:26:01.000000000 +0200
@@ -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, '
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/demos/demo06.py
new/colorama-0.4.6/demos/demo06.py
--- old/colorama-0.4.5/demos/demo06.py 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/demos/demo06.py 2022-10-25 04:26:01.000000000 +0200
@@ -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='')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/demos/demo07.py
new/colorama-0.4.6/demos/demo07.py
--- old/colorama-0.4.5/demos/demo07.py 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/demos/demo07.py 2022-10-25 04:26:01.000000000 +0200
@@ -16,7 +16,7 @@
aba
3a4
"""
- colorama.init()
+ colorama.just_fix_windows_console()
print("aaa")
print("aaa")
print("aaa")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/pyproject.toml
new/colorama-0.4.6/pyproject.toml
--- old/colorama-0.4.5/pyproject.toml 1970-01-01 01:00:00.000000000 +0100
+++ new/colorama-0.4.6/pyproject.toml 2022-10-25 04:26:01.000000000 +0200
@@ -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 = "[email protected]" },
+]
+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/*",
+]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/release.ps1
new/colorama-0.4.6/release.ps1
--- old/colorama-0.4.5/release.ps1 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/release.ps1 2022-10-25 04:26:01.000000000 +0200
@@ -1,7 +1,5 @@
$ve="$HOME\.virtualenvs\colorama"
$bin="$ve\Scripts"
-$version="$(& $bin\python.exe setup.py --version)"
# Upload to PyPI.
-& $bin\twine.exe upload dist\colorama-$version*.tar.gz
dist\colorama-$version-*.whl
-
+& $bin\twine.exe upload dist\colorama-*.tar.gz dist\colorama-*.whl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/requirements-dev.txt
new/colorama-0.4.6/requirements-dev.txt
--- old/colorama-0.4.5/requirements-dev.txt 2022-06-16 14:17:02.000000000
+0200
+++ new/colorama-0.4.6/requirements-dev.txt 2022-10-25 04:26:01.000000000
+0200
@@ -1,3 +1,5 @@
mock>=1.0.1;python_version<"3.3"
twine>=3.1.1
+contextlib2;python_version<"3"
+build
-e .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/setup.cfg new/colorama-0.4.6/setup.cfg
--- old/colorama-0.4.5/setup.cfg 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/setup.cfg 1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-[bdist_wheel]
-universal = 1
-
-[metadata]
-license_file = LICENSE.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/setup.py new/colorama-0.4.6/setup.py
--- old/colorama-0.4.5/setup.py 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/setup.py 1970-01-01 01:00:00.000000000 +0100
@@ -1,68 +0,0 @@
-#!/usr/bin/env python
-# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
-
-from __future__ import with_statement
-
-from io import open
-import os
-import re
-try:
- from setuptools import setup
-except ImportError:
- from distutils.core import setup
-
-
-NAME = 'colorama'
-
-
-def read_file(path, encoding='ascii'):
- with open(os.path.join(os.path.dirname(__file__), path),
- encoding=encoding) 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='[email protected]',
- 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 :: 3.9',
- 'Programming Language :: Python :: 3.10',
- 'Programming Language :: Python :: Implementation :: CPython',
- 'Programming Language :: Python :: Implementation :: PyPy',
- 'Topic :: Terminals',
- ]
-)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/test-release
new/colorama-0.4.6/test-release
--- old/colorama-0.4.5/test-release 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/test-release 2022-10-25 04:26:01.000000000 +0200
@@ -15,20 +15,26 @@
syspython=python3
bin="$HOME/.virtualenvs/colorama/bin"
-version=$($bin/python setup.py --version)
sandbox=test-release-playground
# Upload to the test PyPI.
-$bin/twine upload --repository testpypi dist/colorama-$version* \
+$bin/twine upload --repository testpypi dist/colorama-* \
|| echo " > Expect a 400 if package was already uploaded."
# cd elsewhere so we cannot import from local source.
mkdir -p $sandbox
(
- cd $sandbox
-
# Create a temporary disposable virtualenv.
- $syspython -m venv --clear venv
+ $syspython -m venv --clear $sandbox/venv
+
+ # voodoo sleep. I saw the following install fail, due to expected version
+ # not being listed at test.pypi.org, but then a few seconds later, re-run
+ # manually, it worked fine.
+ sleep 5
+
+ version=$(grep __version__ colorama/__init__.py | cut -d' ' -f3 | tr -d
"'")
+
+ cd $sandbox
# Install the package we just uploaded.
# (--extra-index-url for this project's requirements)
@@ -40,4 +46,3 @@
# Tidy up
rm -rf $sandbox
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/test-release.ps1
new/colorama-0.4.6/test-release.ps1
--- old/colorama-0.4.5/test-release.ps1 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/test-release.ps1 2022-10-25 04:26:01.000000000 +0200
@@ -1,10 +1,9 @@
$syspython="python.exe"
$ve="$HOME\.virtualenvs\colorama"
$bin="$ve\Scripts"
-$version="$(& $bin\python.exe setup.py --version)"
# Upload to the test PyPI.
-& $bin\twine.exe upload --repository testpypi dist\colorama-$version-*
+& $bin\twine.exe upload --repository testpypi dist\colorama-*
if(!$?) {
write-host " > Expect a 400 if package was already uploaded"
}
@@ -16,6 +15,9 @@
# Create a temporary disposable virtualenv.
& $syspython -m venv --clear venv
+# TODO: What is the windows/powershell equivalent of this:
+# version=$(grep __version__ colorama/__init__.py | cut -d' ' -f3 | tr -d
"'")
+
# Install the package we just uploaded.
# (--extra-index-url for this project's requirements)
venv\Scripts\python -m pip --quiet install --index-url
https://test.pypi.org/simple --extra-index-url https://pypi.org/simple
colorama==$version
@@ -27,4 +29,3 @@
"@
cd ..
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/colorama-0.4.5/tox.ini new/colorama-0.4.6/tox.ini
--- old/colorama-0.4.5/tox.ini 2022-06-16 14:17:02.000000000 +0200
+++ new/colorama-0.4.6/tox.ini 2022-10-25 04:26:01.000000000 +0200
@@ -1,6 +1,9 @@
[tox]
-envlist = py27, py35, py36, py37, py38, py39, py310, pypy, pypy3
+isolated_build = true
+envlist = py27, py37, py38, py39, py310, pypy, pypy3
[testenv]
-deps = py27,pypy: mock
+deps =
+ py27,pypy: mock
+ py27,pypy: contextlib2
commands = python -m unittest discover -p *_test.py