Recreating wheels
This commit is contained in:
53
config.py
53
config.py
@@ -94,8 +94,8 @@ def defPaths(customSavePath):
|
||||
|
||||
if isFrozen():
|
||||
certName = "cacert.pem"
|
||||
os.environ["REQUESTS_CA_BUNDLE"] = getPyfaPath(certName)
|
||||
os.environ["SSL_CERT_FILE"] = getPyfaPath(certName)
|
||||
os.environ["REQUESTS_CA_BUNDLE"] = getPyfaPath(certName).encode('utf8')
|
||||
os.environ["SSL_CERT_FILE"] = getPyfaPath(certName).encode('utf8')
|
||||
|
||||
loggingFormat = '%(asctime)s %(name)-24s %(levelname)-8s %(message)s'
|
||||
logging.basicConfig(format=loggingFormat, level=logLevel)
|
||||
@@ -137,43 +137,36 @@ def defPaths(customSavePath):
|
||||
def getPyfaPath(Append=None):
|
||||
base = getattr(sys.modules['__main__'], "__file__", sys.executable) if isFrozen() else sys.argv[0]
|
||||
root = os.path.dirname(os.path.realpath(os.path.abspath(base)))
|
||||
if type(root) == str: # leave unicode ones alone
|
||||
try:
|
||||
root = root.decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
root = root.decode('windows-1252')
|
||||
|
||||
if not Append:
|
||||
return root
|
||||
|
||||
if type(root) == str: # leave unicode ones alone
|
||||
try:
|
||||
path = os.path.abspath(os.path.join(root, Append)).decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
path = os.path.abspath(os.path.join(root, Append)).decode('windows-1252')
|
||||
if Append:
|
||||
path = parsePath(root, Append)
|
||||
else:
|
||||
path = os.path.abspath(os.path.join(root, Append))
|
||||
path = parsePath(root)
|
||||
|
||||
return path
|
||||
|
||||
|
||||
def getSavePath(Append=None):
|
||||
root = os.path.expanduser(os.path.join("~", ".pyfa"))
|
||||
if type(root) == str: # leave unicode ones alone
|
||||
try:
|
||||
root = root.decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
root = root.decode('windows-1252')
|
||||
|
||||
if not Append:
|
||||
return root
|
||||
|
||||
if type(root) == str: # leave unicode ones alone
|
||||
try:
|
||||
path = os.path.abspath(os.path.join(root, Append)).decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
path = os.path.abspath(os.path.join(root, Append)).decode('windows-1252')
|
||||
if Append:
|
||||
path = parsePath(root, Append)
|
||||
else:
|
||||
path = os.path.abspath(os.path.join(root, Append))
|
||||
path = parsePath(root)
|
||||
|
||||
return path
|
||||
|
||||
|
||||
def parsePath(root, Append=None):
|
||||
if Append:
|
||||
path = os.path.join(root, Append)
|
||||
else:
|
||||
path = root
|
||||
|
||||
if type(path) == str: # leave unicode ones alone
|
||||
try:
|
||||
path = path.decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
path = path.decode('windows-1252')
|
||||
|
||||
return path
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
import cStringIO
|
||||
import os.path
|
||||
import zipfile
|
||||
from config import parsePath
|
||||
|
||||
import wx
|
||||
|
||||
@@ -76,7 +77,7 @@ class BitmapLoader():
|
||||
filename = "{0}.png".format(name)
|
||||
|
||||
if cls.archive:
|
||||
path = os.path.join(location, filename)
|
||||
path = parsePath(location, filename)
|
||||
if os.sep != "/" and os.sep in path:
|
||||
path = path.replace(os.sep, "/")
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import gui.mainFrame
|
||||
import service
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from gui.graph import Graph
|
||||
from config import parsePath
|
||||
|
||||
enabled = True
|
||||
mplImported = False
|
||||
@@ -49,18 +50,8 @@ class GraphFrame(wx.Frame):
|
||||
cache_dir = mpl._get_cachedir()
|
||||
except:
|
||||
cache_dir = os.path.expanduser(os.path.join("~", ".matplotlib"))
|
||||
if type(cache_dir) == str: # leave unicode ones alone
|
||||
try:
|
||||
cache_dir = cache_dir.decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
cache_dir = cache_dir.decode('windows-1252')
|
||||
|
||||
cache_file = os.path.join(cache_dir, 'fontList.cache')
|
||||
if type(cache_file) == str: # leave unicode ones alone
|
||||
try:
|
||||
cache_file = cache_file.decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
cache_file = cache_file.decode('windows-1252')
|
||||
cache_file = parsePath(cache_dir, 'fontList.cache')
|
||||
|
||||
if os.access(cache_dir, os.W_OK | os.X_OK) and os.path.isfile(cache_file):
|
||||
# remove matplotlib font cache, see #234
|
||||
|
||||
@@ -52,12 +52,7 @@ class FileCache(APICache):
|
||||
os.mkdir(self.path, 0o700)
|
||||
|
||||
def _getpath(self, key):
|
||||
path = os.path.join(self.path, str(hash(key)) + '.cache')
|
||||
if type(path) == str: # leave unicode ones alone
|
||||
try:
|
||||
path = path.decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
path = path.decode('windows-1252')
|
||||
path = config.parsePath(self.path, str(hash(key)) + '.cache')
|
||||
return path
|
||||
|
||||
def put(self, key, value):
|
||||
|
||||
@@ -44,12 +44,7 @@ class SettingsProvider():
|
||||
|
||||
s = self.settings.get(area)
|
||||
if s is None:
|
||||
p = os.path.join(self.BASE_PATH, area)
|
||||
if type(p) == str: # leave unicode ones alone
|
||||
try:
|
||||
p = p.decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
p = p.decode('windows-1252')
|
||||
p = config.parsePath(self.BASE_PATH, area)
|
||||
|
||||
if not os.path.exists(p):
|
||||
info = {}
|
||||
|
||||
Reference in New Issue
Block a user