diff --git a/setup.cfg b/setup.cfg index fefc293..78a9b5b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,4 +28,4 @@ install_requires = [options.entry_points] console_scripts = - rofi-rbw = rofi_rbw.rofi_rbw:main + rofi-rbw = rofi_rbw.__main__:main diff --git a/src/rofi_rbw/__main__.py b/src/rofi_rbw/__main__.py new file mode 100644 index 0000000..a2bbfd0 --- /dev/null +++ b/src/rofi_rbw/__main__.py @@ -0,0 +1,9 @@ +from .rofi_rbw import RofiRbw + + +def main(): + RofiRbw().main() + + +if __name__ == '__main__': + main() diff --git a/src/rofi_rbw/clipboarder.py b/src/rofi_rbw/clipboarder.py index d103d31..3cb513c 100644 --- a/src/rofi_rbw/clipboarder.py +++ b/src/rofi_rbw/clipboarder.py @@ -1,12 +1,7 @@ import time from subprocess import run -try: - from rofi_rbw.abstractionhelper import is_wayland, is_installed - from rofi_rbw.typer import Typer -except ModuleNotFoundError: - from abstractionhelper import is_wayland, is_installed - from typer import Typer +from .abstractionhelper import is_wayland, is_installed class Clipboarder: diff --git a/src/rofi_rbw/credentials.py b/src/rofi_rbw/credentials.py index 276f4b7..d2e3969 100644 --- a/src/rofi_rbw/credentials.py +++ b/src/rofi_rbw/credentials.py @@ -1,10 +1,7 @@ from subprocess import run from typing import Union, Optional, List -try: - from rofi_rbw.models import Target, Targets -except ModuleNotFoundError: - from models import Target, Targets +from .models import Target, Targets class Credentials: diff --git a/src/rofi_rbw/rofi_rbw.py b/src/rofi_rbw/rofi_rbw.py index d0bebcb..883f742 100755 --- a/src/rofi_rbw/rofi_rbw.py +++ b/src/rofi_rbw/rofi_rbw.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- import argparse import shlex from subprocess import run @@ -7,22 +5,13 @@ import configargparse -try: - from rofi_rbw.models import Action, Target, Targets, CANCEL, DEFAULT - from rofi_rbw.clipboarder import Clipboarder - from rofi_rbw.typer import Typer - from rofi_rbw.selector import Selector - from rofi_rbw.credentials import Credentials - from rofi_rbw.entry import Entry - from rofi_rbw.paths import * -except ModuleNotFoundError: - from models import Action, Target, Targets, CANCEL, DEFAULT - from clipboarder import Clipboarder - from typer import Typer - from selector import Selector - from credentials import Credentials - from entry import Entry - from paths import * +from .models import Action, Target, Targets, CANCEL, DEFAULT +from .clipboarder import Clipboarder +from .typer import Typer +from .selector import Selector +from .credentials import Credentials +from .entry import Entry +from .paths import * __version__ = '1.0.0-RC1' @@ -225,11 +214,3 @@ def execute_action(self, cred: Credentials) -> None: self.clipboarder.clear_clipboard_after(self.args.clear) elif self.args.action == Action.PRINT: print('\n'.join([cred[target] for target in self.args.targets])) - - -def main(): - RofiRbw().main() - - -if __name__ == "__main__": - main() diff --git a/src/rofi_rbw/selector.py b/src/rofi_rbw/selector.py index cacfa78..d2c9844 100644 --- a/src/rofi_rbw/selector.py +++ b/src/rofi_rbw/selector.py @@ -1,12 +1,8 @@ from subprocess import run from typing import List, Tuple, Union -try: - from rofi_rbw.abstractionhelper import is_wayland, is_installed - from rofi_rbw.models import Action, Target, Targets, CANCEL, DEFAULT -except: - from abstractionhelper import is_wayland, is_installed - from models import Action, Target, Targets, CANCEL, DEFAULT +from .abstractionhelper import is_wayland, is_installed +from .models import Action, Target, Targets, CANCEL, DEFAULT class Selector: diff --git a/src/rofi_rbw/typer.py b/src/rofi_rbw/typer.py index 9c727e3..39010fb 100644 --- a/src/rofi_rbw/typer.py +++ b/src/rofi_rbw/typer.py @@ -1,10 +1,7 @@ from subprocess import run import time -try: - from rofi_rbw.abstractionhelper import is_wayland, is_installed -except ModuleNotFoundError: - from abstractionhelper import is_wayland, is_installed +from .abstractionhelper import is_wayland, is_installed class Typer: