fritzkink
2023-11-28 0e6b8465e1fa76dd600d4a240e95735e71db5d7c
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
7416d1 22     # some projects specify extra dependencies in form of .[extra] in deps
MT 23     # key instead of using separate extras key
24     extra=${line#.[}
25     extra=${extra%]}
26     if [ ".[$extra]" == "$line" ] ; then
27         # run the command passed in as argument(s) to handle extras
28         eval "$@" $extra
29         continue
30     fi
31
b8fe87 32     [ "${line:0:2}" == "-c" ] && continue
MT 33     [ "${line:0:12}" == "--constraint" ] && continue
34     if [ "${line:0:2}" == "-r" ] ; then
35         line=${line:2}
36         while [ "${line:0:1}" == " " ] ; do line=${line:1} ; done
b8b7ba 37         dos2unix -ascii $line | $0 "$@"
b8fe87 38         continue
MT 39     fi
40     if [ "${line:0:13}" == "--requirement" ] ; then
41         line=${line:14}
42         while [ "${line:0:1}" == " " ] ; do line=${line:1} ; done
b8b7ba 43         dos2unix -ascii $line | $0 "$@"
b8fe87 44         continue
MT 45     fi
46     echo "$line"
47 done