gh-36136: `sage.combinat.root_system`: Modularization fixes, `# needs`
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->
Most of the package `sage.combinat.root_system` is intended to be
shipped by the distribution **sagemath-modules**, and much of the
functionality can be tested in the modularized setting.
- Some functionality depends on other distributions, in particular
**sagemath-graphs** (via Dynkin diagrams). The doctests are marked as `#
needs sage.graphs`.
- Other doctests that depend on combinatorics functionality such as
Tableaux are marked `# needs sage.combinat`.
- Use of Weyl and Coxeter groups is marked `# needs sage.libs.gap`, `#
needs sage.rings.number_field`, `# needs sage.symbolic`, or `# needs
sage.groups`.
- Some imports are changed to `lazy_import`; in some places, the changed
code uses the fact that `isinstance(x, cls)` gives False for unresolved
lazy import `cls`.
- Some `_test_...` and `some_elements` methods are changed so that
`ImportError`s do not lead to test failures.
- The hardcoded dependence of `CartanMatrix` on `Matrix_integer_sparse`
(which has complicated compile-time dependencies) is relaxed.
- doctest cosmetics: Breaking long lines in doctest input and output so
that it can be read in the HTML documentation without (or with less)
horizontal scrolling
<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
- Part of: #29705
- Cherry-picked from: #35095
<!-- If your change requires a documentation PR, please link it
appropriately. -->
### :memo: Checklist
<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->
- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.
### :hourglass: Dependencies
<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
URL: https://github.com/sagemath/sage/pull/36136
Reported by: Matthias Köppe
Reviewer(s): David Coudert, Matthias Köppe