From 3404b3fcf1de811b5af61c4430a8e7060b5d0c9f Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Tue, 29 Sep 2020 19:08:08 +0100 Subject: [PATCH] my.instapaper: use instapexport from PIP package --- doc/MODULES.org | 4 ---- my/instapaper.py | 24 +++++------------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/doc/MODULES.org b/doc/MODULES.org index 2f34665..da77dec 100644 --- a/doc/MODULES.org +++ b/doc/MODULES.org @@ -226,10 +226,6 @@ for cls, p in modules: ''' # path[s]/glob to the exported JSON data export_path : Paths - - # path to a local clone of instapexport - # alternatively, you can put the repository (or a symlink) in $MY_CONFIG/my/config/repos/instapexport - instapexport: Optional[PathIsh] = None #+end_src ** [[file:../my/github/gdpr.py][my.github.gdpr]] diff --git a/my/instapaper.py b/my/instapaper.py index b312281..e051c81 100644 --- a/my/instapaper.py +++ b/my/instapaper.py @@ -21,30 +21,16 @@ class instapaper(user_config): # path[s]/glob to the exported JSON data export_path : Paths - # path to a local clone of instapexport - # alternatively, you can put the repository (or a symlink) in $MY_CONFIG/my/config/repos/instapexport - instapexport: Optional[PathIsh] = None - - @property - def dal_module(self): - rpath = self.instapexport - if rpath is not None: - from .core.common import import_dir - return import_dir(rpath, '.dal') - else: - import my.config.repos.instapexport.dal as dal - return dal - from .core.cfg import make_config config = make_config(instapaper) -from typing import TYPE_CHECKING -if TYPE_CHECKING: - import my.config.repos.instapexport.dal as dal -else: - dal = config.dal_module +try: + from instapexport import dal +except ModuleNotFoundError as e: + from .core.compat import pre_pip_dal_handler + dal = pre_pip_dal_handler('instapexport', e, config, requires=REQUIRES) ############################