-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPythonPipRecipe
More file actions
35 lines (32 loc) · 1.53 KB
/
PythonPipRecipe
File metadata and controls
35 lines (32 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# PythonPipRecipe — recipe for pure-Python packages installed from PyPI
#
# Installs the package by running:
# python -m pip install <PKGNAME>==<PKGVERSION>
#
# No source tarball is required; omit the `sources:` field in the recipe header.
# The package name passed to pip is derived from PKGNAME (set by bits from the
# `package:` field). pip normalises underscores and hyphens, so both forms work.
#
# Requirement: Python must be in the recipe's `requires:` list so that
# Python_ROOT is set in the environment before this file is sourced.
. ${BITS_RECIPE_TOOLS_ROOT}/PythonRecipe
# No source tarball: skip the rsync Prepare step
function Prepare() { true; }
function MakeInstall() {
mkdir -p "${SITE_PACKAGES}"
# --no-deps deps are managed by bits, not pip
# --ignore-installed don't try to uninstall system packages before installing;
# avoids "Permission denied" when a system copy exists
# --root=/ --prefix= install directly into our package tree; no staging dir
"${PYTHON_EXE}" -m pip install \
--no-deps --ignore-installed \
--root=/ --prefix="${INSTALLROOT}" \
"${PKGNAME}==${PKGVERSION}"
# Verify pip actually installed something — catches silent failures where pip
# exits 0 but the package was not found or the index was unreachable.
if [ -z "$(ls -A "${SITE_PACKAGES}" 2>/dev/null)" ]; then
echo "PythonPipRecipe: pip exited 0 but ${SITE_PACKAGES} is empty" >&2
echo "PythonPipRecipe: check that ${PKGNAME}==${PKGVERSION} exists on the configured index" >&2
return 1
fi
}