Nova-Client/Solar/Solar (1.7.10)/runtime/getchangedsrc.py
2023-03-19 19:32:58 +00:00

48 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
"""
Created on Mon Oct 3 02:10:23 2011
@author: IxxI
@version: v1.0
"""
import sys
import logging
from optparse import OptionParser
from commands import Commands, CLIENT, SERVER
from mcp import getchangedsrc_side
def main():
parser = OptionParser(version='MCP %s' % Commands.fullversion())
parser.add_option('--client', dest='only_client', action='store_true', help='only process client', default=False)
parser.add_option('--server', dest='only_server', action='store_true', help='only process server', default=False)
parser.add_option('-c', '--config', dest='config', help='additional configuration file')
options, _ = parser.parse_args()
getchangedsrc(options.config, options.only_client, options.only_server)
def getchangedsrc(conffile, only_client, only_server):
try:
commands = Commands(conffile)
# client or server
process_client = True
process_server = True
if only_client and not only_server:
process_server = False
if only_server and not only_client:
process_client = False
if process_client:
getchangedsrc_side(commands, CLIENT)
if process_server:
getchangedsrc_side(commands, SERVER)
except Exception: # pylint: disable-msg=W0703
logging.exception('FATAL ERROR')
sys.exit(1)
if __name__ == '__main__':
main()