File tree 3 files changed +18
-2
lines changed 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change
1
+
2
+ ### Changed
3
+
4
+ - fix #957 - add subprocess timeout control env var
Original file line number Diff line number Diff line change @@ -14,3 +14,10 @@ where the dist name normalization follows adapted PEP 503 semantics.
14
14
15
15
setuptools_scm parses the environment variable ` SETUPTOOLS_SCM_OVERRIDES_FOR_${NORMALIZED_DIST_NAME} `
16
16
as a toml inline map to override the configuration data from ` pyproject.toml ` .
17
+
18
+ ## subprocess timeouts
19
+
20
+ The environment variable ` SETUPTOOLS_SCM_SUBPROCESS_TIMEOUT ` allows to override the subprocess timeout.
21
+ The default is 40 seconds and should work for most needs. However, users with git lfs + windows reported
22
+ situations where this was not enough.
23
+
Original file line number Diff line number Diff line change 25
25
# unfortunately github CI for windows sometimes needs
26
26
# up to 30 seconds to start a command
27
27
28
- BROKEN_TIMEOUT : Final [int ] = 40
28
+ def _get_timeout (env : Mapping [str , str ]) -> int :
29
+ return int (env .get ("SETUPTOOLS_SCM_SUBPROCESS_TIMEOUT" ) or 40 )
30
+
31
+ BROKEN_TIMEOUT : Final [int ] = _get_timeout (os .environ )
29
32
30
33
log = _log .log .getChild ("run_cmd" )
31
34
@@ -132,7 +135,7 @@ def run(
132
135
* ,
133
136
strip : bool = True ,
134
137
trace : bool = True ,
135
- timeout : int = BROKEN_TIMEOUT ,
138
+ timeout : int | None = None ,
136
139
check : bool = False ,
137
140
) -> CompletedProcess :
138
141
if isinstance (cmd , str ):
@@ -141,6 +144,8 @@ def run(
141
144
cmd = [os .fspath (x ) for x in cmd ]
142
145
cmd_4_trace = " " .join (map (_unsafe_quote_for_display , cmd ))
143
146
log .debug ("at %s\n $ %s " , cwd , cmd_4_trace )
147
+ if timeout is None :
148
+ timeout = BROKEN_TIMEOUT
144
149
res = subprocess .run (
145
150
cmd ,
146
151
capture_output = True ,
You can’t perform that action at this time.
0 commit comments