Skip to content

Commit 2dcc17e

Browse files
authored
Added Basilisp and Python version vars to basilisp.core (#584)
1 parent b61d381 commit 2dcc17e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
* Added support for auto-resolving namespaces for keyword from the current namespace using the `::kw` syntax (#576)
1010
* Added support for namespaced map syntax (#577)
1111
* Added support for numeric constant literals for NaN, positive infinity, and negative infinity (#582)
12+
* Added `*basilisp-version*` and `*python-version*` Vars to `basilisp.core` (#584)
1213

1314
### Fixed
1415
* Fixed a bug where `def` forms did not permit recursive references to the `def`'ed Vars (#578)

src/basilisp/lang/runtime.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import logging
77
import math
88
import re
9+
import sys
910
import threading
1011
import types
1112
from collections.abc import Sequence
@@ -76,6 +77,8 @@
7677
_PRINT_LEVEL_VAR_NAME = "*print-level*"
7778
_PRINT_META_VAR_NAME = "*print-meta*"
7879
_PRINT_READABLY_VAR_NAME = "*print-readably*"
80+
_PYTHON_VERSION = "*python-version*"
81+
_BASILISP_VERSION = "*basilisp-version*"
7982

8083
# Common meta keys
8184
_DYNAMIC_META_KEY = kw.keyword("dynamic")
@@ -1826,6 +1829,19 @@ def in_ns(s: sym.Symbol):
18261829
dynamic=True,
18271830
)
18281831

1832+
# Version info
1833+
from basilisp.__version__ import VERSION
1834+
1835+
Var.intern(
1836+
CORE_NS_SYM,
1837+
sym.symbol(_PYTHON_VERSION),
1838+
vec.vector(sys.version_info),
1839+
dynamic=True,
1840+
)
1841+
Var.intern(
1842+
CORE_NS_SYM, sym.symbol(_BASILISP_VERSION), vec.vector(VERSION), dynamic=True
1843+
)
1844+
18291845

18301846
def get_compiler_opts() -> CompilerOpts:
18311847
"""Return the current compiler options map."""

0 commit comments

Comments
 (0)