@@ -594,6 +594,9 @@ class PythonRecipe(Recipe):
594594 call_hostpython_via_targetpython is False.
595595 '''
596596
597+ setup_extra_args = []
598+ '''List of extra arugments to pass to setup.py'''
599+
597600 @property
598601 def hostpython_location (self ):
599602 if not self .call_hostpython_via_targetpython :
@@ -635,19 +638,21 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
635638 hostpython = sh .Command (self .hostpython_location )
636639
637640 if self .call_hostpython_via_targetpython :
638- shprint (hostpython , 'setup.py' , 'install' , '-O2' , _env = env )
641+ shprint (hostpython , 'setup.py' , 'install' , '-O2' , _env = env ,
642+ * self .setup_extra_args )
639643 else :
640644 shprint (hostpython , 'setup.py' , 'install' , '-O2' ,
641645 '--root={}' .format (self .ctx .get_python_install_dir ()),
642646 '--install-lib=lib/python2.7/site-packages' ,
643- _env = env ) # AND: Hardcoded python2.7 needs fixing
647+ _env = env , * self .setup_extra_args )
648+ # AND: Hardcoded python2.7 needs fixing
644649
645650 # If asked, also install in the hostpython build dir
646651 if self .install_in_hostpython :
647652 shprint (hostpython , 'setup.py' , 'install' , '-O2' ,
648653 '--root={}' .format (dirname (self .hostpython_location )),
649654 '--install-lib=Lib/site-packages' ,
650- _env = env )
655+ _env = env , * self . setup_extra_args )
651656
652657
653658class CompiledComponentsPythonRecipe (PythonRecipe ):
@@ -666,8 +671,16 @@ def build_compiled_components(self, arch):
666671
667672 env = self .get_recipe_env (arch )
668673 with current_directory (self .get_build_dir (arch .arch )):
669- hostpython = sh .Command (self .ctx .hostpython )
670- shprint (hostpython , 'setup.py' , 'build_ext' , '-v' )
674+ hostpython = sh .Command (self .hostpython_location )
675+ if self .call_hostpython_via_targetpython :
676+ shprint (hostpython , 'setup.py' , 'build_ext' , '-v' ,
677+ * self .setup_extra_args )
678+ else :
679+ hppath = join (dirname (self .hostpython_location ), 'Lib' ,
680+ 'site-packages' )
681+ hpenv = {'PYTHONPATH' : hppath }
682+ shprint (hostpython , 'setup.py' , 'build_ext' , '-v' , _env = hpenv ,
683+ * self .setup_extra_args )
671684 build_dir = glob .glob ('build/lib.*' )[0 ]
672685 shprint (sh .find , build_dir , '-name' , '"*.o"' , '-exec' ,
673686 env ['STRIP' ], '{}' , ';' , _env = env )
@@ -693,7 +706,8 @@ def build_cython_components(self, arch):
693706 info ('Trying first build of {} to get cython files: this is '
694707 'expected to fail' .format (self .name ))
695708 try :
696- shprint (hostpython , 'setup.py' , 'build_ext' , _env = env )
709+ shprint (hostpython , 'setup.py' , 'build_ext' , _env = env ,
710+ * self .setup_extra_args )
697711 except sh .ErrorReturnCode_1 :
698712 print ()
699713 info ('{} first build failed (as expected)' .format (self .name ))
@@ -704,7 +718,7 @@ def build_cython_components(self, arch):
704718 info ('ran cython' )
705719
706720 shprint (hostpython , 'setup.py' , 'build_ext' , '-v' , _env = env ,
707- _tail = 20 , _critical = True )
721+ _tail = 20 , _critical = True , * self . setup_extra_args )
708722
709723 print ('stripping' )
710724 build_lib = glob .glob ('./build/lib*' )
0 commit comments