Skip to content

Commit d9f2cd6

Browse files
committed
Added core.version.GIT_COMMIT
Added GIT_COMMIT to "sp info" output. Updated core.version.is_unversioned() documentation. Changed core.version.VERSION to be None instead of 'unversioned'
1 parent 0487c52 commit d9f2cd6

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

‎addons/source-python/packages/source-python/core/command/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from core import core_logger
2323
from core import SOURCE_ENGINE_BRANCH
2424
from core.version import VERSION
25+
from core.version import GIT_COMMIT
2526
# Engines
2627
from engines.server import execute_server_command
2728
from engines.server import queue_command_string
@@ -132,6 +133,7 @@ def print_info(info):
132133
result += '\nOS : {}'.format(platform.platform())
133134
result += '\nGame : {}'.format(SOURCE_ENGINE_BRANCH)
134135
result += '\nSP version : {}'.format(VERSION)
136+
result += '\nGithub commit : {}'.format(GIT_COMMIT)
135137
result += '\nServer plugins:'
136138
for index, plugin in enumerate(server_plugin_manager.loaded_plugins):
137139
result += '\n {:02d}: {}'.format(index, plugin.name)

‎addons/source-python/packages/source-python/core/version.py‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# >> ALL DECLARATION
1717
# =============================================================================
1818
__all__ = ('VERSION',
19+
'GIT_COMMIT',
1920
'get_last_successful_build_number',
2021
'is_unversioned',
2122
)
@@ -24,7 +25,11 @@
2425
# =============================================================================
2526
# >> CONSTANTS
2627
# =============================================================================
27-
VERSION = 'unversioned'
28+
#: Version of the Source.Python intallation.
29+
VERSION = None
30+
31+
#: The Github commit this Source.Python version was built with.
32+
GIT_COMMIT = None
2833

2934
LAST_SUCCESSFUL_BUILD_NUMBER_URL = (
3035
'http://builds.sourcepython.com/job/Source.Python' +
@@ -53,8 +58,13 @@ def get_last_successful_build_number(timeout=3):
5358

5459

5560
def is_unversioned():
56-
"""Return True if the current version is set to 'unversioned'.
61+
"""Return ``True`` if this Source.Python installation has no version.
62+
63+
This can happen in multiple cases:
64+
65+
* This is an unofficial build (not a build from the build server).
66+
* The Python files have been updated directly from the repository.
5767
5868
:rtype: bool
5969
"""
60-
return VERSION == 'unversioned'
70+
return VERSION is None

0 commit comments

Comments
 (0)