-
-
Notifications
You must be signed in to change notification settings - Fork 323
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
Extend Environment.Dump()
to select serialization format
#3672
Conversation
can you change to use a env variable to specify the format to Dump()?
That way we can add yaml, etc.. if we need to without adding tons of APIs |
@bdbaddog sure, I've thought that having a dedicated method for this would actually promote explicitness instead. But this would also mean missing out on the ability to actually save the environment directly to a file (would also have to add a filepath parameter), unless you suggest otherwise. I'll try this tomorrow. |
I like the idea of extending the API to select format. I'm less fond of |
Environment.Dump()
to select serialization format
Environment.Dump()
to select serialization formatEnvironment.Dump()
to select serialization format
I've applied the suggestions and added a with open('.scons_env_dump.json', 'w') as f:
f.write(env.Dump(dump_format='json')) The pretty-printable format is still the default (named I'm not sure about the |
I'd rather |
Done. Also, I've managed to build documentation today to test the updated I'd also like to give some feedback regarding the steps I've gone through to achieve this as a first time contributor. The SCons Documentation Toolchain suggested me to do so!
As someone who's on Windows (don't get me wrong, I do not discriminate any of the existing OS), I've used WSL to run the following commands:
What made me confused is that running the root script without
Also, it would likely be better that |
Yup. The doc tooling could use some work. PR's welcome.. ;) |
I'd suggest the manpage entry ought to indicate the default, as in: As to the build, thanks for the feedback... the "generated" docs aren't so esoteric, they are the "shared" data for construction variables, functions, tools and builders - this material is included into both the manpage and into the appendix of the user guide, which is why those items don't appear in either doc/man or doc/user - the duplication needed there would pretty much guarantee they go out of sync immediately. Yes, Environment.xml is one of the source files for that. The tool doesn't run automatically because it's not always needed - if you edit in doc/man or doc/user there's no need to run it. Anyway - that's how it is, not necessarily how it should be. |
Yeah, I'm just trying to help, I understand that the project has a long history. It's just that a few snippets here and there could already clarify the existing workflow right away. But I also understand that it's a project used by many people and I respect the requirements and dedication needed in order to contribute on the level as big as this project (contributing shortcuts should likely not be encouraged for a project like this).
Done! |
@Xrayez - honestly few people try to run the doc flow. So I give you big credit for completing that.. :). There's a wiki page which covers among other things building the generated files for the docs. https://github.com/SCons/scons/wiki/SimplifiedReleaseProcedure |
Environment.Dump() produces pretty-printable results only, so the usefulness of this method is limited to debugging purposes. The existing method is extended to allow selecting a serialization format to use via a `format` parameter. Namely, it's now possible to serialize variables as a JSON-formatted string, which makes it possible for automated external tools to inspect the environment more easily.
Added more robustness:
|
Looks good to me. Merging! |
Environment.Dump() produces pretty-printable results only, so the usefulness of this method is limited to debugging purposes.
The existing method is extended to allow selecting a serialization format to use via
format
parameter. Namely, it's now possible to serialize variables as a JSON-formatted string, which makes it possible for automated external tools to inspect the environment more easily.I'm coming from godotengine/godot#37248 and the implementation is preliminary accepted by the @godotengine's project manager and I was advised to create this PR upstream (here). It's not required for the changes to be available in SCons.
Contributor Checklist:
CHANGES.txt
(and read theREADME.rst
)though I have to admit that I haven't figured out how to build documentation to test this locally, I'm on Windows and some toolchains are broken there) figured ExtendEnvironment.Dump()
to select serialization format #3672 (comment).