<s> import argparse <EOL> from biicode . common . utils . decorators import os_constraint <EOL> from biicode . client . dev . hardware . raspberry_pi . rpi_settings_wizard import rpi_settings_wizard , rpi_settings_args <EOL> from biicode . client . dev . hardware . raspberry_pi . raspberrypi import RaspberryPi <EOL> from biicode . common . output_stream import Color <EOL> import os <EOL> from biicode . common . model . blob import Blob <EOL> from biicode . common . utils . file_utils import save_blob_if_modified <EOL> from biicode . common . settings . osinfo import OSInfo <EOL> from biicode . client . setups . rpi_cross_compiler import find_gnu_arm <EOL> class RPiToolChain ( object ) : <EOL> '''<STR_LIT>''' <EOL> group = '<STR_LIT>' <EOL> def __init__ ( self , bii ) : <EOL> self . bii = bii <EOL> self . user_io = bii . user_io <EOL> self . paths = self . bii . bii_paths <EOL> self . hive_disk_image = self . bii . hive_disk_image <EOL> self . rpi = RaspberryPi ( self . user_io , self . paths , self . hive_disk_image ) <EOL> @ os_constraint ( "<STR_LIT>" ) <EOL> def send ( self , * parameters ) : <EOL> '''<STR_LIT>''' <EOL> parser = argparse . ArgumentParser ( description = self . send . __doc__ , <EOL> prog = "<STR_LIT>" % self . group ) <EOL> parser . parse_args ( * parameters ) <EOL> self . rpi . send_sync ( ) <EOL> @ os_constraint ( "<STR_LIT>" ) <EOL> def ssh ( self , * parameters ) : <EOL> '''<STR_LIT>''' <EOL> parser = argparse . ArgumentParser ( description = self . ssh . __doc__ , <EOL> prog = "<STR_LIT>" % self . group ) <EOL> parser . parse_args ( * parameters ) <EOL> self . rpi . ssh ( ) <EOL> def settings ( self , * parameters ) : <EOL> '''<STR_LIT>''' <EOL> parser = argparse . ArgumentParser ( description = self . settings . __doc__ , <EOL> prog = "<STR_LIT>" % self . group ) <EOL> parser . add_argument ( '<STR_LIT>' , help = '<STR_LIT>' ) <EOL> parser . add_argument ( "<STR_LIT>" , help = "<STR_LIT>" ) <EOL> parser . add_argument ( "<STR_LIT>" , help = "<STR_LIT>" ) <EOL> args = parser . parse_args ( * parameters ) <EOL> settings = self . hive_disk_image . settings <EOL> if any ( [ args . user , args . ip , args . directory ] ) : <EOL> rpi_settings_args ( args , settings ) <EOL> else : <EOL> rpi_settings_wizard ( self . user_io , settings ) <EOL> self . hive_disk_image . settings = settings <EOL> self . user_io . out . info ( '<STR_LIT>' % self . paths . settings ) <EOL> toolchain_rpi_path = os . path . join ( self . paths . bii , "<STR_LIT>" ) <EOL> if not os . path . exists ( toolchain_rpi_path ) : <EOL> if OSInfo . is_linux ( ) : <EOL> self . user_io . out . write ( '<STR_LIT>' , Color . BLUE ) <EOL> c_path , cpp_path = find_gnu_arm ( ) <EOL> if not c_path or not cpp_path : <EOL> self . user_io . out . error ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> content = [ ] <EOL> content . append ( "<STR_LIT>" ) <EOL> content . append ( "<STR_LIT>" ) <EOL> content . append ( "<STR_LIT>" ) <EOL> content . append ( "<STR_LIT>" % c_path ) <EOL> content . append ( "<STR_LIT>" % cpp_path ) <EOL> content = os . linesep . join ( content ) <EOL> save_blob_if_modified ( toolchain_rpi_path , Blob ( content ) ) <EOL> self . user_io . out . success ( '<STR_LIT>' ) <EOL> self . user_io . out . success ( '<STR_LIT>' ) <EOL> else : <EOL> self . user_io . out . error ( "<STR_LIT>" ) <EOL> self . user_io . out . error ( "<STR_LIT>" ) </s>
