Skip to content

pxml/autoxml: Replace hacky regex parsing with a list comprehension#235

Open
joebonrichie wants to merge 1 commit intomainfrom
autoxml-declorder
Open

pxml/autoxml: Replace hacky regex parsing with a list comprehension#235
joebonrichie wants to merge 1 commit intomainfrom
autoxml-declorder

Conversation

@joebonrichie
Copy link
Copy Markdown
Contributor

@joebonrichie joebonrichie commented May 3, 2026

Summary

It's a bit hard to slouth why this code was added, however, it appears
to be to ensure the source code order of the keys was respected. With
PEP 520, this should no longer be an issue, as it ensures class
namespace ordering since Python 3.7.

Additionally, previously, some python source code garbage was finding
it's way in the variable, e.g.

Before:

['t_Distribution', 't_Specs', 't_Packages', '#',
't_Components', 't_Groups', 'if', 'obsoletes_list', 'obsoletes_list',
'latest_packages', 'for', 'if', 'latest_packages.append((pkg,', 'if',
'self.packages']

Now

['t_Distribution', 't_Specs', 't_Packages', 't_Components', 't_Groups']

This also provides a nice speedup throughout the codebase, in one case
providing up to a 1.42x speedup from listing the installed files of the
systemd package.

Test Plan

Run a few eopkg operations, install, remove, info, li, la, lu etc.
Print out decl_order before and after, verifying it was the same except for the garbage python source code inserts now removed

@joebonrichie joebonrichie force-pushed the autoxml-declorder branch 2 times, most recently from 4b530a6 to e22195f Compare May 6, 2026 12:55
@joebonrichie joebonrichie marked this pull request as ready for review May 6, 2026 12:57
It's a bit hard to slouth why this code was added, however, it appears
to be to ensure the source code order of the keys was respected. With
PEP 520, this should no longer be an issue, as it ensures class
namespace ordering since Python 3.7.

Additionally, previously, some python source code garbage was finding
it's way in the variable, e.g.

Before:
```
['t_Distribution', 't_Specs', 't_Packages', '#',
't_Components', 't_Groups', 'if', 'obsoletes_list', 'obsoletes_list',
'latest_packages', 'for', 'if', 'latest_packages.append((pkg,', 'if',
'self.packages']
```

Now
```
['t_Distribution', 't_Specs', 't_Packages', 't_Components', 't_Groups']
```

This also provides a nice speedup throughout the codebase, in one case
providing up to a 1.42x speedup from listing the installed files of the
systemd package.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant