Marcel Telka
2024-04-05 26ab531a0abac615aaedf17622ee2aa5e19c5114
commit | author | age
b8fe87 1 #! /usr/bin/sh
MT 2 #
3 #
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.
8 #
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.
12 #
13
14 #
15 # Copyright 2022 Marcel Telka
16 #
17
18 # Helper tool to recursively resolve -r/--requirement in list of python
19 # dependencies
20
21 while read line ; do
d2403e 22     # some projects specify extra dependencies in form of .[extras] in deps
7416d1 23     # key instead of using separate extras key
d2403e 24     extras=${line#.[}
MT 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
7416d1 31         continue
MT 32     fi
33
b8fe87 34     [ "${line:0:2}" == "-c" ] && continue
MT 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
b8b7ba 39         dos2unix -ascii $line | $0 "$@"
b8fe87 40         continue
MT 41     fi
42     if [ "${line:0:13}" == "--requirement" ] ; then
43         line=${line:14}
44         while [ "${line:0:1}" == " " ] ; do line=${line:1} ; done
b8b7ba 45         dos2unix -ascii $line | $0 "$@"
b8fe87 46         continue
MT 47     fi
48     echo "$line"
49 done