@@ -43,7 +43,7 @@ def get_files_in_directory( self, path ):
43
43
44
44
def assemble_information ( self ):
45
45
global library_path
46
- output = "[ \n "
46
+ output = {}
47
47
48
48
#get directories
49
49
directories = self .get_subdirectories ( library_path )
@@ -59,27 +59,18 @@ def assemble_information( self ):
59
59
if ( "." not in sub_directory ):
60
60
sub_directory_name = re .sub ( "lib" , "" , sub_directory )
61
61
sub_directory_path = directory_path + sub_directory
62
-
63
- output += '\t {\n \t \t '
64
- output += '"name": "' + sub_directory_name + '",\n \t \t '
65
- output += '"libdir": "' + sub_directory_path + '",\n \t \t '
66
- output += '"include": [\n \t \t \t ' + '"' + sub_directory_name + '"'
67
- output += '\n \t \t ],\n \t \t '
68
- output += '"memorymodel": {\n \t \t \t "cmm": "' + sub_directory_path + '/cmm/"' + '\n \t \t }\n \t },\n '
62
+
63
+ output [ sub_directory_name ] = { "name" : sub_directory_name , "libdir" : sub_directory_path , "include" : sub_directory_name , "memorymode" : sub_directory_path + '/cmm/' }
69
64
except :
70
65
pass
71
-
72
- output = output [:len (output ) - 2 ]
73
- output += '\n ]'
74
66
75
67
return output
76
68
77
69
def create_json_file ( self , data , file_name ):
78
70
file = open ( file_name , 'w' )
79
- file . write ( data )
71
+ json . dump ( data , file )
80
72
file .close ()
81
-
82
- #json.dump( unicode( data ), file_name )
73
+
83
74
print json .load (open (os .getcwd () + "/lib-descriptor.json" ))
84
75
85
76
def askdirectory (self , ** options ):
0 commit comments