@ -75,7 +75,47 @@ define Python3/ModSetup
e n d e f
e n d e f
d e f i n e P y t h o n 3 / F i x S h e b a n g
d e f i n e P y t h o n 3 / F i x S h e b a n g
$( SED ) "1" '!' "b;s,^#" '!' ".*python.*,#" '!' "/usr/bin/python3," - i - - f o l l o w - s y m l i n k s $( 1)
$( SED) "1" '!' "b;s,^#" '!' ".*python.*,#" '!' "/usr/bin/python3," -i --follow-symlinks $( 1)
e n d e f
# default max recursion is 10
PYTHON3_COMPILEALL_MAX_RECURSION_LEVEL := 20
# $(1) => directory of python source files to compile
#
# XXX [So that you won't goof as I did]
# Note: Yes, I tried to use the -O & -OO flags here.
# However the generated byte-codes were not portable.
# So, we just stuck to un-optimized byte-codes,
# which is still way better/faster than running
# Python sources all the time.
#
# Setting a fixed hash seed value is less secure than using
# random seed values, but is necessary for reproducible builds
# (for now).
#
# Should revisit this when https://bugs.python.org/issue37596
# (and other related reproducibility issues) are fixed.
d e f i n e P y t h o n 3 / C o m p i l e A l l
$( call Python3/Run,, \
-m compileall -r " $( PYTHON3_COMPILEALL_MAX_RECURSION_LEVEL) " -b -d '/' $( 1) ,
$( if $( SOURCE_DATE_EPOCH) ,PYTHONHASHSEED= " $( SOURCE_DATE_EPOCH) " )
)
e n d e f
# $(1) => target directory
d e f i n e P y t h o n 3 / D e l e t e S o u r c e F i l e s
$( FIND) $( 1) -type f -name '*.py' -delete
e n d e f
# $(1) => target directory
d e f i n e P y t h o n 3 / D e l e t e N o n S o u r c e F i l e s
$( FIND) $( 1) -not -type d -not -name '*.py' -delete
e n d e f
# $(1) => target directory
d e f i n e P y t h o n 3 / D e l e t e E m p t y D i r s
$( FIND) $( 1) -mindepth 1 -empty -type d -not -path '$(1)/CONTROL' -not -path '$(1)/CONTROL/*' -delete
e n d e f
e n d e f
@ -122,20 +162,28 @@ define Py3Package
ifndef Package/$( 1) /install
ifndef Package/$( 1) /install
$( call shexport,Py3Package/$( 1) /filespec)
$( call shexport,Py3Package/$( 1) /filespec)
define Package/$( 1) /install
define Package/$( 1) /install
$$ ( call Py3Package/$( 1) /install,$$ ( 1) )
$$ ( call Py3Package/$( 1) /install,$$ ( 1) )
$( SHELL) $( python3_mk_path) python-package-install.sh "3" \
$( SHELL) $( python3_mk_path) python-package-install.sh \
" $( PKG_INSTALL_DIR) " " $$ (1) " \
" $( PKG_INSTALL_DIR) " " $$ (1) " \
" $( HOST_PYTHON3_BIN) " " $$ (2) " \
" $$ $$ $$ $$ $$ (call shvar,Py3Package/ $( 1) /filespec) " && \
if [ -d " $$ (1)/usr/bin " ] ; then \
$( call Python3/FixShebang,$$ ( 1) /usr/bin/*) ; \
" $$ $$ $$ $$ $$ (call shvar,Py3Package/ $( 1) /filespec) "
$( FIND) $$ ( 1) -name '*.exe' -delete
$$ ( call Python3/CompileAll,$$ ( 1) )
$$ ( call Python3/DeleteSourceFiles,$$ ( 1) )
$$ ( call Python3/DeleteEmptyDirs,$$ ( 1) )
if [ -d " $$ (1)/usr/bin " ] ; then \
$$ ( call Python3/FixShebang,$$ ( 1) /usr/bin/*) ; \
fi
fi
endef
endef
define Package/$( 1) -src/install
$$ ( call Package/$( 1) /install,$$ ( 1) ,sources)
endef
define Package/$( 1) -src/install
$$ ( call Py3Package/$( 1) /install,$$ ( 1) )
$( SHELL) $( python3_mk_path) python-package-install.sh \
" $( PKG_INSTALL_DIR) " " $$ (1) " \
" $$ $$ $$ $$ $$ (call shvar,Py3Package/ $( 1) /filespec) "
$$ ( call Python3/DeleteNonSourceFiles,$$ ( 1) )
$$ ( call Python3/DeleteEmptyDirs,$$ ( 1) )
endef
endif # Package/$(1)/install
endif # Package/$(1)/install
e n d e f
e n d e f