@@ -594,6 +594,9 @@ class PythonRecipe(Recipe):
594
594
call_hostpython_via_targetpython is False.
595
595
'''
596
596
597
+ setup_extra_args = []
598
+ '''List of extra arugments to pass to setup.py'''
599
+
597
600
@property
598
601
def hostpython_location (self ):
599
602
if not self .call_hostpython_via_targetpython :
@@ -635,19 +638,21 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
635
638
hostpython = sh .Command (self .hostpython_location )
636
639
637
640
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 )
639
643
else :
640
644
shprint (hostpython , 'setup.py' , 'install' , '-O2' ,
641
645
'--root={}' .format (self .ctx .get_python_install_dir ()),
642
646
'--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
644
649
645
650
# If asked, also install in the hostpython build dir
646
651
if self .install_in_hostpython :
647
652
shprint (hostpython , 'setup.py' , 'install' , '-O2' ,
648
653
'--root={}' .format (dirname (self .hostpython_location )),
649
654
'--install-lib=Lib/site-packages' ,
650
- _env = env )
655
+ _env = env , * self . setup_extra_args )
651
656
652
657
653
658
class CompiledComponentsPythonRecipe (PythonRecipe ):
@@ -666,8 +671,16 @@ def build_compiled_components(self, arch):
666
671
667
672
env = self .get_recipe_env (arch )
668
673
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 )
671
684
build_dir = glob .glob ('build/lib.*' )[0 ]
672
685
shprint (sh .find , build_dir , '-name' , '"*.o"' , '-exec' ,
673
686
env ['STRIP' ], '{}' , ';' , _env = env )
@@ -693,7 +706,8 @@ def build_cython_components(self, arch):
693
706
info ('Trying first build of {} to get cython files: this is '
694
707
'expected to fail' .format (self .name ))
695
708
try :
696
- shprint (hostpython , 'setup.py' , 'build_ext' , _env = env )
709
+ shprint (hostpython , 'setup.py' , 'build_ext' , _env = env ,
710
+ * self .setup_extra_args )
697
711
except sh .ErrorReturnCode_1 :
698
712
print ()
699
713
info ('{} first build failed (as expected)' .format (self .name ))
@@ -704,7 +718,7 @@ def build_cython_components(self, arch):
704
718
info ('ran cython' )
705
719
706
720
shprint (hostpython , 'setup.py' , 'build_ext' , '-v' , _env = env ,
707
- _tail = 20 , _critical = True )
721
+ _tail = 20 , _critical = True , * self . setup_extra_args )
708
722
709
723
print ('stripping' )
710
724
build_lib = glob .glob ('./build/lib*' )
0 commit comments