include platform in cv
This commit is contained in:
parent
e3a102ef92
commit
3ed2861115
@ -5,7 +5,7 @@
|
||||
import urllib, os, sys, httplib2, gzip
|
||||
from cStringIO import StringIO
|
||||
from anki.db import DB
|
||||
from anki.utils import ids2str, intTime, json, isWin, isMac
|
||||
from anki.utils import ids2str, intTime, json, isWin, isMac, platDesc
|
||||
from anki.consts import *
|
||||
from hooks import runHook
|
||||
import anki
|
||||
@ -604,7 +604,8 @@ class RemoteServer(HttpSyncer):
|
||||
|
||||
def meta(self):
|
||||
ret = self.req(
|
||||
"meta", StringIO(json.dumps(dict(v=SYNC_VER, cv="ankidesktop,"+anki.version))),
|
||||
"meta", StringIO(json.dumps(dict(
|
||||
v=SYNC_VER, cv="ankidesktop,%s,%s"%(anki.version, platDesc())))),
|
||||
badAuthRaises=False)
|
||||
if not ret:
|
||||
# invalid auth
|
||||
|
@ -7,6 +7,7 @@ import re, os, random, time, math, htmlentitydefs, subprocess, \
|
||||
tempfile, shutil, string, httplib2, sys, locale
|
||||
from hashlib import sha1
|
||||
from anki.lang import _, ngettext
|
||||
import platform
|
||||
|
||||
if sys.version_info[1] < 5:
|
||||
def format_string(a, b):
|
||||
@ -339,3 +340,25 @@ def invalidFilename(str, dirsep=True):
|
||||
return "/"
|
||||
elif (dirsep or not isWin) and "\\" in str:
|
||||
return "\\"
|
||||
|
||||
def platDesc():
|
||||
# we may get an interrupted system call, so try this in a loop
|
||||
n = 0
|
||||
theos = "unknown"
|
||||
while n < 100:
|
||||
n += 1
|
||||
try:
|
||||
system = platform.system()
|
||||
if isMac:
|
||||
theos = "mac:%s" % (platform.mac_ver()[0])
|
||||
elif isWin:
|
||||
theos = "win:%s" % (platform.win32_ver()[0])
|
||||
elif system == "Linux":
|
||||
dist = platform.dist()
|
||||
theos = "lin:%s:%s" % (dist[0], dist[1])
|
||||
else:
|
||||
theos = system
|
||||
break
|
||||
except:
|
||||
continue
|
||||
return theos
|
||||
|
@ -6,7 +6,7 @@ import urllib, urllib2, time
|
||||
import aqt
|
||||
import platform
|
||||
from aqt.utils import openLink
|
||||
from anki.utils import json, isWin, isMac
|
||||
from anki.utils import json, isWin, isMac, platDesc
|
||||
from aqt.utils import showText
|
||||
|
||||
class LatestVersionFinder(QThread):
|
||||
@ -17,27 +17,8 @@ class LatestVersionFinder(QThread):
|
||||
self.config = main.pm.meta
|
||||
|
||||
def _data(self):
|
||||
# we may get an interrupted system call, so try this in a loop
|
||||
n = 0
|
||||
theos = "unknown"
|
||||
while n < 100:
|
||||
n += 1
|
||||
try:
|
||||
system = platform.system()
|
||||
if isMac:
|
||||
theos = "mac:%s" % (platform.mac_ver()[0])
|
||||
elif isWin:
|
||||
theos = "win:%s" % (platform.win32_ver()[0])
|
||||
elif system == "Linux":
|
||||
dist = platform.dist()
|
||||
theos = "lin:%s:%s" % (dist[0], dist[1])
|
||||
else:
|
||||
theos = system
|
||||
break
|
||||
except:
|
||||
continue
|
||||
d = {"ver": aqt.appVersion,
|
||||
"os": theos,
|
||||
"os": platDesc(),
|
||||
"id": self.config['id'],
|
||||
"lm": self.config['lastMsg'],
|
||||
"crt": self.config['created']}
|
||||
|
Loading…
Reference in New Issue
Block a user