MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / detect_licenses

Function detect_licenses

src/packagedcode/alpine.py:1840–1856  ·  view source on GitHub ↗

Run alpine license detection on the declared license found in the ``locin`` csv. Write results to ``locout`` csv.

(locin, locout)

Source from the content-addressed store, hash-verified

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')

Callers 1

alpine.pyFile · 0.70

Calls 4

detect_declared_licenseFunction · 0.85
joinMethod · 0.45
writeMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected