@@ -33,6 +33,7 @@ DIST_PATH="$ROOT_PATH/dist/default"
3333export LIBLINK_PATH=" $BUILD_PATH /objects"
3434export LIBLINK=" $ROOT_PATH /src/tools/liblink"
3535export BIGLINK=" $ROOT_PATH /src/tools/biglink"
36+ export PIP=" pip-2.7"
3637
3738MD5SUM=$( which md5sum)
3839if [ " X$MD5SUM " == " X" ]; then
@@ -381,6 +382,7 @@ function run_source_modules() {
381382
382383 needed=($MODULES )
383384 declare -a processed
385+ declare -a pymodules
384386
385387 fn_deps=' .deps'
386388 fn_optional_deps=' .optional-deps'
@@ -392,6 +394,7 @@ function run_source_modules() {
392394
393395 # pop module from the needed list
394396 module=${needed[0]}
397+ original_module=${needed[0]}
395398 unset needed[0]
396399 needed=( ${needed[@]} )
397400
@@ -414,8 +417,9 @@ function run_source_modules() {
414417 debug " Read $module recipe"
415418 recipe=$RECIPES_PATH /$module /recipe.sh
416419 if [ ! -f $recipe ]; then
417- error " Recipe $module does not exist"
418- exit -1
420+ error " Recipe $module does not exist, adding the module as pure-python package"
421+ pymodules+=($original_module )
422+ continue ;
419423 fi
420424 source $RECIPES_PATH /$module /recipe.sh
421425
@@ -446,6 +450,10 @@ function run_source_modules() {
446450 MODULES=" $( $PYTHON tools/depsort.py --optional $fn_optional_deps < $fn_deps ) "
447451
448452 info " Modules changed to $MODULES "
453+
454+ PYMODULES=" ${pymodules[@]} "
455+
456+ info " Pure-Python modules changed to $PYMODULES "
449457}
450458
451459function run_get_packages() {
@@ -589,6 +597,40 @@ function run_postbuild() {
589597 done
590598}
591599
600+ function run_pymodules_install() {
601+ info " Run pymodules install"
602+ if [ " X$PYMODULES " == " X" ]; then
603+ debug " No pymodules to install"
604+ return
605+ fi
606+
607+ cd " $BUILD_PATH "
608+
609+ debug " We want to install: $PYMODULES "
610+
611+ debug " Check if $VIRTUALENV and $PIP are present"
612+ for tool in $VIRTUALENV $PIP ; do
613+ which $tool & > /dev/null
614+ if [ $? -ne 0 ]; then
615+ error " Tool $tool is missing"
616+ exit -1
617+ fi
618+ done
619+
620+ debug " Check if virtualenv is existing"
621+ if [ ! -d venv ]; then
622+ debug " Installing virtualenv"
623+ try $VIRTUALENV --python=python2.7 venv
624+ fi
625+
626+ debug " Create a requirement file for pure-python modules"
627+ try echo " $PYMODULES " | try sed ' s/\ /\n/g' > requirements.txt
628+
629+ debug " Install pure-python modules via pip in venv"
630+ try bash -c " source venv/bin/activate && env CC=/bin/false CXX=/bin/false $PIP install --target '$BUILD_PATH /python-install/lib/python2.7/site-packages' --download-cache '$PACKAGES_PATH ' -r requirements.txt"
631+
632+ }
633+
592634function run_distribute() {
593635 info " Run distribute"
594636
@@ -669,6 +711,7 @@ function run() {
669711 run_build
670712 run_biglink
671713 run_postbuild
714+ run_pymodules_install
672715 run_distribute
673716 info " All done !"
674717}
0 commit comments