File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
import re , json
2
- from os import listdir
2
+ from os import listdir , path
3
+ from pathlib import Path
4
+ from shutil import rmtree
3
5
4
6
with open ('stage1' ) as file :
5
7
stage_1_identifiers = file .read ().splitlines ()
9
11
json_file_names .remove ('index.json' )
10
12
json_file_names .sort ()
11
13
14
+ if path .exists ('licensedb-licenses' ):
15
+ rmtree ('licensedb-licenses' )
16
+ Path ('licensedb-licenses' ).mkdir (parents = True , exist_ok = True )
17
+
12
18
def get_spdx_license_key (json_file_name ):
13
19
with open ('scancode-licensedb/docs/' + json_file_name , 'r' ) as file :
14
20
json_loader = json .load (file )
15
21
spdx_license_key = ''
16
22
try :
17
23
spdx_license_key = json_loader ['spdx_license_key' ]
24
+
25
+ file_object = open ('licensedb-licenses/' + json_loader ['key' ] + '.txt' , 'w' )
26
+ file_object .write (json_loader ['text' ])
18
27
except :
19
28
print ('doesnt have spdx: ' + json_loader ['key' ])
20
29
return spdx_license_key
You can’t perform that action at this time.
0 commit comments