def __init__(self): """ Regular init stuff """ self.init_complete = False self.name = "p00_main" self.handlers = [] self.msg_in = Message() self.msg_to_process = Message() self.msg_to_send = Message() self.last_hb = datetime.datetime.now() self.in_msg_loop = True self.main_loop = True self.p00_queue = multiprocessing.Queue(-1) self.work_queue = multiprocessing.Queue(-1) self.log_queue = multiprocessing.Queue(-1) self.close_pending = False self.process_path = os.path.dirname(os.path.abspath(__file__)) self.enable = [ True, True, True, False, False, False, False, False, False, False, False, True, False, True, False, True, True, True ] self.nest_username = str() self.nest_password = str() # Initialize logging worker_configurer(self.log_queue) self.logger = logging.getLogger(__name__) # Spawn individual processes self.create_log_process() self.create_gui_process() self.create_logic_process() self.create_home_process() self.create_screen_process() self.create_wemo_process() self.create_nest_process() self.update_gui() self.init_complete = True
def get_last_version(version_type): try: release_file = parse.urljoin(self.website, "releases.json") user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" headers = { 'User-Agent': user_agent, } url_request = request.Request(release_file, None, headers) hf = request.urlopen(url_request).read() data = json.loads(hf) last_version = data["symfony_versions"][version_type] Message(last_version, "OK").customize() return last_version except Exception as e: Message( "An error occurs with Symfony.upgrade().get_last_version() :: {}" .format(e), "NOK").customize() quit()
def display_update(spaceship, bullet_img, player_pos, bullets, aliens, kill_count): """ displays the background, player, asteroids and other updates :param spaceship: Img of spaceship :param player_pos: Int of player position :param bullets: List of bullets :param aliens: List of aliens :param kill_count: Int of kill count :return: """ #displays the image at that position gameDisplay.blit(space_background, (0, 0)) gameDisplay.blit(spaceship, player_pos) for bullet in bullets: #for every bullet in bullets list x = bullet[0] #seperates the x y = bullet[1] #seperates the y gameDisplay.blit(bullet_img, (x, y)) #displays the image at that position for alien in aliens: #for every alien in aliens list img = alien[0] #seperates the img from list pos = alien[1] #seperates the pos from list x = pos[0] #seperates the x from pos y = pos[1] #seperates the y from pos gameDisplay.blit(img, (x, y)) #displays the image at that position #list of all messages for menu screen score_message = [ Message("Score:", 650, 40, white, 40), Message(kill_count, 750, 40, white, 40) ] for message in score_message: #gets each message in list message.draw(gameDisplay) #draws the message and sends the gameDisplay
def execute(self): print("[{}] Backup of the current version of {}".format( Common().get_time(), config("app.name"))) try: with Connection( self.context.host, self.context.user, connect_kwargs=self.context.connect_kwargs) as conn: with conn.cd(self.path_app): if not exists(conn, self.folder_name): conn.run("mkdir -p {}".format(self.folder_name)) if exists(conn, self.app_name): conn.run( "tar -zcf $(date +'%Y%m%d')_{}.tar.gz {}".format( self.app_name, self.app_name)) conn.run( "mv $(date +'%Y%m%d')_{}.tar.gz backups".format( self.app_name)) conn.run("rm -rf {}".format(self.app_name)) Message("Done", "OK").customize() except Exception as e: Message("An error occurs with Backup().execute() :: {}".format(e), "NOK").customize() quit()
def clean_temporary_file(file): try: os.remove(file) Message("Done", "OK").customize() except Exception as e: Message( "An error occurs with Symfony.clean_temporary_file():: {}". format(e), "NOK").customize()
def push(self, message): try: _message = Message(message) except ValueError: return {'status':3, 'error':'message format error'} _message.add_channel() self._messages.put(_message.raw) return {'status':1, 'channel':_message.raw['channel']}
def update_package_dependencies(context): try: with Connection(context.host, context.user, connect_kwargs=context.connect_kwargs) as conn: with conn.cd(config("path.app")): conn.run("composer install", hide=config("app.debugger", cast=bool)) Message("Done", "OK").customize() except Exception as e: Message( "An error occurs with Symfony.update_package_dependencies():: {}" .format(e), "NOK").customize() quit()
def deploy(ctx): Banner().display() if sys.argv[1] == "development": confirmation = input( "This is a deployment in production. Are you sure that you want to continue [yes/no]: " ).lower() if confirmation == "yes": project = input("Which project do you want to deploy ? ").lower() if project not in config("app.projects"): Message( "The project {} does not seems to be valid".format( project), "NOK").customize() quit() RemoteConnection(ctx).test_connection() Backup(ctx, config("path.app"), config("app.name")).execute() Git(ctx, config("app.repository"), config("path.app"), config("app.debugger")).clone() if project == "symfony": Symfony(ctx).upgrade() quit()
def instructions(): """ instructions handels the title, controls and back button :return: """ #loads in the required images left_click = p.image.load("asserts/instructions/left click.png") space = p.image.load("asserts/instructions/space.png") uldr = p.image.load("asserts/instructions/uldr.png") wasd = p.image.load("asserts/instructions/wasd.png") #sets up the back button and title up back = Button("Back", 300, 420, 150, 100, red, 60) title = Message("Instructions", 400, 60, black, 100) run = True #sets run = true while run: #while true gameDisplay.fill(white) #fills the display with the color white for event in p.event.get(): #collects all events if event.type == p.QUIT: #checks events if quit button has been pressed quit_game() #goes to def function to quit if event.type == p.MOUSEBUTTONDOWN: #checks events if mouse has been pressed pos = p.mouse.get_pos() #gets the current mouse position if back.click( pos ): #sends the mouse position to check if button has been clicked if back.text == "Back": #if button text = back menu_screen() #returns the player to the menu_screen #draws the button and title back.draw(gameDisplay) title.draw(gameDisplay) #displays the image at that position gameDisplay.blit(left_click, (100, 150)) gameDisplay.blit(space, (400, 150)) gameDisplay.blit(uldr, (60, 375)) gameDisplay.blit(wasd, (490, 375)) clock.tick(60) #sets frame rate speed for game p.display.update() #updates display
def clone(self): print("[{}] Cloning the repository {}".format( Common().get_time(), config('app.repository'))) try: with Connection( self.context.host, self.context.user, connect_kwargs=self.context.connect_kwargs) as conn: with conn.cd(self.path_app): conn.run("git clone {} app".format(self.repository), hide=bool(self.debugger)) Message("Done", "OK").customize() except Exception as e: Message("An error occurs with Git().clone() :: {}".format(e), "NOK").customize() quit()
def extract_a_local_version_of_composer_json(): try: with Connection( self.context.host, self.context.user, connect_kwargs=self.context.connect_kwargs) as conn: try: conn.get(config("path.app.composer")) except FileNotFoundError: Message("The composer.json file has not been found", "NOK").customize() quit() Message("Done", "OK").customize() except Exception as e: Message( "An error occurs with Symfony.upgrade().extract_a_local_version_of_composer_json() :: {}" .format(e), "NOK").customize() quit()
def update_composer_with_last_version(context, last_version): def update_composer_file(self, file, version): try: json_composer = open(file) json_object = json.load(json_composer) json_object["require"]["symfony/console"] = version json_object["require"]["symfony/dotenv"] = version json_object["require"][ "symfony/framework-bundle"] = version json_object["require"]["symfony/yaml"] = version json_object["extra"]["symfony"]["require"] = version json_composer = open(file, "w") json.dump(json_object, json_composer, indent=4) json_composer.close() except Exception as e: Message( "An error occurs with Symfony.upgrade().update_composer_file() :: {}" .format(e), "NOK").customize() quit() try: update_composer_file("composer.json", last_version) with Connection(context.host, context.user, connect_kwargs=ctx.connect_kwargs) as conn: conn.put("composer.json", config("path.app")) Message("Done", "OK").customize() except Exception as e: Message( "An error occurs with Symfony.upgrade().upload_composer() :: {}" .format(e), "NOK").customize() quit()
def test_connection(self): print("\n[{}] Connection to the remote machine".format( Common().get_time())) try: with Connection( self.context.host, self.context.user, connect_kwargs=self.context.connect_kwargs) as conn: conn.run("echo test", hide=config("app.debugger", cast=bool)) Message("Connected", "OK").customize() except TimeoutError: Message("Unable to connect to the remote machine", "NOK").customize() quit() except Exception as e: Message( "An error occurs with RemoteConnection.test_connection() :: {}" .format(e)).customize() quit()
def menu_screen(): """ menu screen handels title, start, quit, and instructions :return: """ #list of all buttons for menu screen menu_buttons = [ Button("Play", 140, 280, 150, 100, blue, 60), Button("Quit", 460, 280, 150, 100, red, 60), Button("Instructions", 180, 420, 400, 100, pink, 60) ] #list of all buttons for menu screen menu_messages = [ Message("Space Invaders", (width_display / 2), (height_display * (1 / 4)), white, 100) ] run = True #sets run = true while run: #while true gameDisplay.blit(space_background, (0, 0)) #displays the background at given coordinates for message in menu_messages: #gets each message in list message.draw( gameDisplay) #draws the message and sends the gameDisplay for btn in menu_buttons: #gets each button in list btn.draw(gameDisplay) #draws the button and sends the gameDisplay for event in p.event.get(): #collects all events if event.type == p.QUIT: #checks events if quit button has been pressed quit_game() #goes to def function to quit if event.type == p.MOUSEBUTTONDOWN: #checks events if mouse has been pressed pos = p.mouse.get_pos() #gets the current mouse position for btn in menu_buttons: #gets each button in list if btn.click( pos ): #sends the mouse position to check if button has been clicked if btn.text == "Play": #if button text = play main() #calls main function elif btn.text == "Quit": # if button text = quit quit_game() #goes to def function to quit elif btn.text == "Instructions": #if button text = instructions instructions() #calls instructions function clock.tick(60) #sets frame rate speed for game p.display.update() #updates display
def get_current_version(file): try: json_composer = open(file) json_object = json.load(json_composer) current_version = json_object["require"][ "symfony/framework-bundle"] Message(current_version, "OK").customize() return current_version except Exception as e: print_message( "An error occurs with Symfony.upgrade().get_current_version :: {}" .format(e), "NOK") quit()
def send_heartbeats(self): """ Send periodic heartbeats to child processes so they don't time-out and shutdown """ self.p01_queue.put_nowait( Message(source="00", dest="01", type="001").raw) self.p02_queue.put_nowait( Message(source="00", dest="02", type="001").raw) self.p11_queue.put_nowait( Message(source="00", dest="11", type="001").raw) self.p13_queue.put_nowait( Message(source="00", dest="13", type="001").raw) self.p15_queue.put_nowait( Message(source="00", dest="15", type="001").raw) self.p16_queue.put_nowait( Message(source="00", dest="16", type="001").raw) self.p17_queue.put_nowait( Message(source="00", dest="17", type="001").raw) self.last_hb = datetime.datetime.now()
def update_composer_file(self, file, version): try: json_composer = open(file) json_object = json.load(json_composer) json_object["require"]["symfony/console"] = version json_object["require"]["symfony/dotenv"] = version json_object["require"][ "symfony/framework-bundle"] = version json_object["require"]["symfony/yaml"] = version json_object["extra"]["symfony"]["require"] = version json_composer = open(file, "w") json.dump(json_object, json_composer, indent=4) json_composer.close() except Exception as e: Message( "An error occurs with Symfony.upgrade().update_composer_file() :: {}" .format(e), "NOK").customize() quit()
#!/usr/bin/env python3.5 import time import RPi.GPIO as io from modules import logger from modules.message import Message from modules.counter import Counter message = Message() counter = Counter() io.setmode(io.BCM) door_pin = 23 vibration_pin = 25 io.setup(door_pin, io.IN, pull_up_down=io.PUD_UP) io.setup(vibration_pin, io.IN, pull_up_down=io.PUD_UP) def opened_callback(channel): message.send('door opened') def hit_callback(channel): if counter.incr(): message.send('door hit') io.add_event_detect(door_pin,
def process_in_msg_queue(self): """ Method to cycle through incoming message queue, filtering out heartbeats and mis-directed messages. Messages corrected destined for this process are loaded into the work queue """ self.in_msg_loop = True while self.in_msg_loop is True: try: self.msg_in = Message(raw=self.p00_queue.get_nowait()) except: self.in_msg_loop = False if len(self.msg_in.raw) > 4: if self.msg_in.dest == "00": if self.msg_in.type == "001": self.last_hb = datetime.datetime.now() self.logger.debug("heartbeat received") elif self.msg_in.type == "999": self.logger.info("Kill code received - Shutting down") self.close_pending = True self.in_msg_loop = False else: self.work_queue.put_nowait(self.msg_in.raw) self.logger.debug( "Transfered message [%s] to internal work queue", self.msg_in.raw) # Message forwarding to p01 if self.msg_in.dest == "01": self.p01_queue.put_nowait(self.msg_in.raw) self.logger.debug("Transfered message [%s] to p01 queue", self.msg_in.raw) if self.msg_in.type == "900" or self.msg_in.type == "999": self.work_queue.put_nowait(self.msg_in.raw) self.logger.debug( "Transfered message [%s] to internal work queue", self.msg_in.raw) # Message forwarding to p02 if self.msg_in.dest == "02": self.p02_queue.put_nowait(self.msg_in.raw) self.logger.debug("Transfered message [%s] to p02 queue", self.msg_in.raw) if self.msg_in.type == "900" or self.msg_in.type == "999": self.work_queue.put_nowait(self.msg_in.raw) self.logger.debug( "Transfered message [%s] to internal work queue", self.msg_in.raw) # Message forwarding to p11 elif self.msg_in.dest == "11": self.p11_queue.put_nowait(self.msg_in.raw) self.logger.debug("Transfered message [%s] to p11 queue", self.msg_in.raw) if self.msg_in.type == "900" or self.msg_in.type == "999": self.work_queue.put_nowait(self.msg_in.raw) self.logger.debug( "Transfered message [%s] to internal work queue", self.msg_in.raw) # Message forwarding to p13 elif self.msg_in.dest == "13": self.p13_queue.put_nowait(self.msg_in.raw) self.logger.debug("Transfered message [%s] to p13 queue", self.msg_in.raw) if self.msg_in.type == "900" or self.msg_in.type == "999": self.work_queue.put_nowait(self.msg_in.raw) self.logger.debug( "Transfered message [%s] to internal work queue", self.msg_in.raw) # Message forwarding to p15 elif self.msg_in.dest == "15": self.p15_queue.put_nowait(self.msg_in.raw) self.logger.debug("Transfered message [%s] to p15 queue", self.msg_in.raw) if self.msg_in.type == "900" or self.msg_in.type == "999": self.work_queue.put_nowait(self.msg_in.raw) self.logger.debug( "Transfered message [%s] to internal work queue", self.msg_in.raw) # Message forwarding to p16 elif self.msg_in.dest == "16": self.p16_queue.put_nowait(self.msg_in.raw) self.logger.debug("Transfered message [%s] to p16 queue", self.msg_in.raw) if self.msg_in.type == "900" or self.msg_in.type == "999": self.work_queue.put_nowait(self.msg_in.raw) self.logger.debug( "Transfered message [%s] to internal work queue", self.msg_in.raw) # Message forwarding to p17 elif self.msg_in.dest == "17": self.p17_queue.put_nowait(self.msg_in.raw) self.logger.debug("Transfered message [%s] to p17 queue", self.msg_in.raw) if self.msg_in.type == "900" or self.msg_in.type == "999": self.work_queue.put_nowait(self.msg_in.raw) self.logger.debug( "Transfered message [%s] to internal work queue", self.msg_in.raw) self.msg_in = Message() else: self.msg_in = Message() self.in_msg_loop = False
def process_work_queue(self): """ Method to perform work from the work queue """ try: self.msg_to_process = Message(raw=self.work_queue.get_nowait()) except: pass # If there is a message to process, do so if len(self.msg_to_process.raw) > 4: # Start / Stop p01 process if self.msg_to_process.dest == "01": if self.msg_to_process.type == "900": if self.p01.is_alive() is False: self.create_log_process() elif self.msg_to_process.type == "999": if self.p01.is_alive(): self.p01.join() # Start / Stop p11 process if self.msg_to_process.dest == "11": if self.msg_to_process.type == "900": if self.p11.is_alive() is False: self.create_logic_process() elif self.msg_to_process.type == "999": if self.p11.is_alive(): self.p11.join() # Start / Stop p13 process elif self.msg_to_process.dest == "13": if self.msg_to_process.type == "900": if self.p13.is_alive() is False: self.create_home_process() elif self.msg_to_process.type == "999": if self.p13.is_alive(): self.p13.join() # Start / Stop p15 process elif self.msg_to_process.dest == "15": if self.msg_to_process.type == "900": if self.p15.is_alive() is False: self.create_screen_process() elif self.msg_to_process.type == "999": if self.p15.is_alive(): self.p15.join() # Start / Stop p16 process elif self.msg_to_process.dest == "16": if self.msg_to_process.type == "900": if self.p16.is_alive() is False: self.create_wemo_process() elif self.msg_to_process.type == "999": if self.p16.is_alive(): self.p16.join() # Start / Stop p17 process elif self.msg_to_process.dest == "17": if self.msg_to_process.type == "900": if self.p17.is_alive() is False: self.create_nest_process() elif self.msg_to_process.type == "999": if self.p17.is_alive(): self.p17.join() # Clear msg-to-process string self.msg_to_process = Message() else: pass
def listener_process(in_queue, out_queue, log_queue, debug_logfile, info_logfile): listener_configurer(debug_logfile, info_logfile) logger = logging.getLogger(__name__) close_pending = False msg_in = Message() log_record = None last_log_record = None last_hb = datetime.datetime.now() shutdown_time = None in_msg_loop = bool() # Main process loop logger.info("Main loop started") in_msg_loop = True while in_msg_loop is True: # Check incoming process message queue and pull next message from the stack if present try: msg_in = Message(raw=in_queue.get_nowait()) except: pass if len(msg_in.raw) > 4: logger.debug("Processing message [%s] from incoming message queue", msg_in.raw) # Check if message is destined for this process based on pseudo-process-id if msg_in.dest == "01": # If message is a heartbeat, update heartbeat snapshot if msg_in.type == "001": last_hb = datetime.datetime.now() logger.debug("") # If message is a kill-code, set the close_pending flag so the process can close out gracefully elif msg_in.type == "999": logger.info("Kill code received - Shutting down") shutdown_time = datetime.datetime.now() close_pending = True else: # If message isn't destined for this process, drop it into the queue for the main process so it can re-forward it to the proper recipient. out_queue.put_nowait(msg_in.raw) logger.debug("Redirecting message [%s] back to main", msg_in.raw) pass msg_in = Message() # Check incoming process message queue and pull next message from the stack if present try: log_record = log_queue.get_nowait() except: pass # Get log handler, then pass it the log message from the queue if isinstance(log_record, logging.LogRecord) is True: master_logger = logging.getLogger(log_record.name) master_logger.handle(log_record) log_record = None # Only close down process once incoming message queue is empty if close_pending is True: if shutdown_time is not None: if datetime.datetime.now() > shutdown_time + datetime.timedelta(seconds=5): if in_queue.empty() is True: in_msg_loop = False elif datetime.datetime.now() > last_hb + datetime.timedelta(seconds=30): in_msg_loop = False # Delay before re-running loop time.sleep(0.013) pass logger.info("Shutdown complete")
def update_gui(self): if self.p01.is_alive() != self.p01_alive_mem: if self.p01.is_alive() is True: self.p02_queue.put_nowait( Message(source="01", dest="02", type="002").raw) self.p01_alive_mem = True elif self.p01.is_alive() is False: self.p02_queue.put_nowait( Message(source="01", dest="02", type="003").raw) self.p01_alive_mem = False if self.p11.is_alive() != self.p11_alive_mem: if self.p11.is_alive() is True: self.p02_queue.put_nowait( Message(source="11", dest="02", type="002").raw) self.p11_alive_mem = True elif self.p11.is_alive() is False: self.p02_queue.put_nowait( Message(source="11", dest="02", type="003").raw) self.p11_alive_mem = False if self.p13.is_alive() != self.p13_alive_mem: if self.p13.is_alive() is True: self.p02_queue.put_nowait( Message(source="13", dest="02", type="002").raw) self.p13_alive_mem = True elif self.p13.is_alive() is False: self.p02_queue.put_nowait( Message(source="13", dest="02", type="003").raw) self.p13_alive_mem = False if self.p15.is_alive() != self.p15_alive_mem: if self.p15.is_alive() is True: self.p02_queue.put_nowait( Message(source="15", dest="02", type="002").raw) self.p15_alive_mem = True elif self.p15.is_alive() is False: self.p02_queue.put_nowait( Message(source="15", dest="02", type="003").raw) self.p15_alive_mem = False if self.p16.is_alive() != self.p16_alive_mem: if self.p16.is_alive() is True: self.p02_queue.put_nowait( Message(source="16", dest="02", type="002").raw) self.p16_alive_mem = True elif self.p16.is_alive() is False: self.p02_queue.put_nowait( Message(source="16", dest="02", type="003").raw) self.p16_alive_mem = False if self.p17.is_alive() != self.p17_alive_mem: if self.p17.is_alive() is True: self.p02_queue.put_nowait( Message(source="17", dest="02", type="002").raw) self.p17_alive_mem = True elif self.p17.is_alive() is False: self.p02_queue.put_nowait( Message(source="17", dest="02", type="003").raw) self.p17_alive_mem = False
from modules.message import Message from modules.user import ChatUser import pickle u = ChatUser('eduardo','123') m = Message(sender = u,receiver = 'voce',date = '10/10/2010',text='mensagem massa') senha = b'Sixteen byte key' data_sent = m.get_string(senha) #transferencia data_received = pickle.loads(data_sent) _AES_info,_sender,_receiver,_date = data_received n = Message(_sender,_receiver,_date,AES_info = _AES_info) n.decrypt(senha,u.get_user_publicKey()) print(n.get_text())
def upgrade(self): def extract_a_local_version_of_composer_json(): try: with Connection( self.context.host, self.context.user, connect_kwargs=self.context.connect_kwargs) as conn: try: conn.get(config("path.app.composer")) except FileNotFoundError: Message("The composer.json file has not been found", "NOK").customize() quit() Message("Done", "OK").customize() except Exception as e: Message( "An error occurs with Symfony.upgrade().extract_a_local_version_of_composer_json() :: {}" .format(e), "NOK").customize() quit() def get_current_version(file): try: json_composer = open(file) json_object = json.load(json_composer) current_version = json_object["require"][ "symfony/framework-bundle"] Message(current_version, "OK").customize() return current_version except Exception as e: print_message( "An error occurs with Symfony.upgrade().get_current_version :: {}" .format(e), "NOK") quit() def get_last_version(version_type): try: release_file = parse.urljoin(self.website, "releases.json") user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" headers = { 'User-Agent': user_agent, } url_request = request.Request(release_file, None, headers) hf = request.urlopen(url_request).read() data = json.loads(hf) last_version = data["symfony_versions"][version_type] Message(last_version, "OK").customize() return last_version except Exception as e: Message( "An error occurs with Symfony.upgrade().get_last_version() :: {}" .format(e), "NOK").customize() quit() def update_composer_with_last_version(context, last_version): def update_composer_file(self, file, version): try: json_composer = open(file) json_object = json.load(json_composer) json_object["require"]["symfony/console"] = version json_object["require"]["symfony/dotenv"] = version json_object["require"][ "symfony/framework-bundle"] = version json_object["require"]["symfony/yaml"] = version json_object["extra"]["symfony"]["require"] = version json_composer = open(file, "w") json.dump(json_object, json_composer, indent=4) json_composer.close() except Exception as e: Message( "An error occurs with Symfony.upgrade().update_composer_file() :: {}" .format(e), "NOK").customize() quit() try: update_composer_file("composer.json", last_version) with Connection(context.host, context.user, connect_kwargs=ctx.connect_kwargs) as conn: conn.put("composer.json", config("path.app")) Message("Done", "OK").customize() except Exception as e: Message( "An error occurs with Symfony.upgrade().upload_composer() :: {}" .format(e), "NOK").customize() quit() def update_package_dependencies(context): try: with Connection(context.host, context.user, connect_kwargs=context.connect_kwargs) as conn: with conn.cd(config("path.app")): conn.run("composer install", hide=config("app.debugger", cast=bool)) Message("Done", "OK").customize() except Exception as e: Message( "An error occurs with Symfony.update_package_dependencies():: {}" .format(e), "NOK").customize() quit() def clean_temporary_file(file): try: os.remove(file) Message("Done", "OK").customize() except Exception as e: Message( "An error occurs with Symfony.clean_temporary_file():: {}". format(e), "NOK").customize() try: print("[{}] Scrapping the last version of Symfony".format( Common().get_time())) last_version = get_last_version(self.version_type) print("[{}] Get a local version of composer.json".format( Common().get_time())) extract_a_local_version_of_composer_json() print("[{}] Get the version of symfony used".format( Common().get_time())) current_version = get_current_version("composer.json") print("[{}] Check if the last version of symfony is used".format( Common().get_time())) if last_version[:-2] == current_version[:-2]: Message("Already up-to-date", "OK").customize() else: print( "[{}] Replacing the version of Symfony with the version {}" .format(Common().get_time(), last_version)) update_composer_with_last_version(self.context, last_version) print("[{}] Installation/Update of the packages dependencies". format(Common().get_time())) update_package_dependencies(self.context) print("[{}] Clean the temporary composer.json file".format( Common().get_time())) clean_temporary_file("composer.json") except Exception as e: Message("An error occurs with Symfony.upgrade():: {}".format(e), "NOK").customize() quit()