This function parses the options to --download and returns a set such as { icu: true }, etc.
(opt)
| 95 | return dict((key, value) for (key) in keys) |
| 96 | |
| 97 | def parse(opt): |
| 98 | """This function parses the options to --download and returns a set such as { icu: true }, etc. """ |
| 99 | if not opt: |
| 100 | opt = download_default |
| 101 | |
| 102 | theOpts = set(opt.split(',')) |
| 103 | |
| 104 | if 'all' in theOpts: |
| 105 | # all on |
| 106 | return set2dict(download_types, True) |
| 107 | elif 'none' in theOpts: |
| 108 | # all off |
| 109 | return set2dict(download_types, False) |
| 110 | |
| 111 | # OK. Now, process each of the opts. |
| 112 | theRet = set2dict(download_types, False) |
| 113 | for anOpt in opt.split(','): |
| 114 | if not anOpt or anOpt == "": |
| 115 | # ignore stray commas, etc. |
| 116 | continue |
| 117 | elif anOpt == 'all': |
| 118 | # all on |
| 119 | theRet = dict((key, True) for (key) in download_types) |
| 120 | else: |
| 121 | # turn this one on |
| 122 | if anOpt in download_types: |
| 123 | theRet[anOpt] = True |
| 124 | else: |
| 125 | # future proof: ignore unknown types |
| 126 | print('Warning: ignoring unknown --download= type "%s"' % anOpt) |
| 127 | # all done |
| 128 | return theRet |
| 129 | |
| 130 | def candownload(auto_downloads, package): |
| 131 | if not (package in auto_downloads.keys()): |
no test coverage detected
searching dependent graphs…