openmc
openmc copied to clipboard
Add Versioning Support from `version.txt`
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 thetools
directory containing the version string in the formatX.X.X
orX.X.X-any
. -
Updated
pyproject.toml
:- The version field in
pyproject.toml
is now set to read the version fromversion.txt
. This enables automatic versioning based on the contents ofversion.txt
.
- The version field in
-
Updated
CMakeLists.txt
:- The CMake configuration has been modified to read the version from
version.txt
and set theOPENMC_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.
- The CMake configuration has been modified to read the version from
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