@@ -132,6 +132,46 @@ export async function westUpdate(context: vscode.ExtensionContext, wsConfig: Wor
132
132
if ( zephyrModuleInfo ) {
133
133
wsConfig . activeSetupState . zephyrDir = zephyrModuleInfo . path ;
134
134
wsConfig . activeSetupState . zephyrVersion = await getModuleVersion ( zephyrModuleInfo . path ) ;
135
+ } else {
136
+ // Fallback: check for zephyr/VERSION file in setupPath
137
+ const zephyrVersionFile = path . join ( wsConfig . activeSetupState . setupPath , "zephyr" , "VERSION" ) ;
138
+ if ( fs . existsSync ( zephyrVersionFile ) ) {
139
+ try {
140
+ const versionContent = fs . readFileSync ( zephyrVersionFile , "utf8" ) ;
141
+ // Parse version info
142
+ const majorMatch = versionContent . match ( / V E R S I O N _ M A J O R \s * = \s * ( \d + ) / ) ;
143
+ const minorMatch = versionContent . match ( / V E R S I O N _ M I N O R \s * = \s * ( \d + ) / ) ;
144
+ const patchMatch = versionContent . match ( / P A T C H L E V E L \s * = \s * ( \d + ) / ) ;
145
+ const tweakMatch = versionContent . match ( / V E R S I O N _ T W E A K \s * = \s * ( \d + ) / ) ;
146
+ const extraMatch = versionContent . match ( / E X T R A V E R S I O N \s * = \s * ( .* ) / ) ;
147
+ let version = "" ;
148
+ if ( majorMatch && minorMatch && patchMatch ) {
149
+ version = `${ majorMatch [ 1 ] } .${ minorMatch [ 1 ] } .${ patchMatch [ 1 ] } ` ;
150
+ if ( tweakMatch && tweakMatch [ 1 ] !== "0" ) {
151
+ version += `.${ tweakMatch [ 1 ] } ` ;
152
+ }
153
+ if ( extraMatch && extraMatch [ 1 ] . trim ( ) ) {
154
+ version += `-${ extraMatch [ 1 ] . trim ( ) } ` ;
155
+ }
156
+ wsConfig . activeSetupState . zephyrDir = path . join ( wsConfig . activeSetupState . setupPath , "zephyr" ) ;
157
+ // Parse version string into ZephyrVersionNumber type
158
+ wsConfig . activeSetupState . zephyrVersion = {
159
+ major : majorMatch ? parseInt ( majorMatch [ 1 ] ) : 0 ,
160
+ minor : minorMatch ? parseInt ( minorMatch [ 1 ] ) : 0 ,
161
+ patch : patchMatch ? parseInt ( patchMatch [ 1 ] ) : 0 ,
162
+ tweak : tweakMatch ? parseInt ( tweakMatch [ 1 ] ) : 0 ,
163
+ extra : extraMatch && extraMatch [ 1 ] . trim ( ) !== "" ? parseInt ( extraMatch [ 1 ] . trim ( ) ) : 0
164
+ } ;
165
+ output . appendLine ( `[SETUP] Zephyr version detected from VERSION file: ${ version } ` ) ;
166
+ } else {
167
+ vscode . window . showErrorMessage ( "West Update succeeded, but Zephyr VERSION file could not be parsed." ) ;
168
+ }
169
+ } catch ( err ) {
170
+ vscode . window . showErrorMessage ( "West Update succeeded, but error reading Zephyr VERSION file." ) ;
171
+ }
172
+ } else {
173
+ vscode . window . showErrorMessage ( "West Update succeeded, but Zephyr module information could not be found." ) ;
174
+ }
135
175
}
136
176
137
177
reloadEnvironmentVariables ( context , wsConfig . activeSetupState ) ;
@@ -160,16 +200,11 @@ export async function installPythonRequirements(context: vscode.ExtensionContext
160
200
return false ;
161
201
}
162
202
163
- let zephyrPath = await getModulePathAndVersion ( wsConfig . activeSetupState , "zephyr" ) ;
164
- if ( ! zephyrPath || ! zephyrPath . path ) {
165
- vscode . window . showErrorMessage ( 'Zephyr IDE: Zephyr folder not found. Please call West Update First' ) ;
166
- return false ;
167
- }
168
203
169
204
wsConfig . activeSetupState . packagesInstalled = false ;
170
205
saveSetupState ( context , wsConfig , globalConfig ) ;
171
206
172
- let cmd = `pip install -r ${ path . join ( zephyrPath . path , "scripts" , "requirements.txt" ) } -U dtsh patool semvar tqdm` ;
207
+ let cmd = `pip install -r ${ path . join ( wsConfig . activeSetupState . zephyrDir , "scripts" , "requirements.txt" ) } -U dtsh patool semvar tqdm` ;
173
208
let reqRes = await executeTaskHelperInPythonEnv ( wsConfig . activeSetupState , "Zephyr IDE: Install Python Requirements" , cmd , wsConfig . activeSetupState . setupPath ) ;
174
209
175
210
if ( ! reqRes ) {
0 commit comments