예제 #1
0
 def load_module(self):
     if os.path.isdir(self.full_path):
         input_files = InputDirectory(self.full_path)
     elif os.path.isfile(self.full_path):
         input_files = SingleFile(self.full_path)
     module = Module(self, input_files)
     module.process()
     return module
예제 #2
0
    def process(self):
        if self.debug_files:
            print("# Processing module {}".format(self.name))
        # Look for a header / README.md
        for input_file in self.source.read():
            if os.path.isdir(input_file.full_path) and self.allowed_sub_path(
                input_file.full_path
            ):
                # Create a new module to handle the directory
                sub_module = Module(
                    self.project, InputDirectory(input_file.full_path)
                )
                if self.debug_files:
                    print("# Allowed sub-module {}".format(sub_module))
                sub_module.process()
                self.files.extend(sub_module.files)
                continue

            _, ext = os.path.splitext(input_file.full_path)
            if ext in self.include_extensions:
                if self.debug_files:
                    print(
                        "## [{}] processing path {}".format(
                            self.name, input_file.full_path
                        )
                    )
                file_proc = Combiner(self.project, self, input_file)
                file_proc.process()
                self.files.append(file_proc)
            else:
                if self.debug_files:
                    print(
                        "## [{}] ignoring path {}".format(
                            self.name, input_file.full_path
                        )
                    )
        return self
예제 #3
0
 def setUp(self) -> None:
     self.project = Project()
     self.module = Module(self.project, InputDirectory("."))
예제 #4
0
 def setUp(self) -> None:
     self.project = Project(config={"debug": False})
     self.module = Module(self.project, InputDirectory("."))
예제 #5
0
 def __init__(self, full_path):
     InputDirectory.__init__(self, full_path)