From 76a7a5e35b13462aa876cd9e9a9702b2c58430ad Mon Sep 17 00:00:00 2001 From: Patrick Wuttke Date: Mon, 6 Nov 2023 20:45:22 +0100 Subject: [PATCH] Only run the generator script if necessary. --- recipes/glslang/recipe.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/recipes/glslang/recipe.py b/recipes/glslang/recipe.py index 3f9d212..368f4a7 100644 --- a/recipes/glslang/recipe.py +++ b/recipes/glslang/recipe.py @@ -2,10 +2,13 @@ from SCons.Script import * import os +import pathlib import platform import subprocess import sys +_SCRIPT_STAMPFILE = '.spp_script_run' + def cook(env: Environment, remote: str = 'github', git_ref: str = '') -> dict: if remote == 'mewin': repo = env.Cook('GitBranch', repo_name = 'glslang_mewin', remote_url = 'https://git.mewin.de/mewin/glslang.git', git_ref = git_ref or 'master') @@ -14,7 +17,10 @@ def cook(env: Environment, remote: str = 'github', git_ref: str = '') -> dict: checkout_root = repo['checkout_root'] # TODO: windows? - subprocess.run(('/usr/bin/env', 'python3', 'update_glslang_sources.py'), cwd=checkout_root, stdout=sys.stdout, stderr=sys.stderr, check=True) + did_run_script = os.path.exists(os.path.join(repo['checkout_root'], _SCRIPT_STAMPFILE)) + if not did_run_script or env['UPDATE_REPOSITORIES']: + subprocess.run(('/usr/bin/env', 'python3', 'update_glslang_sources.py'), cwd=checkout_root, stdout=sys.stdout, stderr=sys.stderr, check=True) + pathlib.Path(repo['checkout_root'], _SCRIPT_STAMPFILE).touch() # build_result = env.Cook('CMakeProject', project_root=checkout_root, generate_args = ['-DBUILD_TESTING=OFF']) # generator_script = os.path.join(repo['checkout_root'], 'gen_extension_headers.py')