From fdcca005a4dd62a55476f013945a5930d4f88f53 Mon Sep 17 00:00:00 2001 From: A_D Date: Sun, 18 Oct 2020 09:48:23 +0200 Subject: [PATCH 1/7] Added name mangling support to EDMCContextFilter Python name mangling is more about name collisions than actually making things private. This commit adds a check to resolve mangled names to their runtime names, and adds a just-in-case default to fetching the attribute. Fixes #764 --- EDMCLogging.py | 8 ++++++-- EDMarketConnector.py | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/EDMCLogging.py b/EDMCLogging.py index 246ee78d..846dba84 100644 --- a/EDMCLogging.py +++ b/EDMCLogging.py @@ -287,11 +287,15 @@ class EDMCContextFilter(logging.Filter): frame_info = inspect.getframeinfo(frame) args, _, _, value_dict = inspect.getargvalues(frame) if len(args) and args[0] in ('self', 'cls'): - frame_class = value_dict[args[0]] + frame_class: 'object' = value_dict[args[0]] if frame_class: + # See https://en.wikipedia.org/wiki/Name_mangling#Python for how name mangling works. + if (name := frame_info.function).startswith("__") and not name.endswith("__"): + name = f'_{frame_class.__class__.__name__}{frame_info.function}' + # Find __qualname__ of the caller - fn = getattr(frame_class, frame_info.function) + fn = getattr(frame_class, name, None) if fn and fn.__qualname__: caller_qualname = fn.__qualname__ diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 90ff631f..63cc2f6f 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -1165,6 +1165,10 @@ sys.path: {sys.path}''' def __init__(self): logger.debug('A call from A.B.__init__') + self.__test() + + def __test(self): + logger.debug("A call from A.B.__test") # abinit = A.B() From 0f3c784f33e38f2640abb74647b5591911c3277d Mon Sep 17 00:00:00 2001 From: Athanasius Date: Sun, 18 Oct 2020 12:05:28 +0100 Subject: [PATCH 2/7] Logging: Backport name mangling support for Python 3.7 --- EDMCLogging.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EDMCLogging.py b/EDMCLogging.py index 846dba84..308e85fc 100644 --- a/EDMCLogging.py +++ b/EDMCLogging.py @@ -291,7 +291,8 @@ class EDMCContextFilter(logging.Filter): if frame_class: # See https://en.wikipedia.org/wiki/Name_mangling#Python for how name mangling works. - if (name := frame_info.function).startswith("__") and not name.endswith("__"): + name = frame_info.function + if name.startswith("__") and not name.endswith("__"): name = f'_{frame_class.__class__.__name__}{frame_info.function}' # Find __qualname__ of the caller From 57f3e08f85a2aabd9dc0b944b55c07702747f8d1 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Mon, 26 Oct 2020 13:45:28 +0000 Subject: [PATCH 3/7] requirements: py2exe now on pypi, bump to 0.10.0.2 Confirmed working with python 3.7.9 --- requirements-dev.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 7f756495..b50ae664 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -20,9 +20,8 @@ autopep8==1.5.4 grip>=4.5.2 # Packaging -# This isn't available via 'pip install', so has to be commented out in order for -# GitHub Action Workflows to not error out -#py2exe==0.9.3.2 +# We only need py2exe on windows. +py2exe==0.10.0.2; sys_platform == 'win32' # All of the normal requirements -r requirements.txt From a68f5d6e842d6d10d945e34272e817781faeabd4 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 15 Dec 2020 14:45:50 +0000 Subject: [PATCH 4/7] Initial changelog for 4.1.5. --- ChangeLog.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index e6d07440..b0a8df55 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,46 @@ This is the master changelog for Elite Dangerous Market Connector. Entries are in reverse chronological order (latest first). --- +Release 4.1.5 +=== + +* If there is already an EDMarketConnector.exe process running when trying + to run another instance then that new process will no longer exit silently. + Instead you'll get a pop-up telling you it's detected another process, and + you need to close that pop-up in order for this additional process to then + exit. + + This hopefully makes it obvious when you've got a hung EDMarketConnect.exe + process that you need to kill in order to re-run the program. + +* In order to gather more information about how and why EDMarketConnector.exe + sometimes doesn't shutdown properly we've added some extra debug logging to + the sequence of clean-up calls performed during shutdown. + + Also, to make it more obvious if the process has hung during shutdown the + UI window is no longer hidden at the start of this shutdown sequence. It + will instead linger, with "Shutting down..." showing in the status line + (translation for this small phrase will be added in a later release). + +* Cater for 'mangled name' class functions in our logging code. e.g. where + you name a class member with a `__` prefix in order to 'hide' it from + out-of-class code. + +* Fixed logging from EDMC.exe so that the -debug log goes into `EDMC-debug.log` + not `EDMarketConnector-debug.log`. + +* Fix `EDMC.exe -j` handling of file encodings. NB: This command-line + argument isn't listed on `EDMC.exe -h` as it's intended for developer use + only. + +* Fix the name of 'Void Opal(s)' so that output of market data to files is + correct. + +* Fix URL in PLUGINS.md to refer to `main`, not `master` branch. + +* We're able to pull `py2exe` from PyPi now, so docs/Releasing.md has been + update to reflect this. + Release 4.1.4 === From 95becbc49ce83cb23a7cea8ccf5bbc1565e4a739 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 15 Dec 2020 19:45:17 +0000 Subject: [PATCH 5/7] 4.1.5 Changelog: The '??:??' logging thing, bug linking & preamble. --- ChangeLog.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index b0a8df55..e0debc15 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -4,6 +4,10 @@ This is the master changelog for Elite Dangerous Market Connector. Entries are Release 4.1.5 === +This is a minor maintenance release, mostly addressing behaviour around +process shutdown and startup, along with a couple of small enhancements that +most users won't notice. + * If there is already an EDMarketConnector.exe process running when trying to run another instance then that new process will no longer exit silently. Instead you'll get a pop-up telling you it's detected another process, and @@ -22,10 +26,22 @@ Release 4.1.5 will instead linger, with "Shutting down..." showing in the status line (translation for this small phrase will be added in a later release). + If you encounter this shutdown hang then please add a comment to + [Application can leave a zombie process on shutdown #678](https://github.com/EDCD/EDMarketConnector/issues/678) + to help us track down the cause and fix it. + * Cater for 'mangled name' class functions in our logging code. e.g. where you name a class member with a `__` prefix in order to 'hide' it from out-of-class code. +* To help track down the cause of [Crashing On Startup #798](https://github.com/EDCD/EDMarketConnector/issues/798) + we've added some exception catching in our logging code. If this is + triggered you will see `??:??` in logging output, instead of class and/or + function names. + + If you encounter this then please comment on that bug report to aid us in + tracking down the root cause! + * Fixed logging from EDMC.exe so that the -debug log goes into `EDMC-debug.log` not `EDMarketConnector-debug.log`. From 741d62c072c04992a390b38178fabbe7ee46edf3 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 15 Dec 2020 19:57:24 +0000 Subject: [PATCH 6/7] Release 4.1.5: Config.py version bump --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index 880f559d..e60ff1cd 100644 --- a/config.py +++ b/config.py @@ -13,7 +13,7 @@ appcmdname = 'EDMC' # appversion **MUST** follow Semantic Versioning rules: # # Major.Minor.Patch(-prerelease)(+buildmetadata) -appversion = '4.1.4' #-rc1+a872b5f' +appversion = '4.1.5' #-rc1+a872b5f' # For some things we want appversion without (possible) +build metadata appversion_nobuild = str(semantic_version.Version(appversion).truncate('prerelease')) copyright = u'© 2015-2019 Jonathan Harris, 2020 EDCD' From 819bb27997ef2649fac575cfd79113893cc957a6 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 15 Dec 2020 20:02:24 +0000 Subject: [PATCH 7/7] 4.1.5: appcast file update --- edmarketconnector.xml | 70 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/edmarketconnector.xml b/edmarketconnector.xml index 83782562..a696a1e4 100644 --- a/edmarketconnector.xml +++ b/edmarketconnector.xml @@ -168,11 +168,73 @@ - Release 4.1.4 + Release 4.1.5 body { font-family:"Segoe UI","Tahoma"; font-size: 75%; } h2 { font-family:"Segoe UI","Tahoma"; font-size: 105%; } +

Release 4.1.5

+

This is a minor maintenance release, mostly addressing behaviour around +process shutdown and startup, along with a couple of small enhancements that +most users won't notice.

+
    +
  • +

    If there is already an EDMarketConnector.exe process running when trying +to run another instance then that new process will no longer exit silently. +Instead you'll get a pop-up telling you it's detected another process, and +you need to close that pop-up in order for this additional process to then +exit.

    +

    This hopefully makes it obvious when you've got a hung EDMarketConnect.exe +process that you need to kill in order to re-run the program.

    +
  • +
  • +

    In order to gather more information about how and why EDMarketConnector.exe +sometimes doesn't shutdown properly we've added some extra debug logging to +the sequence of clean-up calls performed during shutdown.

    +

    Also, to make it more obvious if the process has hung during shutdown the +UI window is no longer hidden at the start of this shutdown sequence. It +will instead linger, with "Shutting down..." showing in the status line +(translation for this small phrase will be added in a later release).

    +

    If you encounter this shutdown hang then please add a comment to +Application can leave a zombie process on shutdown #678 +to help us track down the cause and fix it.

    +
  • +
  • +

    Cater for 'mangled name' class functions in our logging code. e.g. where +you name a class member with a __ prefix in order to 'hide' it from +out-of-class code.

    +
  • +
  • +

    To help track down the cause of Crashing On Startup #798 +we've added some exception catching in our logging code. If this is +triggered you will see ??:?? in logging output, instead of class and/or +function names.

    +

    If you encounter this then please comment on that bug report to aid us in +tracking down the root cause!

    +
  • +
  • +

    Fixed logging from EDMC.exe so that the -debug log goes into EDMC-debug.log +not EDMarketConnector-debug.log.

    +
  • +
  • +

    Fix EDMC.exe -j handling of file encodings. NB: This command-line +argument isn't listed on EDMC.exe -h as it's intended for developer use +only.

    +
  • +
  • +

    Fix the name of 'Void Opal(s)' so that output of market data to files is +correct.

    +
  • +
  • +

    Fix URL in PLUGINS.md to refer to main, not master branch.

    +
  • +
  • +

    We're able to pull py2exe from PyPi now, so docs/Releasing.md has been +update to reflect this.

    +
  • +
+ +

Release 4.1.4

The only change from 4.1.3 is to insert some Windows version checks before even attempting to set a UTF-8 encoding. We'll now only attempt this if the @@ -824,11 +886,11 @@ If any of your plugins are listed in that section then they will need updating, ]]>