lpcmanager

Parents 7dd488886ff5
Children 58207f9819eb
Added sentry.io client for report bug and error but only if on a register is set Report key. Remove override function _Generate_C and override just canfestival_config.
  • +28 -66
    LPCManager.py
  • --- a/LPCManager.py Mon Jun 05 15:49:27 2017 +0200
    +++ b/LPCManager.py Tue Jun 06 10:07:39 2017 +0200
    @@ -6,12 +6,6 @@
    import zipfile
    import fnmatch
    import threading
    -import faulthandler
    -from raven import Client
    -
    -
    -client = Client('https://2d582ee8f9234cc08283f8a686c92dae:631a5b935bf64b36b5a2d1781af437b2@sentry.io/174818')
    -faulthandler.enable()
    __version__ = "$Revision$"
    @@ -31,7 +25,6 @@
    #wxversion.select(['2.8', '3.0'])
    wxversion.select(['3.0'])
    import wx
    - # from wx.lib.pubsub import pub
    def Bpath(*args):
    @@ -96,6 +89,21 @@
    from util.BitmapLibrary import AddBitmapFolder
    AddBitmapFolder(os.path.join(_lpcmanager_path, "images"))
    + config = wx.ConfigBase.Get()
    + report = str(config.Read("Report"))
    + if report == "":
    + config.Write("Report", '0')
    + report = '0'
    + if report == '1':
    + report = True
    + else:
    + report = False
    +
    + if report:
    + from raven import Client
    +
    + client = Client('https://2d582ee8f9234cc08283f8a686c92dae:631a5b935bf64b36b5a2d1781af437b2@sentry.io/174818')
    +
    _lpcmanager_path = os.path.split(__file__)[0]
    import features
    @@ -176,48 +184,6 @@
    from py_ext import PythonFileCTNMixin
    -def _Generate_C(self, buildpath, locations):
    - # Generate confnodes [(Cfiles, CFLAGS)], LDFLAGS, DoCalls, extra_files
    - # extra_files = [(fname,fobject), ...]
    - gen_result = self.CTNGenerate_C(buildpath, locations)
    - CTNCFilesAndCFLAGS, CTNLDFLAGS, DoCalls = gen_result[:3]
    - extra_files = gen_result[3:]
    - # if some files have been generated put them in the list with their location
    - if CTNCFilesAndCFLAGS:
    - LocationCFilesAndCFLAGS = [(self.GetCurrentLocation(), CTNCFilesAndCFLAGS, DoCalls)]
    - else:
    - LocationCFilesAndCFLAGS = []
    -
    - # confnode asks for some LDFLAGS
    - if CTNLDFLAGS:
    - # LDFLAGS can be either string
    - if type(CTNLDFLAGS) == type(str()) or type(CTNLDFLAGS) == type(unicode()):
    - LDFLAGS = [CTNLDFLAGS]
    - # or list of strings
    - elif type(CTNLDFLAGS) == type(list()):
    - LDFLAGS = CTNLDFLAGS[:]
    - else:
    - LDFLAGS = []
    -
    - # recurse through all children, and stack their results
    - for CTNChild in self.IECSortedChildren():
    - new_location = CTNChild.GetCurrentLocation()
    - # How deep are we in the tree ?
    - depth = len(new_location)
    - _LocationCFilesAndCFLAGS, _LDFLAGS, _extra_files = \
    - CTNChild._Generate_C(
    - # keep the same path
    - buildpath,
    - # filter locations that start with current IEC location
    - [loc for loc in locations if loc["LOC"][0:depth] == new_location])
    - # stack the result
    - LocationCFilesAndCFLAGS += _LocationCFilesAndCFLAGS
    - LDFLAGS += _LDFLAGS
    - extra_files += _extra_files
    -
    - return LocationCFilesAndCFLAGS, LDFLAGS, extra_files
    -ConfigTreeNode._Generate_C = _Generate_C
    -
    def CTNGenerate_C(self, buildpath, locations):
    # location string for that CTN
    location_str = "_".join(map(lambda x: str(x),
    @@ -1208,15 +1174,18 @@
    # -------------------------------------------------------------------------------
    # CANFESTIVAL CONFNODE HACK
    # -------------------------------------------------------------------------------
    -# from canfestival import canfestival
    -# class LPC_canfestival_config:
    -# def getCFLAGS(self, *args):
    -# return ""
    -#
    -# def getLDFLAGS(self, *args):
    -# return ""
    -#
    -# canfestival.local_canfestival_config = LPC_canfestival_config()
    +from canfestival import canfestival
    +defaultGetCFLAGS = canfestival.local_canfestival_config.getCFLAGS
    +defaultGetLDFLAGS = canfestival.local_canfestival_config.getLDFLAGS
    +
    +def getCFLAGS(*args):
    + return str(defaultGetCFLAGS(*args))
    +
    +def getLDFLAGS(*args):
    + return str(defaultGetLDFLAGS(*args))
    +
    +canfestival.local_canfestival_config.getCFLAGS = getCFLAGS
    +canfestival.local_canfestival_config.getLDFLAGS = getLDFLAGS
    import LPCBus as LPCBus_mod
    @@ -2513,8 +2482,6 @@
    if __name__ == '__main__':
    - # try:
    -
    from threading import Thread, Timer, Semaphore, Lock
    import cmd
    @@ -2917,9 +2884,4 @@
    ResetwxGlade()
    - app.MainLoop()
    -
    - # except Exception, e:
    - # import traceback
    - # errmess = traceback.format_exc()
    - # print("Traceback: {}\n{}".format(e, errmess))
    \ No newline at end of file
    + app.MainLoop()
    \ No newline at end of file