File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Unreleased
8
8
9
9
- Improved output (`PR #333 `_, Fixes `#142 `_)
10
10
- The CLI now honnors `NO_COLOR `_ (`PR #333 `_)
11
+ - The CLI can now be forced to colorize the output by setting the ``FORCE_COLOR `` environment variable (`PR #335 `_)
11
12
- Added logging to ``build `` and ``build.env `` (`PR #333 `_)
12
13
13
14
@@ -17,6 +18,7 @@ Breaking Changes
17
18
- Dropped support for Python 2 and 3.5.
18
19
19
20
.. _PR #333 : https://github.com/pypa/build/pull/333
21
+ .. _PR #335 : https://github.com/pypa/build/pull/335
20
22
.. _#142 : https://github.com/pypa/build/issues/142
21
23
.. _NO_COLOR : https://no-color.org
22
24
Original file line number Diff line number Diff line change 33
33
'underline' : '\33 [4m' ,
34
34
'reset' : '\33 [0m' ,
35
35
}
36
- if not sys .stdout .isatty () or 'NO_COLOR' in os .environ :
36
+ if 'FORCE_COLOR' not in os . environ and not sys .stdout .isatty () or 'NO_COLOR' in os .environ :
37
37
_STYLES = {color : '' for color in _STYLES }
38
38
39
39
Original file line number Diff line number Diff line change @@ -338,9 +338,7 @@ def test_output_env_subprocess_error(
338
338
stdout_body ,
339
339
stdout_error ,
340
340
):
341
- mocker .patch ('sys.stdout.isatty' , return_value = True )
342
- if not color :
343
- monkeypatch .setenv ('NO_COLOR' , '' )
341
+ monkeypatch .setenv ('FORCE_COLOR' if color else 'NO_COLOR' , '' )
344
342
345
343
importlib .reload (build .__main__ ) # reload module to set _STYLES
346
344
You can’t perform that action at this time.
0 commit comments