if args.version: latest = '' try: if sys.platform=='win32' and getattr(sys, 'frozen', False): os.environ['REQUESTS_CA_BUNDLE'] = join(dirname(sys.executable), 'cacert.pem') # Copied from update.py - probably should refactor r = requests.get(update_feed, timeout = 10) feed = ElementTree.fromstring(r.text) items = dict([(item.find('enclosure').attrib.get('{http://www.andymatuschak.org/xml-namespaces/sparkle}version'), item.find('title').text) for item in feed.findall('channel/item')]) lastversion = sorted(items, key=versioncmp)[-1] if versioncmp(lastversion) > versioncmp(appversion): latest = ' (%s is available)' % items[lastversion] except: pass # Quietly suppress timeouts etc. print '%.2f%s' % (float(''.join(appversion.split('.')[:3])) / 100, latest) # just first three digits sys.exit(EXIT_SUCCESS) if args.j: # Import and collate from JSON dump data = json.load(open(args.j)) config.set('querytime', getmtime(args.j)) else: session = companion.Session() if config.get('cmdrs'): username = config.get('fdev_usernames')[0] session.login(username, config.get_password(username)) else: # <= 2.25 not yet migrated session.login(config.get('username'), config.get('password')) querytime = int(time()) data = session.query()
if args.version: latest = '' try: # Copied from update.py - probably should refactor r = requests.get(update_feed, timeout=10) feed = ElementTree.fromstring(r.text) items = dict([(item.find('enclosure').attrib.get( '{http://www.andymatuschak.org/xml-namespaces/sparkle}version' ), item.find('title').text) for item in feed.findall('channel/item')]) lastversion = sorted(items, key=versioncmp)[-1] if versioncmp(lastversion) > versioncmp(appversion): latest = ' (%s is available)' % items[lastversion] except: pass # Quietly suppress timeouts etc. print '%.2f%s' % (float(''.join(appversion.split('.')[:3])) / 100, latest) # just first three digits sys.exit(EXIT_SUCCESS) if args.j: # Import and collate from JSON dump data = json.load(open(args.j)) config.set('querytime', getmtime(args.j)) else: # Get state from latest Journal file try: logdir = config.get('journaldir') or config.default_journal_dir logfiles = sorted([ x for x in os.listdir(logdir) if x.startswith('Journal') and x.endswith('.log') ],
if sys.platform=='darwin': from py2app import recipes import py2app.build_app def iterRecipes(module=recipes): for name in dir(module): if name.startswith('_') or name=='sip': continue check = getattr(getattr(module, name), 'check', None) if check is not None: yield (name, check) py2app.build_app.iterRecipes = iterRecipes APP = 'EDMarketConnector.py' APPCMD = 'EDMC.py' SHORTVERSION = ''.join(VERSION.split('.')[:3]) if sys.platform=='darwin': OPTIONS = { 'py2app': {'dist_dir': dist_dir, 'optimize': 2, 'packages': [ 'requests' ], 'frameworks': [ 'Sparkle.framework' ], 'excludes': [ 'PIL', 'simplejson' ], 'iconfile': '%s.icns' % APPNAME, 'resources': ['snd_good.wav', 'snd_bad.wav', 'modules.p', 'ships.p', 'stations.p', 'systems.p'], 'semi_standalone': True, 'site_packages': False, 'plist': { 'CFBundleName': APPLONGNAME, 'CFBundleIdentifier': 'uk.org.marginal.%s' % APPNAME.lower(),
from py2app import recipes import py2app.build_app def iterRecipes(module=recipes): for name in dir(module): if name.startswith('_') or name == 'sip': continue check = getattr(getattr(module, name), 'check', None) if check is not None: yield (name, check) py2app.build_app.iterRecipes = iterRecipes APP = 'EDMarketConnector.py' APPCMD = 'EDMC.py' SHORTVERSION = ''.join(VERSION.split('.')[:3]) PLUGINS = [ 'plugins/coriolis.py', 'plugins/eddb.py', 'plugins/eddn.py', 'plugins/edsm.py', 'plugins/edsy.py', 'plugins/inara.py' ] if sys.platform == 'darwin': OPTIONS = { 'py2app': { 'dist_dir': dist_dir, 'optimize': 2, 'packages': ['requests', 'keyring.backends'], 'frameworks': ['Sparkle.framework'], 'excludes': [
if args.version: latest = '' try: # Copied from update.py - probably should refactor r = requests.get(update_feed, timeout = 10) feed = ElementTree.fromstring(r.text) items = dict([(item.find('enclosure').attrib.get('{http://www.andymatuschak.org/xml-namespaces/sparkle}version'), item.find('title').text) for item in feed.findall('channel/item')]) lastversion = sorted(items, key=versioncmp)[-1] if versioncmp(lastversion) > versioncmp(appversion): latest = ' (%s is available)' % items[lastversion] except: pass # Quietly suppress timeouts etc. print '%.2f%s' % (float(''.join(appversion.split('.')[:3])) / 100, latest) # just first three digits sys.exit(EXIT_SUCCESS) session = companion.Session() session.login(config.get('username'), config.get('password')) querytime = int(time()) data = session.query() config.set('querytime', querytime) # Validation if not data.get('commander') or not data['commander'].get('name','').strip(): sys.stderr.write('Who are you?!\n') sys.exit(EXIT_SERVER) elif not data.get('lastSystem') or not data['lastSystem'].get('name','').strip() or not data.get('lastStarport') or not data['lastStarport'].get('name','').strip(): sys.stderr.write('Where are you?!\n') # Shouldn't happen