Compare commits

...

2 Commits

Author SHA1 Message Date
336edbdbec Project setup 2025-06-29 15:35:33 +02:00
a8f4d55123 Fixed init_project.py 2025-06-29 15:35:02 +02:00
5 changed files with 14 additions and 8 deletions

View File

@ -1,5 +1,5 @@
config = { config = {
'PROJECT_NAME': '@PROJECT_NAME@' 'PROJECT_NAME': 'WhisperCpp Test'
} }
env = SConscript('external/scons-plus-plus/SConscript', exports = ['config']) env = SConscript('external/scons-plus-plus/SConscript', exports = ['config'])
env.Append(CPPPATH = [Dir('private'), Dir('public')]) env.Append(CPPPATH = [Dir('private'), Dir('public')])
@ -9,6 +9,6 @@ env.RecipeRepo('mewin-stable', 'https://git.mewin.de/mewin/spp_recipes.git', 'st
# env.RecipeRepo('mewin-testing', 'https://git.mewin.de/mewin/spp_recipes.git', 'testing') # env.RecipeRepo('mewin-testing', 'https://git.mewin.de/mewin/spp_recipes.git', 'testing')
# app # app
env = env.Module('private/@MODULE_FOLDER_NAME@/SModule') env = env.Module('private/whispercpp_test/SModule')
env.Finalize() env.Finalize()

View File

@ -6,8 +6,8 @@ src_files = Split("""
""") """)
prog_app = env.UnityProgram( prog_app = env.UnityProgram(
name = '@MODULE_NAME@', name = 'WhisperCpp Test',
target = env['BIN_DIR'] + '/@EXE_NAME@', target = env['BIN_DIR'] + '/whispercpp_test',
source = src_files, source = src_files,
dependencies = { dependencies = {
'mijin': {} 'mijin': {}

View File

@ -11,12 +11,16 @@ _invalid_file_char_regex = re.compile(r'[^a-zA-Z0-9_]')
_invalid_path_char_regex = re.compile(r'[^a-zA-Z0-9_/]') _invalid_path_char_regex = re.compile(r'[^a-zA-Z0-9_/]')
_variable_regex = re.compile(r'@([A-Z_]+)@') _variable_regex = re.compile(r'@([A-Z_]+)@')
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
_root : Path
T = TypeVar('T') T = TypeVar('T')
_Validator : TypeAlias = Callable[[T], bool] _Validator : TypeAlias = Callable[[T], bool]
def get_root() -> Path:
return _root
def script_preamble() -> None: def script_preamble() -> None:
global _root
logging.basicConfig(level=logging.DEBUG, format='%(message)s') logging.basicConfig(level=logging.DEBUG, format='%(message)s')
_root = Path(__file__).parent.parent.parent _root = Path(__file__).parent.parent.parent
os.chdir(_root) os.chdir(_root)
@ -135,4 +139,4 @@ def replace_in_file(file: Path, **replacements) -> None:
def _repl(match: re.Match) -> str: def _repl(match: re.Match) -> str:
return replacements.get(match.group(1), '<invalid variable>') return replacements.get(match.group(1), '<invalid variable>')
fout.write(_variable_regex.sub(_repl, line)) fout.write(_variable_regex.sub(_repl, line))
bakfile.unlink() bakfile.unlink()

View File

@ -9,12 +9,12 @@ import sys
sys.path.append(os.path.dirname(__file__)) sys.path.append(os.path.dirname(__file__))
from common import exec_checked, exec_get_output, prompt, escape_filename, replace_in_file, run_script from common import exec_checked, exec_get_output, prompt, escape_filename, get_root, replace_in_file, run_script
_invalid_file_char_regex = re.compile(r'[^a-zA-Z0-9_]') _invalid_file_char_regex = re.compile(r'[^a-zA-Z0-9_]')
_variable_regex = re.compile(r'@([A-Z_]+)@') _variable_regex = re.compile(r'@([A-Z_]+)@')
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
_root: Path _root : Path
def verify_tools() -> None: def verify_tools() -> None:
_logger.debug('Verifying all required tools are available...') _logger.debug('Verifying all required tools are available...')
@ -107,6 +107,8 @@ def setup_git_remote() -> None:
def script_main(): def script_main():
global _root
_root = get_root()
verify_tools() verify_tools()
download_spp() download_spp()
update_spp() update_spp()