-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SCons: Improve colored output #93479
SCons: Improve colored output #93479
Conversation
0bc1a15
to
adb6aa2
Compare
9d02815
to
b519f2b
Compare
Hmm, potentially. I know that's just |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Rebased on master and it looks like it still works
@dustdfg I think that's my fault, as I added the string manually instead of doing like the other generators. If all other generated files just say "Generating" I argue that we could get rid of the custom message. |
0cfe8e3
to
7f2c701
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, it works as expected on Linux (also when running doc_status.py
).
Code looks good to me.
7f2c701
to
d8761f2
Compare
Opted to simply handle all the logic in |
@@ -6,16 +6,9 @@ | |||
import sys | |||
import urllib.request | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script was executable on purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dagnabbit, Windows source control strikes again
def __str__(self) -> str: | ||
global _colorize | ||
return str(self.value) if _colorize else "" | ||
from methods import Ansi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Importing methods
in methods.py
... does that really work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After prepending the root path, yeah! Granted, the whole implementation of the local GDExtension-specific methods.py
is a bit suspect, but that's outside the scope of this PR
import re | ||
import sys | ||
import xml.etree.ElementTree as ET | ||
from typing import Dict, List, Set | ||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so messy :/
I know this was already used in make_rst.py
but methods.py
is a collection of methods for use by SCons to build the engine, it's not meant to be used by generic standalone scripts.
Those scripts shouldn't break if we move them around ideally.
I like the reduction in code duplication, but I don't love the added dependency on I'd question whether just getting some pretty colors justifies this complexity (both before this PR and after). |
This PR originally kept the color logic in a separate file, However, the nature of the repo unfortunately makes some degree of dependencies inevitable. It's normally automated with SCons passing scope up automatically, but the isolated scripts have no choice in the matter. Unless we have some "master" script/hook in the repo root that calls to other scripts, I see no way of working around that fundamental limitation |
Thanks! |
|
Expanded the ANSI color code support already implemented in SCons by consolidating the logic in
methods.py
. The overall changes were:methods.py
, so anything that calls that logic will have their terminal automatically setup to handle color output.LIGHT_
prefix to existing colors.Ansi.GRAY
from 256 color to a conditional that checks if continuous integration is active. This works around a previous issue with GitHub Actions causingAnsi.BLACK
to output as black instead of gray; now CI specifically will useAnsi.LIGHT_BLACK
instead.print_info
from Add colors to SCons error/warning messages #88074. Not widely used atm, mostly replacingprint("Note: <...>")
instances.doc_status.py
,make_rst.py
,install_d3d12_sdk_windows.py
and the GDExtensionmethods.py
files got their color logic overhauled to utilize the rootmethods.py
.