source: orange/orange/downloadPyd.py @ 8956:0abe1bb4e3ee

Revision 8956:0abe1bb4e3ee, 1.2 KB checked in by mitar, 3 years ago (diff)

Use new Orange website URL.

Line 
1import urllib, sys, os, md5
2
3
4files = "orange", "corn", "statc", "orangeom", "orangene", "_orngCRS"
5
6if sys.version_info[:2] == (2, 7):
7    # orangeqt is build only for 2.7
8    files = files + ("orangeqt",)
9   
10baseurl = "http://orange.biolab.si/download/binaries/%i%i/" % sys.version_info[:2]
11fleurl = baseurl + "%s.pyd"
12
13op = filter(lambda x:x[-7:].lower() in ["\\orange", "/orange"], sys.path)
14if not op:
15    print "Orange is not found on the Python's path"
16
17print "Downloading to %s (for Python %i.%i)" % (op[0], sys.version_info[0], sys.version_info[1])
18os.chdir(op[0])
19
20def rep(blk_cnt, blk_size, tot_size):
21    print "\rDownloading %s: %i of %i" % (fle, min(tot_size, blk_cnt*blk_size), tot_size),
22
23repository_stamps = dict([tuple(x.split()) for x in urllib.urlopen(baseurl + "stamps_pyd.txt") if x.strip()])
24
25for fle in files:
26    if os.path.exists(fle+".pyd") and repository_stamps.get(fle+".pyd", "") == md5.md5(file(fle+".pyd", "rb").read()).hexdigest().upper():
27        print "\nSkipping %s" % fle,
28    else:
29        print "\nDownloading %s" % fle,
30        urllib.urlretrieve(fleurl % fle, fle+".temp", rep)
31        if os.path.exists(fle+".pyd"):
32            os.remove(fle+".pyd")
33        os.rename(fle+".temp", fle+".pyd")
Note: See TracBrowser for help on using the repository browser.