@@ -71,8 +71,11 @@ def checkProvides2(worklist, visited, origLibName, origVisited, indexdata):
7171 lst = []
7272 for ver in versionsThatProvideTheUses :
7373 try :
74- res = checkProvides2 (worklist .copy (
75- ) + [(usesName , ver )], visited .copy (), origLibName , origVisited .copy (), indexdata )
74+ res = checkProvides2 (worklist .copy () + [(usesName , ver )],
75+ visited .copy (),
76+ origLibName ,
77+ origVisited .copy (),
78+ indexdata )
7679 lst += [res ]
7780 except DuplicateVersions :
7881 pass
@@ -81,8 +84,8 @@ def checkProvides2(worklist, visited, origLibName, origVisited, indexdata):
8184 if not lst :
8285 raise MissingUses (
8386 "%d/%d provides worked for %s: %s with visited %s" %
84- (len (lst ), len (versionsThatProvideTheUses ), usesName , [
85- v ["version" ] for v in versionsThatProvideTheUses ], visited ))
87+ (len (lst ), len (versionsThatProvideTheUses ), usesName ,
88+ [ v ["version" ] for v in versionsThatProvideTheUses ], visited ))
8689 noConflict = False
8790 for l in lst :
8891 if not l :
@@ -98,18 +101,10 @@ def checkProvides(libName, lib, indexdata):
98101 worklist = [(libName , lib )]
99102 visited = []
100103 origVisited = set ()
101- origVisited = checkProvides2 (
102- worklist ,
103- visited ,
104- libName ,
105- origVisited ,
106- indexdata )
104+ origVisited = checkProvides2 (worklist , visited , libName , origVisited , indexdata )
107105 if origVisited :
108- print (
109- "Found cycle. Changing provides to convertFromVersion: %s %s %s" %
110- (libName , lib ['version' ], origVisited ))
111- lib ['convertFromVersion' ] = lib .get (
112- "convertFromVersion" , []) + lib ['provides' ]
106+ print ("Found cycle. Changing provides to convertFromVersion: %s %s %s" % (libName , lib ['version' ], origVisited ))
107+ lib ['convertFromVersion' ] = lib .get ("convertFromVersion" , []) + lib ['provides' ]
113108 del lib ['provides' ]
114109
115110
@@ -121,8 +116,7 @@ def main():
121116 with open ("rawdata.json" , "r" ) as f :
122117 rawdata = json .load (f )
123118
124- indexdata = {"libs" : {}, "mirrors" : [
125- "https://libraries.openmodelica.org/cache/" ]}
119+ indexdata = {"libs" : {}, "mirrors" : ["https://libraries.openmodelica.org/cache/" ]}
126120 for firstKey in rawdata .keys ():
127121 data = rawdata [firstKey ]
128122 for refKey in data ["refs" ].keys ():
@@ -133,45 +127,42 @@ def main():
133127 raise Exception (firstKey + " " + refKey )
134128 for libName in r ["libs" ]:
135129 lib = r ["libs" ][libName ]
130+ isgit = False
136131 if libName not in indexdata ["libs" ]:
137132 if "github" in repos [firstKey ]:
138133 indexdata ["libs" ][libName ] = {
139134 "git" : "https://github.com/%s.git" %
140135 repos [firstKey ]["github" ], "versions" : {}}
141136 isgit = True
142137 elif "git" in repos [firstKey ]:
143- indexdata ["libs" ][libName ] = {
144- "git" : repos [firstKey ]["git" ], "versions" : {}}
138+ indexdata ["libs" ][libName ] = {"git" : repos [firstKey ]["git" ], "versions" : {}}
145139 isgit = True
146140 else :
147141 indexdata ["libs" ][libName ] = {"versions" : {}}
148- isgit = False
149142 libdict = indexdata ["libs" ][libName ]["versions" ]
150143 if lib ['version' ] in libdict .keys ():
151144 if len (common .VersionNumber (refKey ).prerelease ) > 0 :
152145 continue
153- print (
154- 'Duplicate entry for %s %s (%s)' %
155- (libName , lib ['version' ], refKey ))
146+ print ('Duplicate entry for %s %s (%s)' % (libName , lib ['version' ], refKey ))
156147 entry = {}
157148
158149 if isgit :
159- if "sha" in r or "zip" not in r : # If we have zip-file but no sha, we might use a releases zip for a tag we don't know the SHA of
150+ # If we have zip-file but no sha, we might use a releases zip for a tag we don't know the SHA of
151+ if "sha" in r or "zip" not in r :
160152 entry ['sha' ] = r ['sha' ]
161153 entry ['path' ] = lib ['path' ]
162154 entry ['version' ] = lib ['version' ]
163155 if "zip" in r :
164156 entry ['zipfile' ] = r ["zip" ]
165157 elif "github" in repos [firstKey ]:
166- entry ['zipfile' ] = "https://github.com/%s/archive/%s.zip" % (
167- repos [firstKey ]["github" ], r ['sha' ])
158+ entry ['zipfile' ] = "https://github.com/%s/archive/%s.zip" % (repos [firstKey ]["github" ], r ['sha' ])
168159 elif "zipfile" in repos [firstKey ]:
169- entry ['zipfile' ] = repos [firstKey ]["zipfile" ].format (
170- r ['sha' ])
160+ entry ['zipfile' ] = repos [firstKey ]["zipfile" ].format (r ['sha' ])
171161 else :
172162 raise Exception (
173- "Entry does not list an entry \" zip\" (manually added zip-file), \" github\" (project name), or \" zipfile\" URL from where to download the git hash (gitlab/etc):\n " +
174- str (r ))
163+ "Entry does not list an entry \" zip\" (manually added zip-file), "
164+ "\" github\" (project name), or \" zipfile\" URL from where to download "
165+ "the git hash (gitlab/etc):\n " + str (r ))
175166 if 'provides' in lib :
176167 entry ['provides' ] = lib ['provides' ]
177168 if 'uses' in lib :
@@ -180,8 +171,7 @@ def main():
180171 entry ['convertFromVersion' ] = lib ['convertFromVersion' ]
181172 if repos [firstKey ].get ('singleFileStructureCopyAllFiles' ):
182173 entry ['singleFileStructureCopyAllFiles' ] = True
183- entry ['support' ] = common .getSupportLevel (
184- lib ['version' ], repos [firstKey ]['support' ])
174+ entry ['support' ] = common .getSupportLevel (lib ['version' ], repos [firstKey ]['support' ])
185175
186176 libdict [lib ['version' ]] = entry
187177 # print(entry)
0 commit comments