(self)
Compile the exam as a directory on the filesystem
Compile the exam as a directory on the filesystem
Compile the exam as a directory on the filesystem
def compileToDir(self):
        """
            Compile the exam as a directory on the filesystem
        """
        if self.options.action == 'clean':
            try:
                shutil.rmtree(self.options.output)
            except OSError:
                pass

        outpath = Path(self.options.output)

        outpath.mkdir(exist_ok=True,parents=True)
        
        for (dst, src) in self.files.items():
            dst = outpath / dst
            dst.parent.mkdir(exist_ok=True,parents=True)
            if isinstance(src, Path):
                if self.options.action=='clean' or not dst.exists() or src.stat().st_mtime > dst.stat().st_mtime:
                    shutil.copyfile(src, dst)
            else:
                shutil.copyfileobj(src, open(dst, 'w', encoding='utf-8'))
        
        print("Exam created in %s" % os.path.relpath(self.options.output))
def compileToDir ( self ) : if self . options . action == 'clean' : try : shutil . rmtree ( self . options . output ) except OSError : pass outpath = Path ( self . options . output ) outpath . mkdir ( exist_ok = True , parents = True ) for ( dst , src ) in self . files . items ( ) : dst = outpath / dst dst . parent . mkdir ( exist_ok = True , parents = True ) if isinstance ( src , Path ) : if self . options . action == 'clean' or not dst . exists ( ) or src . stat ( ) . st_mtime > dst . stat ( ) . st_mtime : shutil . copyfile ( src , dst ) else : shutil . copyfileobj ( src , open ( dst , 'w' , encoding = 'utf-8' ) ) print ( "Exam created in %s" % os . path . relpath ( self . options . output ) )