summaryrefslogtreecommitdiff
path: root/tools/read-dependencies
blob: 3aa6e28687ffe5d19933e3af5312bbc0ef3ba481 (plain)
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
#!/bin/sh

set -e

if [ -e "setup.py" ]
then
    ROOT_DIR="$PWD"
elif [ -e "../setup.py" ]
then
    ROOT_DIR="$PWD/../"
else
    echo "Unable to locate 'setup.py' file that should" \
          "exist in the cloud-init root directory."
    exit 1
fi

REQUIRES="$ROOT_DIR/Requires"

if [ ! -e "$REQUIRES" ]
then
    echo "Unable to find 'Requires' file located at $REQUIRES"
    exit 1
fi

# Filter out comments and empty liens
DEPS=$(cat $REQUIRES | grep -Pv "^\s*#" | grep -Pv '^\s*$')
echo "$DEPS" | sort -d -f