postgresql-12: update to 12.21
[oi-userland.git] / tools / python-resolve-deps
blob7b91b79d5a47abca5631798406bae54c02692812
1 #! /usr/bin/sh
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
7 # 1.0 of the CDDL.
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
15 # Copyright 2022 Marcel Telka
18 # Helper tool to recursively resolve -r/--requirement in list of python
19 # dependencies
21 while read line ; do
22 # some projects specify extra dependencies in form of .[extras] in deps
23 # key instead of using separate extras key
24 extras=${line#.[}
25 extras=${extras%]}
26 if [ ".[$extras]" == "$line" ] ; then
27 for extra in ${extras//,/ } ; do
28 # run the command passed in as argument(s) to handle extras
29 eval "$@" $extra
30 done
31 continue
34 [ "${line:0:2}" == "-c" ] && continue
35 [ "${line:0:12}" == "--constraint" ] && continue
36 if [ "${line:0:2}" == "-r" ] ; then
37 line=${line:2}
38 while [ "${line:0:1}" == " " ] ; do line=${line:1} ; done
39 dos2unix -ascii $line | $0 "$@"
40 continue
42 if [ "${line:0:13}" == "--requirement" ] ; then
43 line=${line:14}
44 while [ "${line:0:1}" == " " ] ; do line=${line:1} ; done
45 dos2unix -ascii $line | $0 "$@"
46 continue
48 echo "$line"
49 done