Skip to content

Commit 8653cd1

Browse files
committed
fix scripts/print_version.nim
1 parent ff042f3 commit 8653cd1

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

beacon_chain/buildinfo.nim

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
66
# at your option. This file may not be copied, modified, or distributed except according to those terms.
77

8-
{.push raises: [].}
8+
{.push raises: [], gcsafe.}
99

1010
## This module implements the version tagging details of all binaries included
1111
## in the Nimbus release process (i.e. beacon_node, validator_client, etc)
1212

13-
import std/[os, strutils], metrics
13+
import std/[os, strutils]
1414

1515
proc gitFolderExists(path: string): bool {.compileTime.} =
1616
# walk up parent folder to find `.git` folder
@@ -60,7 +60,7 @@ template generateGitRevision*(repoPath: string): untyped =
6060
else:
6161
# otherwise we use revision number given by build system.
6262
# e.g. user download from release tarball, or Github zip download.
63-
"00000000"
63+
"00000000"
6464

6565
func getNimGitHash(): string =
6666
const gitPrefix = "git hash: "
@@ -79,5 +79,7 @@ func nimBanner*(): string =
7979
else:
8080
tmp[0]
8181

82-
declareGauge nimVersionGauge, "Nim version info", ["version", "nim_commit"], name = "nim_version"
83-
nimVersionGauge.set(1, labelValues=[NimVersion, getNimGitHash()])
82+
when not defined(nimscript):
83+
import metrics
84+
declareGauge nimVersionGauge, "Nim version info", ["version", "nim_commit"], name = "nim_version"
85+
nimVersionGauge.set(1, labelValues=[NimVersion, getNimGitHash()])

beacon_chain/version.nim

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
## This module implements the version tagging details of all binaries included
1111
## in the Nimbus release process (i.e. beacon_node, validator_client, etc)
1212

13-
import std/[os, strutils], metrics, ./buildinfo
13+
import std/[os, strutils], ./buildinfo
1414

1515
const
1616
versionMajor* = 25
@@ -29,5 +29,8 @@ const
2929

3030
nimbusAgentStr* = "Nimbus/" & fullVersionStr
3131

32-
declareGauge versionGauge, "Nimbus version info (as metric labels)", ["version", "commit"], name = "version"
33-
versionGauge.set(1, labelValues=[fullVersionStr, gitRevision])
32+
echo defined(nimscript)
33+
when not defined(nimscript):
34+
import metrics
35+
declareGauge versionGauge, "Nimbus version info (as metric labels)", ["version", "commit"], name = "version"
36+
versionGauge.set(1, labelValues=[fullVersionStr, gitRevision])

0 commit comments

Comments
 (0)