Skip to content

Commit

Permalink
Temporary rollback of version check to http.
Browse files Browse the repository at this point in the history
  • Loading branch information
oskay committed Jun 24, 2019
1 parent 90dcd94 commit a54701b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions inkscape driver/axidraw_options/versions.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,44 @@

Versions = namedtuple("Versions", "axidraw_control ebb_firmware dev_axidraw_control")


def get_versions_online():
''' check online for current versions. does not require connection to Axidraw,
but DOES require connection to the internet.
returns namedtuple with the versions
raises RuntimeError if online check fails.
'''
url = "http://evilmadscience.s3.amazonaws.com/sites/axidraw/versions.txt"
text = None
try:
if sys.version_info < (3,):
import urllib # python 2 version
text = urllib.urlopen(url).read()
else:
import urllib.request # python 3 version
text = urllib.request.urlopen(url).read().decode('utf8')

except Exception as e:
raise RuntimeError("Could not contact server to check for updates. " +
"Are you connected to the internet? (Error: {})".format(e))
if text:
try:
dictionary = ast.literal_eval(text)
online_versions = Versions(axidraw_control=dictionary['AxiDraw Control'],
ebb_firmware=dictionary['EBB Firmware'],
dev_axidraw_control=dictionary['AxiDraw Control (unstable)'])
except Exception as e:
raise RuntimeError("Could not parse server response. " +
"This is probably the server's fault. (Error: {})".format(e))

return online_versions


def get_versions_online_new():
''' check online for current versions. does not require connection to Axidraw,
but DOES require connection to the internet.
returns namedtuple with the versions
raises RuntimeError if online check fails.
'''
Expand Down

0 comments on commit a54701b

Please sign in to comment.