mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
fix missing buildinfo on Windows
This commit is contained in:
parent
29ae7480f2
commit
3f47ff9abd
2 changed files with 9 additions and 5 deletions
|
@ -5,8 +5,8 @@ use lazy_static::lazy_static;
|
|||
use std::env;
|
||||
|
||||
fn buildinfo(key: &str) -> &'static str {
|
||||
let volatile = include_str!(concat!(env!("OUT_DIR"), "/../../buildinfo.txt"));
|
||||
for line in volatile.split('\n') {
|
||||
let buildinfo = include_str!(concat!(env!("OUT_DIR"), "/../../buildinfo.txt"));
|
||||
for line in buildinfo.split('\n') {
|
||||
let mut it = line.split(' ');
|
||||
if it.next().unwrap() == key {
|
||||
return it.next().unwrap();
|
||||
|
|
|
@ -9,15 +9,19 @@ release_mode = sys.argv[3] == "release"
|
|||
|
||||
version_re = re.compile('anki_version = "(.*)"')
|
||||
|
||||
def output(text: str) -> None:
|
||||
"Add text with a '\n' to stdout; avoiding a '\r' on Windows"
|
||||
sys.stdout.buffer.write(text.encode("utf8") + b"\n")
|
||||
|
||||
# extract version number from defs.bzl
|
||||
for line in open(defs_file).readlines():
|
||||
if ver := version_re.match(line):
|
||||
print(f"STABLE_VERSION {ver.group(1)}")
|
||||
output(f"STABLE_VERSION {ver.group(1)}")
|
||||
|
||||
for line in open(stamp_file).readlines():
|
||||
if line.startswith("STABLE_BUILDHASH"):
|
||||
if release_mode:
|
||||
print(line.strip())
|
||||
output(line.strip())
|
||||
else:
|
||||
# if not in release mode, map buildhash to a consistent value
|
||||
print("STABLE_BUILDHASH dev")
|
||||
output("STABLE_BUILDHASH dev")
|
||||
|
|
Loading…
Reference in a new issue