MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / downloadpackage

Function downloadpackage

tools/daca2-download.py:144–171  ·  view source on GitHub ↗
(filepath, outpath)

Source from the content-addressed store, hash-verified

142
143
144def downloadpackage(filepath, outpath):
145 # remove all files/folders
146 removeAll()
147
148 if not wget(filepath):
149 print('Failed to download ' + filepath)
150 return
151
152 filename = filepath[filepath.rfind('/') + 1:]
153 if filename[-3:] == '.gz':
154 # TODO: handle exitcode?
155 subprocess.call(['tar', 'xzf', filename])
156 elif filename[-3:] == '.xz':
157 # TODO: handle exitcode?
158 subprocess.call(['tar', 'xJf', filename])
159 elif filename[-4:] == '.bz2':
160 # TODO: handle exitcode?
161 subprocess.call(['tar', 'xjf', filename])
162 else:
163 return
164
165 removeLargeFiles('')
166
167 for g in glob.glob('[#_A-Za-z0-9]*'):
168 if os.path.isdir(g):
169 # TODO: handle exitcode?
170 subprocess.call(['tar', '-cJf', outpath + filename[:filename.rfind('.')] + '.xz', g])
171 break
172
173workdir = os.path.expanduser('~/daca2-packages/tmp/')
174if not os.path.isdir(workdir):

Callers 1

daca2-download.pyFile · 0.85

Calls 3

removeAllFunction · 0.85
removeLargeFilesFunction · 0.85
wgetFunction · 0.70

Tested by

no test coverage detected