Skip to content

Commit

Permalink
Merge pull request #50 from scijava/rename-jgo_main
Browse files Browse the repository at this point in the history
Rename jgo_main to _jgo_main
  • Loading branch information
ctrueden authored Aug 7, 2019
2 parents 2ddddf7 + 9c7a4db commit 5d59122
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion jgo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .jgo import resolve_dependencies, jgo_main as main
from .jgo import resolve_dependencies, _jgo_main as main
from .util import main_from_endpoint, maven_scijava_repository, add_jvm_args_as_necessary
21 changes: 18 additions & 3 deletions jgo/jgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def jgo_parser():

return parser

def jgo_main(argv=sys.argv[1:], stdout=None, stderr=None):
def _jgo_main(argv=sys.argv[1:], stdout=None, stderr=None):

LOG_FORMAT = '%(levelname)s %(asctime)s: %(message)s'
logging.basicConfig(
Expand All @@ -280,8 +280,23 @@ def jgo_main(argv=sys.argv[1:], stdout=None, stderr=None):

parser = jgo_parser()

completed_process = run(parser, argv=argv, stdout=stdout, stderr=stderr)
completed_process.check_returncode()
try:
completed_process = run(parser, argv=argv, stdout=stdout, stderr=stderr)
completed_process.check_returncode()

except HelpRequested:
pass
parser.print_help()

except NoEndpointProvided:
parser.print_usage()
_logger.error('No endpoint provided. Run `jgo --help\' for a detailed help message.')
return 254

except subprocess.CalledProcessError as e:
return e.returncode

return 0


def jgo_cache_dir_environment_variable():
Expand Down
2 changes: 1 addition & 1 deletion jgo/util.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import psutil
import sys

from .jgo import jgo_main as main
from .jgo import _jgo_main as main

def add_jvm_args_as_necessary(argv, gc_option='-XX:+UseConcMarkSweepGC'):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
test_suite='nose.collector',
entry_points={
'console_scripts': [
'jgo=jgo.jgo:jgo_main'
'jgo=jgo:main'
]
},
python_requires='>=3',
Expand Down

0 comments on commit 5d59122

Please sign in to comment.