Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#15843 closed enhancement (fixed)

RFE: xml2toml function in bundle builder

Reported by: Zach Pearson Owned by: Zach Pearson
Priority: blocker Milestone:
Component: Build System Version:
Keywords: Cc: chimerax-programmers
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

It would be good if bundle builder could use bundle_builder_toml for all bundles, perhaps by converting xml to toml on the fly in bundle builder and exposing that function as an entry point if the user desires to do it in-tree and convert permanently.

Change History (3)

comment:1 by Eric Pettersen, 15 months ago

Component: UnassignedBuild System

comment:2 by Zach Pearson, 15 months ago

Cc: chimerax-programmers added
Resolution: fixed
Status: assignedclosed

Bundle builder can now perform rudimentary conversion of bundle_info.xml files to TOML.

You can call bundle builder as a module, e.g. python -m chimerax.bundle_builder -c bundle_info.xml

There is also a long option version, --convert.

You can optionally add --dynamic-version at the end to get a TOML file that supports specifying the package version as src.__version__. As long as __version__ = 'version' is the first uncommented line of Python in your top level __init__, this will work.

I implemented the minimum converter required to accurately convert the bundles in $(TOP)/.readthedocs.yml, e.g:

arrays
segment
sim_matrices
alignment_algs
atomic_lib
coulombic
geometry
graphics
map
mask
mlp
morph
realsense
stl
surface
webcam
atom_search
chem_group
connect_structure
dssp
pdb_lib
mmcif
mmtf
pdb
atomic

so it is not generally accurate yet.

It would be helpful to copy these xml files to bundle_builder/tests/xml/{bundle_folder_name}.xml when they change in a major way.

The converter is very dumb. It adds src/lib to library-dirs for each extension whether or not it's needed, for instance. As another example, it adds every build dependency to include-modules whether a specific extension or library needs it or not. This is to guarantee maximum correctness for the widest range of bundles with a minimum number of special casing and assumption making. It also formats them like garbage, e.g.

include-modules = [
  "chimerax.arrays",
  "chimerax.core",
]

instead of

include-modules = ["chimerax.arrays", "chimerax.core"]

Because this ugly formatting is more predictable and therefore testable. A modern editor should auto format it to something sensible automatically the first time you open and save it anyway (and you can cut out what you don't need as desired).

comment:3 by Zach Pearson, 15 months ago

Oh, I forgot to say: it just prints the output to stdout. You can direct that output to whatever file you want.

python -m chimerax.bundle_builder -c bundle_info.xml > pyproject.toml

Note: See TracTickets for help on using tickets.