@@ -55,7 +55,6 @@ class Python3Recipe(TargetPythonRecipe):
5555 '''
5656
5757 version = '3.14.2'
58- _p_version = Version (version )
5958 url = 'https://github.com/python/cpython/archive/refs/tags/v{version}.tar.gz'
6059 name = 'python3'
6160
@@ -64,28 +63,6 @@ class Python3Recipe(TargetPythonRecipe):
6463 'patches/reproducible-buildinfo.diff' ,
6564 ]
6665
67- if _p_version .major == 3 and _p_version .minor == 7 :
68- patches += [
69- 'patches/py3.7.1_fix-ctypes-util-find-library.patch' ,
70- 'patches/py3.7.1_fix-zlib-version.patch' ,
71- ]
72-
73- if 8 <= _p_version .minor <= 10 :
74- patches .append ('patches/py3.8.1.patch' )
75-
76- if _p_version .minor >= 11 :
77- patches .append ('patches/cpython-311-ctypes-find-library.patch' )
78-
79- if _p_version .minor >= 14 :
80- patches .append ('patches/3.14_armv7l_fix.patch' )
81- patches .append ('patches/3.14_fix_remote_debug.patch' )
82-
83- if shutil .which ('lld' ) is not None :
84- if _p_version .minor == 7 :
85- patches .append ("patches/py3.7.1_fix_cortex_a8.patch" )
86- elif _p_version .minor >= 8 :
87- patches .append ("patches/py3.8.1_fix_cortex_a8.patch" )
88-
8966 depends = ['hostpython3' , 'sqlite3' , 'openssl' , 'libffi' ]
9067 # those optional depends allow us to build python compression modules:
9168 # - _bz2.so
@@ -116,11 +93,6 @@ class Python3Recipe(TargetPythonRecipe):
11693 'ac_cv_header_bzlib_h=no' ,
11794 ]
11895
119- if _p_version .minor >= 11 :
120- configure_args .extend ([
121- '--with-build-python={python_host_bin}' ,
122- ])
123-
12496 '''The configure arguments needed to build the python recipe. Those are
12597 used in method :meth:`build_arch` (if not overwritten like python3's
12698 recipe does).
@@ -210,6 +182,34 @@ def link_version(self):
210182 flags = flags
211183 )
212184
185+ def apply_patches (self , arch , build_dir = None ):
186+
187+ _p_version = Version (self .version )
188+ if _p_version .major == 3 and _p_version .minor == 7 :
189+ self .patches += [
190+ 'patches/py3.7.1_fix-ctypes-util-find-library.patch' ,
191+ 'patches/py3.7.1_fix-zlib-version.patch' ,
192+ ]
193+
194+ if 8 <= _p_version .minor <= 10 :
195+ self .patches .append ('patches/py3.8.1.patch' )
196+
197+ if _p_version .minor >= 11 :
198+ self .patches .append ('patches/cpython-311-ctypes-find-library.patch' )
199+
200+ if _p_version .minor >= 14 :
201+ self .patches .append ('patches/3.14_armv7l_fix.patch' )
202+ self .patches .append ('patches/3.14_fix_remote_debug.patch' )
203+
204+ if shutil .which ('lld' ) is not None :
205+ if _p_version .minor == 7 :
206+ self .patches .append ("patches/py3.7.1_fix_cortex_a8.patch" )
207+ elif _p_version .minor >= 8 :
208+ self .patches .append ("patches/py3.8.1_fix_cortex_a8.patch" )
209+
210+ self .patches = list (set (self .patches ))
211+ super ().apply_patches (arch , build_dir )
212+
213213 def include_root (self , arch_name ):
214214 return join (self .get_build_dir (arch_name ), 'Include' )
215215
@@ -317,9 +317,15 @@ def add_flags(include_flags, link_dirs, link_libs):
317317 env ['ZLIB_VERSION' ] = line .replace ('#define ZLIB_VERSION ' , '' )
318318 add_flags (' -I' + zlib_includes , ' -L' + zlib_lib_path , ' -lz' )
319319
320- if self ._p_version .minor >= 13 and self .disable_gil :
320+ _p_version = Version (self .version )
321+ if _p_version .minor >= 11 :
322+ self .configure_args .append ('--with-build-python={python_host_bin}' )
323+
324+ if _p_version .minor >= 13 and self .disable_gil :
321325 self .configure_args .append ("--disable-gil" )
322326
327+ self .configure_args = list (set (self .configure_args ))
328+
323329 return env
324330
325331 def build_arch (self , arch ):
0 commit comments