@@ -327,20 +327,23 @@ def _work_to_do(self, env: dict[str, str]) -> bool:
327
327
328
328
@functools .lru_cache (maxsize = 1 )
329
329
def _rebuild (self ) -> Node :
330
- # skip editable wheel lookup during rebuild: during the build
331
- # the module we are rebuilding might be imported causing a
332
- # rebuild loop.
333
- env = os .environ .copy ()
334
- env [MARKER ] = os .pathsep .join ((env .get (MARKER , '' ), self ._build_path ))
335
-
336
- if self ._verbose or bool (env .get (VERBOSE , '' )):
337
- # We want to show some output only if there is some work to do
338
- if self ._work_to_do (env ):
339
- build_command = ' ' .join (self ._build_cmd )
340
- print (f'meson-python: building { self ._name } : { build_command } ' , flush = True )
341
- subprocess .run (self ._build_cmd , cwd = self ._build_path , env = env )
342
- else :
343
- subprocess .run (self ._build_cmd , cwd = self ._build_path , env = env , stdout = subprocess .DEVNULL )
330
+ try :
331
+ # Skip editable wheel lookup during rebuild: during the build
332
+ # the module we are rebuilding might be imported causing a
333
+ # rebuild loop.
334
+ env = os .environ .copy ()
335
+ env [MARKER ] = os .pathsep .join ((env .get (MARKER , '' ), self ._build_path ))
336
+
337
+ if self ._verbose or bool (env .get (VERBOSE , '' )):
338
+ # We want to show some output only if there is some work to do.
339
+ if self ._work_to_do (env ):
340
+ build_command = ' ' .join (self ._build_cmd )
341
+ print (f'meson-python: building { self ._name } : { build_command } ' , flush = True )
342
+ subprocess .run (self ._build_cmd , cwd = self ._build_path , env = env , check = True )
343
+ else :
344
+ subprocess .run (self ._build_cmd , cwd = self ._build_path , env = env , stdout = subprocess .DEVNULL , check = True )
345
+ except subprocess .CalledProcessError as exc :
346
+ raise ImportError (f're-building the { self ._name } meson-python editable wheel package failed' ) from exc
344
347
345
348
install_plan_path = os .path .join (self ._build_path , 'meson-info' , 'intro-install_plan.json' )
346
349
with open (install_plan_path , 'r' , encoding = 'utf8' ) as f :
0 commit comments