Repository navigation
tools: port populateUiInformation.php to Python - #1112
Open
Coastrnaut wants to merge 1 commit into
Open
Coastrnaut wants to merge 1 commit into
Coastrnaut wants to merge 1 commit into
Conversation
populate_ui_information.py does what populateUiInformation.php did: it reads formula/definition, updates the information boxes in the formula .ui files, generates formula/opencl/*.cl, writes missing thumbnail configs and images, formulaData.csv, parameterNames.txt and all_fractal_definitions.h, and with checkCl test-compiles the OpenCL formulas. Python 3.6+ standard library only; highlight, clang-format, mandelbulber2, ImageMagick and clang can be overridden through environment variables. Against the PHP on identical input it writes the same bytes to every file and prints the same report in dry, nondry, verbose, warning and checkCl runs. The generated .cl headers now name the new script; only that line changes in them. README.md points to the new script.
| die('could not read index for formula : ' + file + ' --> ' + print_r(definition_part_lines_raw)) | ||
| f = {} | ||
| for definition_part_line in definition_part_lines: | ||
| match_line = preg_match(r'([a-zA-Z]+)\s*=\s*"?([\da-zA-Z\.: -_]*?)"?;', definition_part_line) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of porting the PHP tools to Python, one PR per tool (see also #1107, #1108, #1109, #1110, #1111). With all of them in,
tools/common.inc.phpis no longer used and can be removed.This replaces
tools/populateUiInformation.phpwithtools/populate_ui_information.py. It is meant to do exactly what the PHP does, so the tool no longer needs a PHP install:formula/ui/*.uifromformula/definitionformula/opencl/*.cl.fractconfigs and render missing formula thumbnails (mandelbulber2 + ImageMagick)deploy/formulaData.csv,parameterNames.txtandall_fractal_definitions.h(withnondry)checkClUsage is unchanged: dry run by default, plus
nondry,verbose,warningandcheckCl. It uses Python 3.6+ and the standard library only. highlight, clang-format, mandelbulber2, ImageMagick and clang come from PATH, or from theHIGHLIGHT,CLANG_FORMAT,MANDELBULBER_EXEC_PATH,CONVERTandCLANGenvironment variables.Equivalence check
The PHP (8.4) and the port were run side by side on identical copies of master, in dry,
nondry(twice),verbose,warningandcheckClruns. Every file either one wrote was byte-identical (469 files on the firstnondry: the ui files,.fractconfigs, two new.cl;formulaData.csv,parameterNames.txtandall_fractal_definitions.hcame out equal to the committed ones), and the printed reports matched. A secondnondrychanged nothing on either side. The internal-name upgrade path (git mvof renamed formula files) was tested too, and rendering a thumbnail for one formula.Not exercised with the real tools:
highlightwasn't available, so both sides used the same deterministic stand-in — the code boxes in the ui files were compared as "same highlight output passed through the same way", not against real highlight output. LikewisecheckClran only without a compiler (the "clang missing" path), and ImageMagick wasn't installed. A dry run on a machine with highlight should show the ui files unchanged.Small differences
.clfiles.Generated files
The 459 generated
.clfiles change only in their "autogenerated by" line, which now names the new script.tools/README.mdis updated.Not part of this PR, but the tool reports them on master:
chebyshev_bulb.clanddual_power_mandelbox.clhave not been generated yet, and six formulas have no thumbnail.