nimbus-eth2/beacon_chain/version.nim

48 lines
1.5 KiB
Nim
Raw Normal View History

2022-05-30 15:36:40 +00:00
# Copyright (c) 2018-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
2022-07-29 10:53:42 +00:00
when (NimMajor, NimMinor) < (1, 4):
{.push raises: [Defect].}
else:
{.push raises: [].}
import strutils
when not defined(nimscript):
import times
let copyrights* = "Copyright (c) 2019-" & $(now().utc.year) & " Status Research & Development GmbH"
2019-11-11 14:43:12 +00:00
const
2022-03-07 13:42:20 +00:00
versionMajor* = 22
2022-09-08 13:04:27 +00:00
versionMinor* = 9
versionBuild* = 0
2020-11-20 20:31:03 +00:00
versionBlob* = "stateofus" # Single word - ends up in the default graffiti
2021-03-10 21:05:14 +00:00
gitRevision* = strip(staticExec("git rev-parse --short HEAD"))[0..5]
nimBanner* = staticExec("nim --version | grep Version")
versionAsStr* =
$versionMajor & "." & $versionMinor & "." & $versionBuild
2020-11-25 01:13:35 +00:00
fullVersionStr* = "v" & versionAsStr & "-" & gitRevision & "-" & versionBlob
func shortNimBanner*(): string =
const gitPrefix = "git hash: "
let tmp = splitLines(nimBanner)
if tmp.len == 0:
return
var gitHash = ""
for line in tmp:
if line.startsWith(gitPrefix) and line.len > 8 + gitPrefix.len:
gitHash = line[gitPrefix.len..<gitPrefix.len + 8]
if gitHash.len > 0:
tmp[0] & " (" & gitHash & ")"
else:
tmp[0]