KineticPreProcessor / KPP

The KPP kinetic preprocessor is a software tool that assists the computer simulation of chemical kinetic systems
GNU General Public License v3.0
22 stars 11 forks source link

Add script to change version numbers before a KPP release #84

Closed yantosca closed 10 months ago

yantosca commented 10 months ago

This PR adds the .release/changeVersionNumbers.sh script, which changes version numbers in the following locations:

NOTE: In CHANGELOG.md, the script will change any of the following:

## [Unreleased]
## [Unreleased] - TBD
## [Unreleased X.Y.Z]
## [Unreleased X.Y.Z] - TBD

to

## [X.Y.Z] - TBD
yantosca commented 10 months ago

This is a nice script that will help us to ensure consistent version numbering in these files!

sed -i -e "s/${1}/${2}/" "${3}"

I'm always scared when I have to use the dollar sign for a shell variable inside a regexp that treats dollar signs as the end of line. Usually this requires escape characters at the right places. Maybe this works here because sed is called without the -E option? Anyway, I guess you have tested it and all is fine.

Yes, this works. I haven't come across any other issues with commands like these. But I'll also make sure this also works on MacOSX as well before I merge.

# X.Y.Z = GCClassic version number

Should this be KPP version number ?

Oops, indeed! I stole this script from GEOS-Chem. :-). I'll fix it.

yantosca commented 10 months ago

@RolfSander: In commit 9387531, I fixed the incorrect comment and have updated the sed command (which I've confirmed works on both Linux and Mac):

function replace() {
    #========================================================================
    # Replacement for `sed -i -e` that works on both MacOS and Linux
    #
    # 1st argument = regular expression
    # 2nd argument = file to be edited
    #========================================================================
    regex="s/${1}/${2}/g"
    file="${3}"
    if [[ "x$(uname -s)" == "xDarwin" ]]; then
        sed -i '' -e "${regex}" "${file}"          # MacOS/Darwin
    else
        sed -i -e "${regex}" "${file}"             # GNU/Linux
    fi
}