general: extract the hack to warn of legacy imports and fallback to core/legacy.py

use it both in my.fbmessenger and my.reddit

if in the future any new modules need to be switched to namespace package structure with all.py it should make it easy to do

related:
- https://github.com/karlicoss/HPI/issues/12
- https://github.com/karlicoss/HPI/issues/89
- https://github.com/karlicoss/HPI/issues/102
This commit is contained in:
Dima Gerasimov 2022-06-01 23:02:58 +01:00
parent 75a61617cb
commit 63bd3e72df
4 changed files with 87 additions and 82 deletions

View file

@ -12,7 +12,7 @@ import logzero # type: ignore[import]
logger = logzero.logger
MSG = 'DEPRECATED! Instead of my.fbmessengerexport'
MSG = 'importing my.fbmessenger is DEPRECATED'
def expect(*cmd: str, should_warn: bool=True) -> None:
res = run(cmd, stderr=PIPE)