1212
1313@nox .session
1414def validate_code (session ):
15- session .run_always (
15+ session .run_install (
1616 "pdm" , "sync" , "--clean" , "-G" , "dev" , "--no-self" , external = True
1717 )
1818 session .run ("pdm" , "validate_code" , external = True )
@@ -78,8 +78,12 @@ def _test(session, env=None, with_fft=True):
7878@nox .session
7979def test_without_fft_and_pythran (session ):
8080 command = "pdm sync --clean -G dev -G test -G mpi --no-self"
81- session .run_always (* command .split (), external = True )
82- session .install ("." , "-C" , "setup-args=-Dtransonic-backend=python" , "--no-deps" )
81+ session .run_install (
82+ * command .split (), external = True , env = _get_modified_env (session )
83+ )
84+ session .install (
85+ "." , "-C" , "setup-args=-Dtransonic-backend=python" , "--no-deps"
86+ )
8387
8488 _test (
8589 session ,
@@ -95,17 +99,35 @@ def __init__(self):
9599 def __call__ (self , task : str ):
96100 time_now = time ()
97101 if self .time_start != self .time_last :
98- print (f"Time for { task } : { timedelta (seconds = time_now - self .time_last )} " )
99- print (f"Session started since { timedelta (seconds = time_now - self .time_start )} " )
102+ print (
103+ f"Time for { task } : { timedelta (seconds = time_now - self .time_last )} "
104+ )
105+ print (
106+ f"Session started since { timedelta (seconds = time_now - self .time_start )} "
107+ )
100108 self .time_last = time_now
101109
102110
111+ def _get_modified_env (session ):
112+ out = session .run_install (
113+ "python3" ,
114+ "-c" ,
115+ "from sysconfig import get_config_var as g; print(g('CFLAGS'))" ,
116+ silent = True ,
117+ )
118+ cflags = " " .join (flag for flag in out .split () if flag != "-g" )
119+ env = os .environ .copy ()
120+ env ["CFLAGS" ] = cflags
121+
122+
103123@nox .session
104124def test_with_fft_and_pythran (session ):
105125 print_times = TimePrinter ()
106126
107127 command = "pdm sync --clean -G dev -G test -G fft -G mpi --no-self"
108- session .run_always (* command .split (), external = True )
128+ session .run_install (
129+ * command .split (), external = True , env = _get_modified_env (session )
130+ )
109131
110132 print_times ("pdm sync" )
111133
@@ -132,7 +154,9 @@ def test_examples(session):
132154 """Execute the examples using pytest"""
133155
134156 command = "pdm sync --clean -G test -G mpi -G fft -G dev --no-self"
135- session .run_always (* command .split (), external = True )
157+ session .run_install (
158+ * command .split (), external = True , env = _get_modified_env (session )
159+ )
136160
137161 command = "."
138162 if "GITLAB_CI" in os .environ :
@@ -150,10 +174,12 @@ def doc(session):
150174 """Build the documentation"""
151175 print_times = TimePrinter ()
152176 command = "pdm sync -G doc -G fft -G test -G dev --no-self"
153- session .run_always (* command .split (), external = True )
177+ session .run_install (* command .split (), external = True )
154178 print_times ("pdm sync" )
155179
156- session .install ("." , "-C" , "setup-args=-Dtransonic-backend=python" , "--no-deps" )
180+ session .install (
181+ "." , "-C" , "setup-args=-Dtransonic-backend=python" , "--no-deps"
182+ )
157183 print_times ("install self" )
158184
159185 session .chdir ("doc" )
@@ -188,7 +214,9 @@ def _get_version_from_pyproject(path=Path.cwd()):
188214def add_tag_for_release (session ):
189215 session .run ("hg" , "pull" , external = True )
190216
191- result = session .run (* "hg log -r default -G" .split (), external = True , silent = True )
217+ result = session .run (
218+ * "hg log -r default -G" .split (), external = True , silent = True
219+ )
192220 if result [0 ] != "@" :
193221 session .run ("hg" , "update" , "default" , external = True )
194222
0 commit comments