comparison data_manager/interproscan.py @ 1:0db4f153d86d draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_interproscan commit 7fbeae66de8617e525cd968a2ef89b0be448a618"
author iuc
date Wed, 17 Nov 2021 19:16:17 +0000
parents e93e32359b67
children 0df47f8552f6
comparison
equal deleted inserted replaced
0:e93e32359b67 1:0db4f153d86d
95 print("Downloading data tarball...") 95 print("Downloading data tarball...")
96 dest_tar = os.path.join(output_directory, DATA_URL.format(version=tag).split('/')[-1]) 96 dest_tar = os.path.join(output_directory, DATA_URL.format(version=tag).split('/')[-1])
97 download_file(DATA_URL.format(version=tag), dest_tar) 97 download_file(DATA_URL.format(version=tag), dest_tar)
98 98
99 print("Finished, now checking md5...") 99 print("Finished, now checking md5...")
100 md5_computed = hashlib.md5(open(dest_tar, 'rb').read()).hexdigest() 100 m = hashlib.md5()
101 blocksize = 2**20
102 with open(dest_tar, 'rb') as tarball:
103 while True:
104 buf = tarball.read(blocksize)
105 if not buf:
106 break
107 m.update(buf)
108 md5_computed = m.hexdigest()
101 if not md5.startswith(md5_computed): 109 if not md5.startswith(md5_computed):
102 raise RuntimeError("MD5 check failed: computed '%s', expected '%s'" % (md5_computed, md5)) 110 raise RuntimeError("MD5 check failed: computed '%s', expected '%s'" % (md5_computed, md5))
103 111
104 print("Ok, now extracting data...") 112 print("Ok, now extracting data...")
105 tar = tarfile.open(dest_tar, "r:gz") 113 tar = tarfile.open(dest_tar, "r:gz")
109 if args.partial: 117 if args.partial:
110 print("Moving partial data files around...") 118 print("Moving partial data files around...")
111 shutil.move(os.path.join(output_directory, 'interproscan-%s' % tag, 'core/jms-implementation/support-mini-x86-32/data/'), os.path.join(output_directory, 'data')) 119 shutil.move(os.path.join(output_directory, 'interproscan-%s' % tag, 'core/jms-implementation/support-mini-x86-32/data/'), os.path.join(output_directory, 'data'))
112 else: 120 else:
113 print("Moving data files around...") 121 print("Moving data files around...")
114 shutil.move(os.path.join(output_directory, 'interproscan-%s' % tag), os.path.join(output_directory, 'data')) 122 shutil.move(os.path.join(output_directory, 'interproscan-%s' % tag, 'data'), os.path.join(output_directory, 'data'))
115 123
116 print("Done, removing tarball and unneeded files...") 124 print("Done, removing tarball and unneeded files...")
117 os.remove(dest_tar) 125 os.remove(dest_tar)
118 shutil.rmtree(os.path.join(output_directory, 'interproscan-%s' % tag)) 126 shutil.rmtree(os.path.join(output_directory, 'interproscan-%s' % tag))
119 127