|
Lines 407-427
distutils-r1_python_test() {
Link Here
|
| 407 |
} |
407 |
} |
| 408 |
|
408 |
|
| 409 |
# @FUNCTION: _distutils-r1_wrap_scripts |
409 |
# @FUNCTION: _distutils-r1_wrap_scripts |
| 410 |
# @USAGE: <path> |
410 |
# @USAGE: <path> <bindir> |
| 411 |
# @INTERNAL |
411 |
# @INTERNAL |
| 412 |
# @DESCRIPTION: |
412 |
# @DESCRIPTION: |
| 413 |
# Moves and wraps all installed scripts/executables as necessary. |
413 |
# Moves and wraps all installed scripts/executables as necessary. |
| 414 |
_distutils-r1_wrap_scripts() { |
414 |
_distutils-r1_wrap_scripts() { |
| 415 |
debug-print-function ${FUNCNAME} "${@}" |
415 |
debug-print-function ${FUNCNAME} "${@}" |
| 416 |
|
416 |
|
|
|
417 |
[[ ${#} -eq 2 ]] || die "usage: ${FUNCNAME} <path> <bindir>" |
| 417 |
local path=${1} |
418 |
local path=${1} |
| 418 |
[[ ${path} ]] || die "${FUNCNAME}: no path given" |
419 |
local bindir=${2} |
| 419 |
|
420 |
|
| 420 |
if ! _python_want_python_exec2; then |
421 |
if ! _python_want_python_exec2; then |
| 421 |
local PYTHON_SCRIPTDIR=${EPREFIX}/usr/bin |
422 |
local PYTHON_SCRIPTDIR=${bindir} |
| 422 |
fi |
423 |
fi |
| 423 |
|
424 |
|
| 424 |
mkdir -p "${path}${EPREFIX}/usr/bin" || die |
|
|
| 425 |
local f |
425 |
local f |
| 426 |
while IFS= read -r -d '' f; do |
426 |
while IFS= read -r -d '' f; do |
| 427 |
local basename=${f##*/} |
427 |
local basename=${f##*/} |
|
Lines 429-434
_distutils-r1_wrap_scripts() {
Link Here
|
| 429 |
|
429 |
|
| 430 |
[[ -d ${f} ]] && die "Unexpected directory: ${f}" |
430 |
[[ -d ${f} ]] && die "Unexpected directory: ${f}" |
| 431 |
|
431 |
|
|
|
432 |
mkdir -p "${path}${bindir}" || die |
| 432 |
local shebang |
433 |
local shebang |
| 433 |
read -r shebang < "${f}" |
434 |
read -r shebang < "${f}" |
| 434 |
if [[ ${shebang} == '#!'*${EPYTHON}* ]]; then |
435 |
if [[ ${shebang} == '#!'*${EPYTHON}* ]]; then |
|
Lines 440-453
_distutils-r1_wrap_scripts() {
Link Here
|
| 440 |
mv "${f}" "${newf}" || die |
441 |
mv "${f}" "${newf}" || die |
| 441 |
fi |
442 |
fi |
| 442 |
|
443 |
|
| 443 |
debug-print "${FUNCNAME}: installing wrapper at /usr/bin/${basename}" |
444 |
debug-print "${FUNCNAME}: installing wrapper at ${bindir}/${basename}" |
| 444 |
_python_ln_rel "${path}${EPREFIX}"$(_python_get_wrapper_path) \ |
445 |
_python_ln_rel "${path}${EPREFIX}"$(_python_get_wrapper_path) \ |
| 445 |
"${path}${EPREFIX}/usr/bin/${basename}" || die |
446 |
"${path}${bindir}/${basename}" || die |
| 446 |
elif _python_want_python_exec2; then |
447 |
elif _python_want_python_exec2; then |
| 447 |
debug-print "${FUNCNAME}: non-matching shebang: ${shebang}" |
448 |
debug-print "${FUNCNAME}: non-matching shebang: ${shebang}" |
| 448 |
|
449 |
|
| 449 |
debug-print "${FUNCNAME}: moving to /usr/bin/${basename}" |
450 |
debug-print "${FUNCNAME}: moving to ${bindir}/${basename}" |
| 450 |
mv "${f}" "${path}${EPREFIX}/usr/bin/${basename}" || die |
451 |
mv "${f}" "${path}${bindir}/${basename}" || die |
| 451 |
fi |
452 |
fi |
| 452 |
done < <(find "${path}${PYTHON_SCRIPTDIR}" -mindepth 1 -print0) |
453 |
done < <(find "${path}${PYTHON_SCRIPTDIR}" -mindepth 1 -print0) |
| 453 |
} |
454 |
} |
|
Lines 491-504
distutils-r1_python_install() {
Link Here
|
| 491 |
flags+=( --install-scripts="${PYTHON_SCRIPTDIR}" ) |
492 |
flags+=( --install-scripts="${PYTHON_SCRIPTDIR}" ) |
| 492 |
fi |
493 |
fi |
| 493 |
|
494 |
|
| 494 |
esetup.py install "${flags[@]}" "${@}" |
495 |
esetup.py install "${@}" "${flags[@]}" |
| 495 |
|
496 |
|
| 496 |
if [[ -d ${root}$(python_get_sitedir)/tests ]]; then |
497 |
if [[ -d ${root}$(python_get_sitedir)/tests ]]; then |
| 497 |
die "Package installs 'tests' package, file collisions likely." |
498 |
die "Package installs 'tests' package, file collisions likely." |
| 498 |
fi |
499 |
fi |
| 499 |
|
500 |
|
| 500 |
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then |
501 |
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then |
| 501 |
_distutils-r1_wrap_scripts "${root}" |
502 |
# user may override --install-scripts |
|
|
503 |
# note: this is poor but distutils argv parsing is dumb |
| 504 |
local scriptdir=${EPREFIX}/usr/bin |
| 505 |
set -- "${mydistutilsargs[@]}" "${@}" |
| 506 |
while [[ ${@} ]]; do |
| 507 |
local a=${1} |
| 508 |
shift |
| 509 |
|
| 510 |
case "${a}" in |
| 511 |
--install-scripts=*) |
| 512 |
scriptdir=${a#--install-scripts=} |
| 513 |
;; |
| 514 |
--install-scripts) |
| 515 |
scriptdir=${1} |
| 516 |
shift |
| 517 |
;; |
| 518 |
esac |
| 519 |
done |
| 520 |
|
| 521 |
_distutils-r1_wrap_scripts "${root}" "${scriptdir}" |
| 502 |
multibuild_merge_root "${root}" "${D}" |
522 |
multibuild_merge_root "${root}" "${D}" |
| 503 |
fi |
523 |
fi |
| 504 |
} |
524 |
} |
| 505 |
- |
|
|