Skip to content

Replace bash parser with Python (shlex) for proper quote handling#3

Merged
fkzys merged 23 commits into
mainfrom
refactor/python-config-parser
May 3, 2026
Merged

Replace bash parser with Python (shlex) for proper quote handling#3
fkzys merged 23 commits into
mainfrom
refactor/python-config-parser

Conversation

@fkzys

@fkzys fkzys commented May 2, 2026

Copy link
Copy Markdown
Owner

Replace the brittle bash-based config parser with a proper Python implementation using shlex for shell-style quote handling.

Key changes:

  • lib/atomic/config.py – new Python parser with:

    • dump – JSON output
    • validate – check numeric values
    • shell – shell-safe KEY=value output
    • array – null-separated token array for CHROOT_COMMAND
  • atomic-upgrade – uses config.py array to parse CHROOT_COMMAND with proper quote support

  • common.shload_config() now consumes config.py shell output

  • Tests – added test_config.py, removed obsolete test_config.sh

  • CI & Makefile – updated to run Python tests, install config.py

Benefits:

  • Arguments with spaces now work: CHROOT_COMMAND="pacman -S 'nvidia dkms'"
  • No more quote stripping limitations
  • Better validation and error messages

@fkzys
fkzys force-pushed the refactor/python-config-parser branch from f309963 to acf2b2d Compare May 3, 2026 12:57
@fkzys
fkzys force-pushed the refactor/python-config-parser branch from 1440f87 to 4899969 Compare May 3, 2026 13:35
@fkzys
fkzys force-pushed the refactor/python-config-parser branch from 00da946 to 5694340 Compare May 3, 2026 17:17
@fkzys
fkzys force-pushed the refactor/python-config-parser branch from 6a90534 to b4c1bb7 Compare May 3, 2026 19:45
@fkzys
fkzys merged commit 32999d8 into main May 3, 2026
14 checks passed
@fkzys
fkzys deleted the refactor/python-config-parser branch May 3, 2026 19:48
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