Skip to content

Commit

Permalink
Switched from scripts to entry_points.
Browse files Browse the repository at this point in the history
  • Loading branch information
moorepants committed Jun 7, 2024
1 parent 2f50435 commit bdb0139
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/runtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ jobs:
shell: bash -l {0}
run: |
python setup.py install
which yeadon
yeadon -h
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
tests_require=['nose>=1.3.7'],
test_suite='nose.collector',
include_package_data=True,
entry_points={'console_scripts': ['yeadon = yeadon.app']},
entry_points={'console_scripts': ['yeadon=yeadon.app:run']},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research',
Expand Down
21 changes: 14 additions & 7 deletions yeadon/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,39 @@

"""Runs the GUI or the UI. The UI is a fallback if MayaVi is not installed."""

if __name__ == '__main__':
import argparse


import argparse
def run():

parser = argparse.ArgumentParser(description='Yeadon command line options.')
parser = argparse.ArgumentParser(
description='Yeadon command line options.')

parser.add_argument('-g', '--gui', action="store_true",
help='Runs the graphical user interface.')
help='Runs the graphical user interface.')

parser.add_argument('-u', '--ui', action="store_true",
help='Runs the text based user interface.')
help='Runs the text based user interface.')

args = parser.parse_args()

try:
import mayavi
except ImportError:
print("MayaVi is not installed, resorting to text based user interface.")
print("MayaVi is not installed, resorting to text based user "
"interface.")
has_mayavi = False
else:
del mayavi
has_mayavi = True

if args.ui == True or has_mayavi == False:
if args.ui or not has_mayavi:
from yeadon.ui import start_ui
start_ui()
else:
from yeadon.gui import start_gui
start_gui()


if __name__ == '__main__':
run()

0 comments on commit bdb0139

Please sign in to comment.