@@ -553,128 +553,98 @@ def cleanup_script_files():
553553 shutil .copytree (os .path .join (sourcedir , dir_for_node ), os .path .join (outdir , "src" , dir_for_node ), dirs_exist_ok = True )
554554
555555
556- #copy proper concore.py into /src
557- try :
558- if concoretype == "docker" :
559- with open (CONCOREPATH + "/concoredocker.py" ) as fsource :
560- source_content = fsource .read ()
561- else :
562- with open (CONCOREPATH + "/concore.py" ) as fsource :
563- source_content = fsource .read ()
564- except (FileNotFoundError , IOError ) as e :
565- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
566- quit ()
567- with open (outdir + "/src/concore.py" ,"w" ) as fcopy :
568- fcopy .write (source_content )
569-
570- #copy proper concore.hpp into /src 6/22/21
571- try :
572- if concoretype == "docker" :
573- with open (CONCOREPATH + "/concoredocker.hpp" ) as fsource :
574- source_content = fsource .read ()
575- else :
576- with open (CONCOREPATH + "/concore.hpp" ) as fsource :
577- source_content = fsource .read ()
578- except (FileNotFoundError , IOError ) as e :
579- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
580- quit ()
581- with open (outdir + "/src/concore.hpp" ,"w" ) as fcopy :
582- fcopy .write (source_content )
583-
584- #copy proper concore.v into /src 6/25/21
585- try :
586- if concoretype == "docker" :
587- with open (CONCOREPATH + "/concoredocker.v" ) as fsource :
588- source_content = fsource .read ()
589- else :
590- with open (CONCOREPATH + "/concore.v" ) as fsource :
591- source_content = fsource .read ()
592- except (FileNotFoundError , IOError ) as e :
593- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
594- quit ()
595- with open (outdir + "/src/concore.v" ,"w" ) as fcopy :
596- fcopy .write (source_content )
597-
598- #copy mkcompile into /src 5/27/21
599- try :
600- with open (CONCOREPATH + "/mkcompile" ) as fsource :
601- source_content = fsource .read ()
602- except (FileNotFoundError , IOError ) as e :
603- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
604- quit ()
605- with open (outdir + "/src/mkcompile" ,"w" ) as fcopy :
606- fcopy .write (source_content )
607- os .chmod (outdir + "/src/mkcompile" ,stat .S_IRWXU )
608-
609- #copy concore*.m into /src 4/2/21
610- try : #maxtime in matlab 11/22/21
611- with open (CONCOREPATH + "/concore_default_maxtime.m" ) as fsource :
612- source_content = fsource .read ()
613- except (FileNotFoundError , IOError ) as e :
614- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
615- quit ()
616- with open (outdir + "/src/concore_default_maxtime.m" ,"w" ) as fcopy :
617- fcopy .write (source_content )
618- try :
619- with open (CONCOREPATH + "/concore_unchanged.m" ) as fsource :
620- source_content = fsource .read ()
621- except (FileNotFoundError , IOError ) as e :
622- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
623- quit ()
624- with open (outdir + "/src/concore_unchanged.m" ,"w" ) as fcopy :
625- fcopy .write (source_content )
626- try :
627- with open (CONCOREPATH + "/concore_read.m" ) as fsource :
628- source_content = fsource .read ()
629- except (FileNotFoundError , IOError ) as e :
630- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
631- quit ()
632- with open (outdir + "/src/concore_read.m" ,"w" ) as fcopy :
633- fcopy .write (source_content )
634- try :
635- with open (CONCOREPATH + "/concore_write.m" ) as fsource :
636- source_content = fsource .read ()
637- except (FileNotFoundError , IOError ) as e :
638- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
639- quit ()
640- with open (outdir + "/src/concore_write.m" ,"w" ) as fcopy :
641- fcopy .write (source_content )
642- try : #4/9/21
643- with open (CONCOREPATH + "/concore_initval.m" ) as fsource :
644- source_content = fsource .read ()
645- except (FileNotFoundError , IOError ) as e :
646- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
647- quit ()
648- with open (outdir + "/src/concore_initval.m" ,"w" ) as fcopy :
649- fcopy .write (source_content )
650- try : #11/19/21
651- with open (CONCOREPATH + "/concore_iport.m" ) as fsource :
652- source_content = fsource .read ()
653- except (FileNotFoundError , IOError ) as e :
654- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
655- quit ()
656- with open (outdir + "/src/concore_iport.m" ,"w" ) as fcopy :
657- fcopy .write (source_content )
658- try : #11/19/21
659- with open (CONCOREPATH + "/concore_oport.m" ) as fsource :
660- source_content = fsource .read ()
661- except (FileNotFoundError , IOError ) as e :
662- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
663- quit ()
664- with open (outdir + "/src/concore_oport.m" ,"w" ) as fcopy :
665- fcopy .write (source_content )
666- try : # 4/4/21
667- if concoretype == "docker" :
668- with open (CONCOREPATH + "/import_concoredocker.m" ) as fsource :
669- source_content = fsource .read ()
670- else :
671- with open (CONCOREPATH + "/import_concore.m" ) as fsource :
672- source_content = fsource .read ()
673- except (FileNotFoundError , IOError ) as e :
674- logging .error (f"{ CONCOREPATH } is not correct path to concore: { e } " )
675- quit ()
676- with open (outdir + "/src/import_concore.m" ,"w" ) as fcopy :
677- fcopy .write (source_content )
556+ #determine languages used in the graphml
557+ required_langs = set ()
558+ for node in nodes_dict :
559+ containername , sourcecode = nodes_dict [node ].split (':' )
560+ if len (sourcecode ) != 0 and "." in sourcecode :
561+ langext = sourcecode .split ("." )[- 1 ]
562+ required_langs .add (langext )
563+ logging .info (f"Languages detected in graph: { required_langs } " )
564+
565+ if 'py' in required_langs :
566+ try :
567+ if concoretype == "docker" :
568+ fsource = open (CONCOREPATH + "/concoredocker.py" )
569+ else :
570+ fsource = open (CONCOREPATH + "/concore.py" )
571+ except (FileNotFoundError , IOError ):
572+ print (CONCOREPATH + " is not correct path to concore (missing python files)" )
573+ quit ()
574+ with open (outdir + "/src/concore.py" ,"w" ) as fcopy :
575+ fcopy .write (fsource .read ())
576+ fsource .close ()
577+
578+ if 'cpp' in required_langs :
579+ try :
580+ if concoretype == "docker" :
581+ fsource = open (CONCOREPATH + "/concoredocker.hpp" )
582+ else :
583+ fsource = open (CONCOREPATH + "/concore.hpp" )
584+ except (FileNotFoundError , IOError ):
585+ print (CONCOREPATH + " is not correct path to concore (missing C++ files)" )
586+ quit ()
587+ with open (outdir + "/src/concore.hpp" ,"w" ) as fcopy :
588+ fcopy .write (fsource .read ())
589+ fsource .close ()
590+
591+ if 'v' in required_langs :
592+ try :
593+ if concoretype == "docker" :
594+ fsource = open (CONCOREPATH + "/concoredocker.v" )
595+ else :
596+ fsource = open (CONCOREPATH + "/concore.v" )
597+ except (FileNotFoundError , IOError ):
598+ print (CONCOREPATH + " is not correct path to concore (missing Verilog files)" )
599+ quit ()
600+ with open (outdir + "/src/concore.v" ,"w" ) as fcopy :
601+ fcopy .write (fsource .read ())
602+ fsource .close ()
603+
604+ if 'm' in required_langs :
605+ try :
606+ fsource = open (CONCOREPATH + "/concore_default_maxtime.m" )
607+ with open (outdir + "/src/concore_default_maxtime.m" ,"w" ) as fcopy : fcopy .write (fsource .read ())
608+ fsource .close ()
609+
610+ fsource = open (CONCOREPATH + "/concore_unchanged.m" )
611+ with open (outdir + "/src/concore_unchanged.m" ,"w" ) as fcopy : fcopy .write (fsource .read ())
612+ fsource .close ()
613+
614+ fsource = open (CONCOREPATH + "/concore_read.m" )
615+ with open (outdir + "/src/concore_read.m" ,"w" ) as fcopy : fcopy .write (fsource .read ())
616+ fsource .close ()
617+
618+ fsource = open (CONCOREPATH + "/concore_write.m" )
619+ with open (outdir + "/src/concore_write.m" ,"w" ) as fcopy : fcopy .write (fsource .read ())
620+ fsource .close ()
621+
622+ fsource = open (CONCOREPATH + "/concore_initval.m" )
623+ with open (outdir + "/src/concore_initval.m" ,"w" ) as fcopy : fcopy .write (fsource .read ())
624+ fsource .close ()
625+
626+ fsource = open (CONCOREPATH + "/concore_iport.m" )
627+ with open (outdir + "/src/concore_iport.m" ,"w" ) as fcopy : fcopy .write (fsource .read ())
628+ fsource .close ()
629+
630+ fsource = open (CONCOREPATH + "/concore_oport.m" )
631+ with open (outdir + "/src/concore_oport.m" ,"w" ) as fcopy : fcopy .write (fsource .read ())
632+ fsource .close ()
633+
634+ if concoretype == "docker" :
635+ fsource = open (CONCOREPATH + "/import_concoredocker.m" )
636+ else :
637+ fsource = open (CONCOREPATH + "/import_concore.m" )
638+ with open (outdir + "/src/import_concore.m" ,"w" ) as fcopy : fcopy .write (fsource .read ())
639+ fsource .close ()
640+
641+ fsource = open (CONCOREPATH + "/mkcompile" )
642+ with open (outdir + "/src/mkcompile" ,"w" ) as fcopy : fcopy .write (fsource .read ())
643+ fsource .close ()
644+ os .chmod (outdir + "/src/mkcompile" ,stat .S_IRWXU )
645+ except Exception as e :
646+ print (CONCOREPATH + " is not correct path to concore (missing MATLAB files):" , e )
647+ quit ()
678648
679649# --- Generate iport and oport mappings ---
680650logging .info ("Generating iport/oport mappings..." )
0 commit comments