1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 08:17:13 +03:00

Drop "keyring" requirement

Ref #418
This commit is contained in:
Jonathan Harris 2019-05-21 16:15:03 +02:00
parent 96d40a06ba
commit 2a557fd37c
4 changed files with 16 additions and 12 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/env python2
#
# Command-line interface. Requires prior setup through the GUI.
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
@ -6,7 +6,6 @@ from sys import platform
from collections import OrderedDict
from functools import partial
import json
import keyring
from os import chdir, environ
from os.path import dirname, expanduser, isdir, join
import re
@ -302,9 +301,6 @@ class AppWindow:
self.postprefs(False) # Companion login happens in callback from monitor
if keyring.get_keyring().priority < 1:
self.status['text'] = 'Warning: Storing passwords as text' # Shouldn't happen unless no secure storage on Linux
# callback after the Preferences dialog is applied
def postprefs(self, dologin=True):
self.prefsdialog = None

View File

@ -236,17 +236,17 @@ Download and extract the [latest source code](https://github.com/Marginal/EDMark
Mac:
* Requires the Python “keyring”, “requests” and “watchdog” modules, plus an up-to-date “py2app” module if you also want to package the app - install these with `easy_install -U keyring requests watchdog py2app` .
* Requires the Python “requests” and “watchdog” modules, plus an up-to-date “py2app” module if you also want to package the app - install these with `easy_install -U requests watchdog py2app` .
* Run with `CLIENT_ID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX python ./EDMarketConnector.py` .
Windows:
* Requires Python2.7 and the Python “keyring”, “requests” and “watchdog” modules, plus “py2exe” 0.6 if you also want to package the app.
* Requires Python2.7 and the Python “requests” and “watchdog” modules, plus “py2exe” 0.6 if you also want to package the app.
* Run with `set CLIENT_ID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX && EDMarketConnector.py` .
Linux:
* Requires the Python “imaging-tk”, “iniparse”, “keyring” and “requests” modules. On Debian-based systems install these with `sudo apt-get install python-imaging-tk python-iniparse python-keyring python-requests` .
* Requires the Python “imaging-tk”, “iniparse”, and “requests” modules. On Debian-based systems install these with `sudo apt-get install python-imaging-tk python-iniparse python-requests` .
* Run with `CLIENT_ID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX ./EDMarketConnector.py` .
Command-line

View File

@ -1,4 +1,3 @@
import keyring
import numbers
import sys
from os import getenv, makedirs, mkdir, pardir
@ -360,13 +359,22 @@ class Config:
# Common
def get_password(self, account):
return keyring.get_password(self.identifier, account)
try:
import keyring
return keyring.get_password(self.identifier, account)
except ImportException:
return None
def set_password(self, account, password):
keyring.set_password(self.identifier, account, password)
try:
import keyring
keyring.set_password(self.identifier, account, password)
except ImportException:
pass
def delete_password(self, account):
try:
import keyring
keyring.delete_password(self.identifier, account)
except:
pass # don't care - silently fail