Run alpine license detection on the declared license found in the ``locin`` csv. Write results to ``locout`` csv.
(locin, locout)
| 1838 | output.write(line) |
| 1839 | |
| 1840 | def detect_licenses(locin, locout): |
| 1841 | """ |
| 1842 | Run alpine license detection on the declared license found in the |
| 1843 | ``locin`` csv. Write results to ``locout`` csv. |
| 1844 | """ |
| 1845 | with open(locin) as lines, open(locout, 'w') as output: |
| 1846 | line = '\t'.join(['declared', 'detected', 'purl', 'distro', 'unique']) + '\n' |
| 1847 | output.write(line) |
| 1848 | for i, line in enumerate(lines): |
| 1849 | line = line.strip() |
| 1850 | if not i or not line: |
| 1851 | continue |
| 1852 | print('processing:', line) |
| 1853 | declared, purl, distro, unique = line.split('\t') |
| 1854 | _normalized, detected = detect_declared_license(declared) |
| 1855 | line = '\t'.join([declared, detected, purl, distro, unique]) + '\n' |
| 1856 | output.write(line) |
| 1857 | |
| 1858 | loc = sys.argv[1] |
| 1859 | # get_apkindex_licenses(loc, 'alpine-licenses.csv') |
no test coverage detected