Use git_identifier instead of version_number

This commit is contained in:
ChJR
2019-09-22 17:43:37 +09:00
parent fd64763088
commit ca48e64266
2 changed files with 12 additions and 1 deletions

View File

@@ -166,7 +166,7 @@ fn sys_exc_info(vm: &VirtualMachine) -> PyResult {
fn sys_git_info(vm: &VirtualMachine) -> PyObjectRef {
vm.ctx.new_tuple(vec![
vm.ctx.new_str("RustPython".to_string()),
vm.ctx.new_str(version::get_version_number()),
vm.ctx.new_str(version::get_git_identifier()),
vm.ctx.new_str(version::get_git_revision()),
])
}

View File

@@ -47,3 +47,14 @@ pub fn get_git_branch() -> String {
.unwrap_or("")
.to_string()
}
pub fn get_git_identifier() -> String {
let git_tag = get_git_tag();
let git_branch = get_git_branch();
if git_tag.is_empty() || git_tag == "undefined" {
git_branch
} else {
git_tag
}
}