Skip to content

Commit bdb0139

Browse files
committed
Switched from scripts to entry_points.
1 parent 2f50435 commit bdb0139

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

.github/workflows/runtests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ jobs:
4141
shell: bash -l {0}
4242
run: |
4343
python setup.py install
44+
which yeadon
4445
yeadon -h

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
tests_require=['nose>=1.3.7'],
2424
test_suite='nose.collector',
2525
include_package_data=True,
26-
entry_points={'console_scripts': ['yeadon = yeadon.app']},
26+
entry_points={'console_scripts': ['yeadon=yeadon.app:run']},
2727
classifiers=[
2828
'Development Status :: 5 - Production/Stable',
2929
'Intended Audience :: Science/Research',

yeadon/app.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,39 @@
22

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

5-
if __name__ == '__main__':
5+
import argparse
6+
67

7-
import argparse
8+
def run():
89

9-
parser = argparse.ArgumentParser(description='Yeadon command line options.')
10+
parser = argparse.ArgumentParser(
11+
description='Yeadon command line options.')
1012

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

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

1719
args = parser.parse_args()
1820

1921
try:
2022
import mayavi
2123
except ImportError:
22-
print("MayaVi is not installed, resorting to text based user interface.")
24+
print("MayaVi is not installed, resorting to text based user "
25+
"interface.")
2326
has_mayavi = False
2427
else:
2528
del mayavi
2629
has_mayavi = True
2730

28-
if args.ui == True or has_mayavi == False:
31+
if args.ui or not has_mayavi:
2932
from yeadon.ui import start_ui
3033
start_ui()
3134
else:
3235
from yeadon.gui import start_gui
3336
start_gui()
37+
38+
39+
if __name__ == '__main__':
40+
run()

0 commit comments

Comments
 (0)