Skip to content

fix versioning in wheel#31

Merged
hariharan-devarajan merged 1 commit intodevelopfrom
fix/versioning-wheel
Oct 23, 2025
Merged

fix versioning in wheel#31
hariharan-devarajan merged 1 commit intodevelopfrom
fix/versioning-wheel

Conversation

@rayandrew
Copy link
Collaborator

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes versioning in wheel distributions by enabling version information to persist when Git is unavailable. The changes ensure that VERSION.txt is created during distribution and can be read when building from an sdist package.

  • Adds fallback to read version from VERSION.txt file when Git repository is unavailable
  • Creates VERSION.txt in distribution packages via meson dist script
  • Ensures output directory exists before writing VERSION.txt

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
scripts/versioning/scm_version.py Added VERSION.txt fallback for non-git environments and directory creation before file write
meson.build Added dist script to write VERSION.txt into distribution packages

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +31 to +32
script_dir = os.path.dirname(os.path.abspath(__file__))
version_file = os.path.join(script_dir, 'VERSION.txt')
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VERSION.txt path is hardcoded relative to the script location, but the meson.build script writes it to scripts/versioning/VERSION.txt relative to MESON_DIST_ROOT. This path mismatch will cause the fallback to fail when the script is executed from different locations or in installed packages.

Suggested change
script_dir = os.path.dirname(os.path.abspath(__file__))
version_file = os.path.join(script_dir, 'VERSION.txt')
version_file = os.path.join('scripts', 'versioning', 'VERSION.txt')

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore this

Comment on lines +37 to +38
except Exception:
pass
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bare except Exception silently swallows all errors including IOError, PermissionError, and UnicodeDecodeError. This makes debugging difficult if the VERSION.txt file exists but cannot be read. Consider catching specific exceptions or logging the error.

Suggested change
except Exception:
pass
except (OSError, IOError, PermissionError, UnicodeDecodeError) as e:
print(f"Error reading VERSION.txt: {e}", file=sys.stderr)

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore this

@hariharan-devarajan hariharan-devarajan merged commit a172434 into develop Oct 23, 2025
@rayandrew rayandrew deleted the fix/versioning-wheel branch October 23, 2025 00:13
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.

3 participants