|
43 | 43 | LICENSE = 'MIT License'
|
44 | 44 | HOMEPAGE = 'https://github.com/sorgerlab/ashlar'
|
45 | 45 |
|
46 |
| -LOCI_TOOLS_URL = 'https://downloads.openmicroscopy.org/bio-formats/6.3.1/artifacts/loci_tools.jar' |
47 |
| -LOCI_TOOLS_SHA1 = 'bdf1a37b561fea02fd8d1c747bd34db3fc49667b' |
| 46 | +BIOFORMATS_JAR_URL = 'https://downloads.openmicroscopy.org/bio-formats/8.0.1/artifacts/bioformats_package.jar' |
| 47 | +BIOFORMATS_JAR_SHA256 = '8c7557a9357a83bf40272292fbd676beb466a9a8bab34126e92a49d636c64bc2' |
48 | 48 |
|
49 | 49 | def download_bioformats():
|
50 | 50 | print("Ensuring latest bioformats is present:")
|
51 | 51 | dist_root = os.path.abspath(os.path.dirname(__file__))
|
52 | 52 | jar_dir = os.path.join(dist_root, 'ashlar', 'jars')
|
53 |
| - lt_jar_path = os.path.join(jar_dir, 'loci_tools.jar') |
| 53 | + lt_jar_path = os.path.join(jar_dir, 'bioformats_package.jar') |
54 | 54 | if not os.access(jar_dir, os.F_OK):
|
55 | 55 | os.mkdir(jar_dir)
|
56 | 56 | try:
|
57 | 57 | with open(lt_jar_path, 'rb') as f:
|
58 |
| - existing_sha1 = hashlib.sha1(f.read()).hexdigest() |
59 |
| - if existing_sha1 == LOCI_TOOLS_SHA1: |
| 58 | + existing_sha256 = hashlib.sha256(f.read()).hexdigest() |
| 59 | + if existing_sha256 == BIOFORMATS_JAR_SHA256: |
60 | 60 | print(" Up to date!")
|
61 | 61 | return
|
62 | 62 | except IOError:
|
63 | 63 | pass
|
64 |
| - print(" Downloading BioFormats from %s ..." % LOCI_TOOLS_URL) |
| 64 | + print(" Downloading BioFormats from %s ..." % BIOFORMATS_JAR_URL) |
65 | 65 | # FIXME add progress bar
|
66 |
| - content = urlopen(LOCI_TOOLS_URL).read() |
67 |
| - content_sha1 = hashlib.sha1(content).hexdigest() |
| 66 | + content = urlopen(BIOFORMATS_JAR_URL).read() |
| 67 | + content_sha256 = hashlib.sha256(content).hexdigest() |
68 | 68 | with open(lt_jar_path, 'wb') as f:
|
69 | 69 | f.write(content)
|
70 |
| - if content_sha1 != LOCI_TOOLS_SHA1: |
71 |
| - raise RuntimeError("loci_tools.jar hash mismatch") |
| 70 | + if content_sha256 != BIOFORMATS_JAR_SHA256: |
| 71 | + raise RuntimeError("bioformats_package.jar hash mismatch") |
72 | 72 |
|
73 | 73 | # Define some distutils command subclasses for a few key commands to trigger
|
74 | 74 | # downloading the BioFormats JAR before they run.
|
|
0 commit comments