@@ -1788,6 +1788,13 @@ def build_arch(self, arch):
17881788 if hasattr (self , build ):
17891789 getattr (self , build )()
17901790
1791+ def install_arch (self , arch ):
1792+ '''Install the build previously build with `build_arch`
1793+ '''
1794+ install = "install_{}" .format (arch .arch )
1795+ if hasattr (self , install ):
1796+ getattr (self , install )()
1797+
17911798 def postbuild_arch (self , arch ):
17921799 '''Run any post-build tasks for the Recipe. By default, this checks if
17931800 any postbuild_archname methods exist for the archname of the
@@ -1957,15 +1964,10 @@ def should_build(self):
19571964 info ('{} apparently isn\' t already in site-packages' .format (name ))
19581965 return True
19591966
1960- def build_arch (self , arch ):
1961- '''Install the Python module by calling setup.py install with
1962- the target Python dir.'''
1963- super (PythonRecipe , self ).build_arch (arch )
1967+ def install_arch (self , arch ):
1968+ super (PythonRecipe , self ).install_arch (arch )
19641969 self .install_python_package ()
1965- # @cache_execution
1966- # def install(self):
1967- # self.install_python_package()
1968- # self.reduce_python_package()
1970+ self .reduce_python_package ()
19691971
19701972 def install_python_package (self , name = None , env = None , is_dir = True ):
19711973 '''Automate the installation of a Python package (or a cython
@@ -1998,21 +2000,17 @@ def install_python_package(self, name=None, env=None, is_dir=True):
19982000 '--install-lib=Lib/site-packages' ,
19992001 _env = env )
20002002
2003+ def reduce_python_package (self ):
2004+ '''Feel free to remove things you don't want in the final site-packages
2005+ '''
2006+ pass
20012007
20022008class CompiledComponentsPythonRecipe (PythonRecipe ):
20032009 pre_build_ext = False
2004- def build_arch (self , arch ):
2005- '''Build any cython components, then install the Python module by
2006- calling setup.py install with the target Python dir.
2007- '''
2008- Recipe .build_arch (self , arch ) # AND: Having to directly call the
2009- # method like this is nasty...could
2010- # use tito's method of having an
2011- # install method that always runs
2012- # after everything else but isn't
2013- # used by a normal recipe.
2010+
2011+ def install_arch (self , arch ):
20142012 self .build_compiled_components (arch )
2015- self . install_python_package ( )
2013+ super ( CompiledComponentsPythonRecipe , self ). install_arch ( arch )
20162014
20172015 def build_compiled_components (self , arch ):
20182016 info ('Building compiled components in {}' .format (self .name ))
@@ -2021,7 +2019,7 @@ def build_compiled_components(self, arch):
20212019 with current_directory (self .get_build_dir (arch .arch )):
20222020 hostpython = sh .Command (self .ctx .hostpython )
20232021 shprint (hostpython , 'setup.py' , 'build_ext' , '-v' )
2024- build_dir = glob . glob ('build/lib.*' )[0 ]
2022+ build_dir = glob ('build/lib.*' )[0 ]
20252023 shprint (sh .find , build_dir , '-name' , '"*.o"' , '-exec' ,
20262024 env ['STRIP' ], '{}' , ';' , _env = env )
20272025
@@ -2030,18 +2028,9 @@ class CythonRecipe(PythonRecipe):
20302028 pre_build_ext = False
20312029 cythonize = True
20322030
2033- def build_arch (self , arch ):
2034- '''Build any cython components, then install the Python module by
2035- calling setup.py install with the target Python dir.
2036- '''
2037- Recipe .build_arch (self , arch ) # AND: Having to directly call the
2038- # method like this is nasty...could
2039- # use tito's method of having an
2040- # install method that always runs
2041- # after everything else but isn't
2042- # used by a normal recipe.
2031+ def install_arch (self , arch ):
20432032 self .build_cython_components (arch )
2044- self . install_python_package ( )
2033+ super ( CythonRecipe , self ). install_arch ( arch )
20452034
20462035 @cache_execution
20472036 def build_cython_components (self , arch ):
@@ -2156,7 +2145,13 @@ def build_recipes(build_order, python_modules, ctx):
21562145 info_main ('# Biglinking object files' )
21572146 biglink (ctx , arch )
21582147
2159- # 5) postbuild packages
2148+ # 5) install
2149+ info_main ('# Install recipes' )
2150+ for recipe in recipes :
2151+ info_main ('Install {} for {}' .format (recipe .name , arch .arch ))
2152+ recipe .install_arch (arch )
2153+
2154+ # 6) postbuild packages
21602155 info_main ('# Postbuilding recipes' )
21612156 for recipe in recipes :
21622157 info_main ('Postbuilding {} for {}' .format (recipe .name , arch .arch ))
0 commit comments