openmc icon indicating copy to clipboard operation
openmc copied to clipboard

Add Versioning Support from `version.txt`

Open ahnaf-tahmid-chowdhury opened this issue 5 months ago • 25 comments

Overview

This pull request introduces a versioning mechanism that utilizes a version.txt file located in the tools folder. Both pyproject.toml and CMakeLists.txt have been updated to read version information from this file, ensuring consistency across the project.

Changes

  • Added version.txt: A new file in the tools directory containing the version string in the format X.X.X or X.X.X-any.

  • Updated pyproject.toml:

    • The version field in pyproject.toml is now set to read the version from version.txt. This enables automatic versioning based on the contents of version.txt.
  • Updated CMakeLists.txt:

    • The CMake configuration has been modified to read the version from version.txt and set the OPENMC_VERSION accordingly.
    • Implemented logic to handle versions with optional suffixes (e.g., -dev, -any), ensuring that the header files use only the main version number without the suffix.

Benefits

  • Consistency: Centralizing version information in a single file (version.txt) ensures that both Python and CMake projects remain in sync.
  • Flexibility: The version can be easily updated by modifying just one file, simplifying version management.

Fixs

  • #3136

ahnaf-tahmid-chowdhury avatar Sep 24 '24 06:09 ahnaf-tahmid-chowdhury