Skip to content

properly handle invalid and dev versions in version parser, fixes #9014#9608

Open
ThomasWaldmann wants to merge 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:versioning-1.4
Open

properly handle invalid and dev versions in version parser, fixes #9014#9608
ThomasWaldmann wants to merge 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:versioning-1.4

Conversation

@ThomasWaldmann
Copy link
Copy Markdown
Member

  • src/borg/__init__.py: The setuptools_scm fallback version 0.1.dev1 was incorrectly bypassing the assertion check (as 0 and 1 are valid integers), which hid the intended helpful error message when building from source without tags. Added an explicit check for the 0.1.dev prefix.

  • src/borg/version.py: parse_version and format_version have been updated to correctly understand setuptools_scm's .dev or dev prefixes. These dev releases are now properly encoded in the version tuple as -9 (which logically makes them older than alphas -4, betas -3, rcs -2, and final -1), and correctly reformatted to .dev strings.

…borgbackup#9014

- `src/borg/__init__.py`: The `setuptools_scm` fallback version `0.1.dev1`
  was incorrectly bypassing the assertion check (as `0` and `1` are valid
  integers), which hid the intended helpful error message when building
  from source without tags. Added an explicit check for the `0.1.dev` prefix.

- `src/borg/version.py`: `parse_version` and `format_version` have been
  updated to correctly understand `setuptools_scm`'s `.dev` or `dev` prefixes.
  These dev releases are now properly encoded in the version tuple as `-9`
  (which logically makes them older than alphas `-4`, betas `-3`, rcs `-2`,
  and final `-1`), and correctly reformatted to `.dev` strings.
@ThomasWaldmann ThomasWaldmann changed the title fix: properly handle invalid and dev versions in version parser, fixes #9014 properly handle invalid and dev versions in version parser, fixes #9014 May 12, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.00%. Comparing base (35abd99) to head (232ccab).
⚠️ Report is 1 commits behind head on 1.4-maint.

Additional details and impacted files
@@              Coverage Diff              @@
##           1.4-maint    #9608      +/-   ##
=============================================
+ Coverage      81.93%   82.00%   +0.07%     
=============================================
  Files             38       38              
  Lines          11327    11327              
  Branches        1787     1787              
=============================================
+ Hits            9281     9289       +8     
+ Misses          1461     1453       -8     
  Partials         585      585              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant