Commit Graph
146 Commits
Author SHA1 Message Date
A_D e3def21683 Made sure to handle an empty journal dir in the config 2021-04-01 14:45:46 +01:00
A_D 278480b99f replaced ors with defaults in config usage 2021-04-01 14:45:46 +01:00
Athanasius 25852997c5 Updated all source to use new config methods
# Conflicts:
#	monitor.py
2021-04-01 14:45:46 +01:00
A_D 8bb9cecfc0 Explanation comment on try/except 2020-12-02 16:08:06 +02:00
A_D 9ec03008ce Moved comment to correct place 2020-12-02 16:03:43 +02:00
A_D 977e62188a Made sure to handle non-utf8 locales 2020-12-02 15:57:42 +02:00
A_D 52d39dc5fd Moved os.environ above logging import 2020-12-02 15:54:59 +02:00
Athanasius 72119d6818 EDMC: Revert accidental change of boolean logic
not (A or B) != not A or B

Although "not A and not B" would be equivalent.
2020-10-07 09:58:51 +01:00
Athanasius 9e6e718e23 Logging: Document trace/TRACE workaround & expand other docs. 2020-09-28 11:02:13 +01:00
Athanasius 3c0ac76f90 Trace: Add support to EDMC.py & misc cleanups
* EDMC: Add --trace (to match EDMarketConnector.py) and TRACE as option to
  --loglevel.
* EDMC: docstrings added.
* EDMCLogging: Set logger name based on if GUI or CLI.
* EDMarketConnector:
  * Re-order imports.
  * Misc. formatting cleanups.
  * f-strings not .format().
  * Removed un-necessary "# noqa: N806" comments.
2020-09-23 17:38:38 +01:00
Athanasius fa326ad3d3 EDMC.py: Move DEBUG logging to after level is set. 2020-09-22 15:54:18 +01:00
Athanasius edc6ed6596 Add locale DEBUG logging to EDMC.py 2020-09-22 15:37:45 +01:00
Athanasius f73a372e6b EDMC.py: Correct import eddn position, with isort comments
isort thinks this is a STDLIB import, when it's actually from the
plugins directory.  So add comments to stop isort from re-ordering it.
2020-09-11 14:09:47 +01:00
Athanasius 55fe4f37b8 EDMC: Blank line on scope change 2020-09-07 16:54:08 +01:00
Athanasius 30c9dbefc1 EDMC.py: General flake8 cleanup.
* Fix f-strings that are just plain strings.
* Sort imports.
* noqa E501 lines I want that long.
* And misc other minor cleanups.
2020-09-07 15:06:15 +01:00
Athanasius faeb579be6 EDMC: Corrections to logging
* Use appcmdname as the logger name so it looks different from the GUI
  version.  This also causes a different log filename in the rotated log
  set.
* Log at DEBUG for Startup and Exiting.  Which means replacing all of
  the `sys.exit(EXIT_SUCCESS)` with `return` so we can log the Exit
  after `main()` returns and then `sys.exit(EXIT_SUCCESS)` there.
