-
Notifications
You must be signed in to change notification settings - Fork 178
Config Output Auto-update Script #948
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
Config Output Auto-update Script #948
Conversation
630c727
to
c002c64
Compare
exc_type, exc_obj, exc_tb = sys.exc_info() | ||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] | ||
print(exc_type, fname, exc_tb.tb_lineno) | ||
pass |
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.
I asked offline why this has exception handling here as it looks like it doesn't do anything. I was wrong, this one passes (is there another way to do this?). You may want a comment to explain this for idiots like me :)
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.
Updooted, I'm also OK with removing this section as its more of a vestigial hold out from development (although can still be helpful, let me catch minor exceptions that didn't cause issues without exiting and provided a full list of all files that caused issues).
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.
Thanks for the PR. This looks great 👍
@cmonr Is this ready to merge? |
TODO: Need to resolve corner cases with prefix types on some pages (RTOS/events, networking, etc)
Fix Platform config file
efbd3c3
to
3ac0648
Compare
@cmonr It was this one. |
check_tools/config-update.py
Outdated
if ('Name: ' in blocks[i]): | ||
lib = blocks[i].split('Name: ')[1].split('.')[0] | ||
print("================= %s =================" % lib) | ||
out = subprocess.check_output(["mbed", "compile", "--config", "-v", "--prefix", lib]).decode() |
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.
You probably want:
out = subprocess.check_output(["mbed", "compile", "--config", "-v", "--prefix", lib]).decode() | |
out = subprocess.check_output(["mbed", "compile", "--config", "-v", "--prefix", lib]).encode('utf-8') |
For Py2/Py3 compat.
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.
The subprocess output in Python3 is a Bytes object that I cannot encode. I had added the decode initially to allow it to run in both Python2/3 (although I did run the following error in nvstore in Python2):
'ascii' codec can't decode byte 0xe2 in position 996: ordinal not in range(128)
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.
https://github.com/ARMmbed/mbed-os/pulls?q=is%3Apr+is%3Aclosed+author%3Acmonr
A couple of my recent PRs were Python 2/3 compat related if you want to take a look.
Imo, it might be better if this works with Py3 if you had to choose one.
Also, I might be confusing encode
and decode
.
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.
It would be good to know what causes the occasional convert error.
check_tools/config-update.py
Outdated
|
||
if (os.path.isfile(path)): | ||
main(path) | ||
else: |
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.
Due to the arg parsing in https://github.com/ARMmbed/mbed-os-5-docs/pull/948/files#diff-e52e11a85f5305dc93291efd2f777122R54, this should verify that path is a directory or throw an error.
If this is manually run, how is this expected to be used? When, where, by who, and how often? |
The longterm goal is to get this into CI, so it's completely automated. In the short term, the docs team can run it every feature release if given written, detailed instructions. |
Correct I'd love to see this in CI, but until then it should be as simple to run as:
|
@cmonr Have all of your concerns been addressed? |
@cmonr Fixed the string formatting, runs on Python 2.7/3.5 |
I personally feel like the script could use more documentation, but I'm not going to block the PR on it. https://blog.codinghorror.com/coding-for-violent-psychopaths/ @kegilbert We'll see how well this comment ages 😁 |
I'll put up another a bit with some better docs |
Add a manually run script that will replace the config system verbose output in the docs with the output from the config list command. Bit of a simple implementation without many automated checks at the moment, I'd still recommend double checking the output pretty closely until after some more review.
The LWIP page had to be consolidated for this to work but everything else should be unchanged.
Tested mainly with Python3, Python2 worked but ran into an occasional UTF-8 encoding error (I can poke around that more if need be).