Skip to content

Commit

Permalink
Merge pull request #140 from moorepants/entrypoint
Browse files Browse the repository at this point in the history
Switched the comman line executable to an entry_point instead of `bin/yeadon`.
  • Loading branch information
moorepants authored Jun 7, 2024
2 parents 680e53e + bdb0139 commit 9dac142
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 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
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ recursive-include doc *.rst
include doc/*.png
include doc/Makefile
include doc/conf.py
include bin/*
recursive-include misc *
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,
scripts=['bin/yeadon'],
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 bin/yeadon → 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 9dac142

Please sign in to comment.