2020-09-07 14:10:27 +01:00
Athanasius 815b4695a6 Use logger.exception() to take care of showing the exception. 2020-09-06 19:19:23 +01:00
Athanasius 50c7220455 EDMC: Adding logging, including CL arg to set level 2020-09-06 19:07:37 +01:00
Athanasius ed9a4cfe29 Revert "Cause EDMC.py to diff to check the detection"
This reverts commit 3b55a7a5de.
2020-07-29 15:00:39 +01:00
Athanasius 9a5884b57d Cause EDMC.py to diff to check the detection 2020-07-29 15:00:39 +01:00
A_D f08d60d9b1 revert using json.dump
windows encodings dont like the weird characters
2020-07-26 23:08:47 +01:00
A_D 0e0c802b04 Fixed missed whitespace after scope changes 2020-07-26 23:08:47 +01:00
A_D 64b9cb39a9 Replaced file.write(json.dumps()) with json.dump
There's no reason to use json.dumps and directly encode it when we can
let the json lib do the heavy lifting
2020-07-26 23:08:47 +01:00
A_D 566f52e61f removed uneeded parens 2020-07-26 23:08:47 +01:00
A_D 14295ce9e8 Fixed scope whitespace and long lines 2020-07-26 23:08:47 +01:00
A_D 8b0f3e74cf Replaced format directives with fstrings 2020-07-26 23:08:47 +01:00
A_D c6d8b4eab8 Renamed variable for clarity 2020-07-26 23:08:47 +01:00
A_D 0e000de90a Replaced type annotation with Optional
The return is Optional so the annotation on the other side must be as
well, lest we have large red squiggles
2020-07-26 23:08:47 +01:00
A_D 3dfca91e1d Fixed invalid deep_get call 2020-07-26 23:08:47 +01:00
A_D b6482878f0 Fix deep_get not returning the correct on success
I forgot to actually return the given data if we manage to index to the
requested depth
2020-07-26 23:08:47 +01:00
A_D 2403ed1d2f Replaced missed .get chains with deep_get 2020-07-26 23:08:47 +01:00
A_D 4ee8869426 Revert part of e510b783
Apparently config.get does _not_ take a default param. It really should.
2020-07-26 23:08:47 +01:00
A_D 664605a315 Cleaned up ifs where possible
Removed redundant or unneeded parens, correctly added line breaks where
needed
2020-07-26 23:08:47 +01:00
A_D 1ed9225c44 Added main guard
Modules should _always_ check that they are main before doing any "real"
work
2020-07-26 23:08:47 +01:00
A_D 637f58bb06 Replaced modulo-formatting with .format 2020-07-26 23:08:47 +01:00
A_D 0dfad42de3 Replaced .get chains with a new method
`deep_get` will go down a list of keys on a dict to find either the
requested key or the default if somewhere along the line the given dict
doesn't have a given key
2020-07-26 23:08:47 +01:00
A_D 8117e18963 Don't recompile regexps where possible
While the python re lib _does_ cache compiled regexps, it only does this
to a point, it's better to compile once and hold a reference
2020-07-26 23:08:47 +01:00
A_D 37c01c028c Replaced list comprehension with generator
Creating a list here doesnt make sense when its almost instantly
recreated.
2020-07-26 23:08:47 +01:00
A_D 31c049deda Replace sys.stderr.write call with print
`print()` supports files other than stdout, and will automatically add
newlines for us, among other things
2020-07-26 23:08:47 +01:00
A_D f9b860fd5c removed bare except clause 2020-07-26 23:08:47 +01:00
A_D 9d727aaa99 Remove unused variables in as e clauses 2020-07-26 23:08:47 +01:00
A_D 2592af8c9f block flake8 line length on doc line 2020-07-26 23:08:47 +01:00
A_D 2e21960568 add newlines on scope changes 2020-07-26 23:08:47 +01:00
A_D 1f1e34d722 ensure that comments have two spaces before
most of the files have tabs between code and comments
2020-07-26 23:08:47 +01:00
Athanasius 35f573bc14 Updater class now used for all updates checking
* Updater.__init__() now takes 'provider' argument to specify if we use
 the internal checking code, or the available external code.
* EDMC.py changed to utilise this with internal provider.
* EDMarketConnector.py changed to use internal provider if not frozen,
 else the internal provider.
* Corrected the darwin/MacOS toggling of auto updates checking to actually
 use the Sparkle, not WinSparkle, API call.
* Updater.check_appcast() does the internal checking:
    * class EDMCVersion to hold the information.
    * Returns None on any error, or if it didn't find a newer version.
    * Returns an EDMCVersion object if it found a newer version.
2020-07-19 11:45:07 +01:00
Athanasius ea2c7f6894 Revert accidental change to test update_feed. 2020-07-19 11:45:07 +01:00
Athanasius 1ee8756983 Re-engineering of EDMC.py version update check
* Uses semantic_version.
* Filters on sparkle:os.
* Catches specific exceptions.
2020-07-19 11:45:07 +01:00
Athanasius b1e1fc3a34 Restore 'EDMC -v' to announcing newer versions.
I got too enthusiastic in 3ff77c3c54 when
I removed the "cut it down to A.BC" code.  This restores the old output,
but using a less confusing if/else.
2020-07-15 10:27:29 +01:00
A_D be98365fb3 Fix #568 with ENV var workaround
EDMC.py would break due to an import chain that ends up in theme. Theme
does a whole bunch of work to setup our GUI for EDMarketConnector.py,
but it does this on any import, which will fail spectacularly if there
is either no DISPLAY var set or no X11 libs available on our machine at
all (as a sidenote this means it probably also breaks on a wholly
wayland install).

This fixes the issue by adding a check for an environment variable on
import of theme. This can and WILL break if the env var is set and
EDMarketConnector.py is used, but if you do that its your own fault.
2020-07-08 17:55:54 +02:00
Athanasius 3ff77c3c54 EDMC.py: import re, fix version compare and report
* I neglected to `import re` when I changed the Journal file name check.
* `map` isn't comparable in Python 3.7, need to `list()` it as well.
* Just print the full `appversion`.  The old code was assuming that none of
  A, B, C, D in A.B.C.D would be two or more digits.

close #566
2020-07-07 19:02:06 +01:00