-
Notifications
You must be signed in to change notification settings - Fork 27
/
package_data.py
41 lines (30 loc) · 1.2 KB
/
package_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from zipfile import ZipFile, ZIP_DEFLATED
from os import walk
from os.path import join, basename
data_root = 'data/'
def package_biokg():
biokg = ZipFile(join(data_root, 'biokg.zip'), 'w', compression=ZIP_DEFLATED, compresslevel=6)
biokg.write('LICENSE')
biokg.write('README.md')
for folderName, subfolders, filenames in walk(join(data_root, 'biokg')):
for filename in filenames:
#create complete filepath of file in directory
filePath = join(folderName, filename)
# Add file to zip
biokg.write(filePath, basename(filePath))
biokg.close()
def package_benchmarks():
bmark = ZipFile(join(data_root, 'benchmarks.zip'), 'w', compression=ZIP_DEFLATED, compresslevel=6)
bmark.write('LICENSE')
for folderName, subfolders, filenames in walk(join(data_root, 'output', 'benchmarks')):
for filename in filenames:
#create complete filepath of file in directory
filePath = join(folderName, filename)
# Add file to zip
bmark.write(filePath, basename(filePath))
bmark.close()
def package_all():
package_biokg()
package_benchmarks()
if __name__ == '__main__':
package_all()