@@ -76,15 +76,13 @@ def get_github_repo():
7676 # Any other unexpected error
7777 return None
7878
79- PACKAGE_FILE = "package.json"
80-
81- def get_version ():
82- try :
83- with open (PACKAGE_FILE , "r" ) as package :
84- return json .load (package )["version" ]
85- except (FileNotFoundError , KeyError , json .JSONDecodeError ):
86- return None
87-
79+ # WLED version is managed by package.json; this is picked up in several places
80+ # - It's integrated in to the UI code
81+ # - Here, for wled_metadata.cpp
82+ # - The output_bins script
83+ # We always take it from package.json to ensure consistency
84+ with open ("package.json" , "r" ) as package :
85+ WLED_VERSION = json .load (package )["version" ]
8886
8987def has_def (cppdefs , name ):
9088 """ Returns true if a given name is set in a CPPDEFINES collection """
@@ -104,10 +102,7 @@ def add_wled_metadata_flags(env, node):
104102 if repo :
105103 cdefs .append (("WLED_REPO" , f"\\ \" { repo } \\ \" " ))
106104
107- if not has_def (cdefs , "WLED_VERSION" ):
108- version = get_version ()
109- if version :
110- cdefs .append (("WLED_VERSION" , version ))
105+ cdefs .append (("WLED_VERSION" , WLED_VERSION ))
111106
112107 # This transforms the node in to a Builder; it cannot be modified again
113108 return env .Object (
0 commit comments