comparison roundup/scripts/roundup_server.py @ 5957:f822a91b3778

Better error message running with -c and pywin32 is not importable. Atempting to do this. It should work on windows, but I can't test.
author John Rouillard <rouilj@ieee.org>
date Thu, 24 Oct 2019 20:47:46 -0400
parents 883c9e90b403
children d5c51d1ef09c
comparison
equal deleted inserted replaced
5956:1cfd52dee91b 5957:f822a91b3778
949 def run(port=undefined, success_message=None): 949 def run(port=undefined, success_message=None):
950 ''' Script entry point - handle args and figure out what to to. 950 ''' Script entry point - handle args and figure out what to to.
951 ''' 951 '''
952 config = ServerConfig() 952 config = ServerConfig()
953 # additional options 953 # additional options
954 short_options = "hvS" 954 short_options = "hvSc"
955 if RoundupService:
956 short_options += 'c'
957 try: 955 try:
958 (optlist, args) = config.getopt(sys.argv[1:], 956 (optlist, args) = config.getopt(sys.argv[1:],
959 short_options, ("help", "version", "save-config",)) 957 short_options, ("help", "version", "save-config",))
960 except (getopt.GetoptError, configuration.ConfigurationError) as e: 958 except (getopt.GetoptError, configuration.ConfigurationError) as e:
961 usage(str(e)) 959 usage(str(e))
962 return 960 return
963 961
964 # if running in windows service mode, don't do any other stuff 962 # if running in windows service mode, don't do any other stuff
965 if ("-c", "") in optlist: 963 if ("-c", "") in optlist:
964 global RoundupService
965 if not RoundupService:
966 RoundupService = True # make sure usage displays -c help text
967 error_m = """
968 ERROR: -c is not available because roundup couldn't import
969 win32serviceutil from pywin32. See Installation docs
970 for pywin32 details.
971 """
972 usage(error_m)
973 return
974
966 # acquire command line options recognized by service 975 # acquire command line options recognized by service
967 short_options = "cC:" 976 short_options = "cC:"
968 long_options = ["config"] 977 long_options = ["config"]
969 for (long_name, short_name) in config.OPTIONS.items(): 978 for (long_name, short_name) in config.OPTIONS.items():
970 short_options += short_name 979 short_options += short_name

Roundup Issue Tracker: http://roundup-tracker.org/