7
if [ -z "${CLOUD_INIT_TOP_D}" ]; then
8
topd=$(cd "$(dirname "${0}")" && cd .. && pwd)
10
topd=$(cd "${CLOUD_INIT_TOP_D}" && pwd)
12
[ $? -eq 0 -a -f "${topd}/setup.py" ] || return
15
fail() { echo "$0:" "$@" 1>&2; exit 1; }
18
fail "Unable to locate 'setup.py' file that should " \
19
"exist in the cloud-init root directory."
22
REQUIRES="$ROOT_DIR/requirements.txt"
24
if [ ! -e "$REQUIRES" ]; then
25
fail "Unable to find 'requirements.txt' file located at '$REQUIRES'"
28
# Filter out comments and empty lines
29
DEPS=$(sed -n -e 's,#.*,,' -e '/./p' "$REQUIRES") &&
31
fail "failed to read deps from '${REQUIRES}'"
32
echo "$DEPS" | sort -d -f
6
if 'CLOUD_INIT_TOP_D' in os.environ:
7
topd = os.path.realpath(os.environ.get('CLOUD_INIT_TOP_D'))
9
topd = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
11
for fname in ("setup.py", "requirements.txt"):
12
if not os.path.isfile(os.path.join(topd, fname)):
13
sys.stderr.write("Unable to locate '%s' file that should "
14
"exist in cloud-init root directory." % fname)
17
with open(os.path.join(topd, "requirements.txt"), "r") as fp:
19
if not line.strip() or line.startswith("#"):
21
sys.stdout.write(line)