fbt: fixes (#1352)
* fbt: added --git-tasks; fixed typos * fbt: fixed --extra-int-apps handling; scripts: moved storage.py & selfupdate.py to App() framework * fbt: changed pseudo-builders to PhonyTargets with commands; added link to latest build dir as build/latest * fbt: Restored old ep git handling * fbt: dropped git tasks & dirlink.py * fbt: removed extra quoting in fbt.cmd * docs: added flash_usb to ReadMe.md Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -2,7 +2,9 @@ import SCons
|
||||
from SCons.Subst import quote_spaces
|
||||
|
||||
import re
|
||||
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
|
||||
WINPATHSEP_RE = re.compile(r"\\([^\"'\\]|$)")
|
||||
|
||||
@@ -17,3 +19,26 @@ def tempfile_arg_esc_func(arg):
|
||||
|
||||
def wrap_tempfile(env, command):
|
||||
env[command] = '${TEMPFILE("' + env[command] + '","$' + command + 'STR")}'
|
||||
|
||||
|
||||
def link_dir(target_path, source_path, is_windows):
|
||||
# print(f"link_dir: {target_path} -> {source_path}")
|
||||
if os.path.lexists(target_path) or os.path.exists(target_path):
|
||||
os.unlink(target_path)
|
||||
if is_windows:
|
||||
# Crete junction
|
||||
import _winapi
|
||||
|
||||
if not os.path.isdir(source_path):
|
||||
raise Exception(f"Source directory {source_path} is not a directory")
|
||||
|
||||
if not os.path.exists(target_path):
|
||||
_winapi.CreateJunction(source_path, target_path)
|
||||
else:
|
||||
os.symlink(source_path, target_path)
|
||||
|
||||
|
||||
def random_alnum(length):
|
||||
return "".join(
|
||||
random.choice(string.ascii_letters + string.digits) for _ in range(length)
|
||||
)
|
||||
|
Reference in New Issue
Block a user