Пример #1
0
 def setup(self, pydmt: PyDMT) -> None:
     if os.path.isfile("Makefile"):
         pydmt.add_builder(
             BuilderMake(
                 source="Makefile",
                 target="out/make.stamp",
             ))
Пример #2
0
 def setup(self, pydmt: PyDMT) -> None:
     if not os.path.isfile(SOURCE_FILE):
         return
     builder = BuilderReqs(
         source=SOURCE_FILE,
         target=TARGET_FILE,
     )
     pydmt.add_builder(builder)
Пример #3
0
 def test06Fail(self):
     with tempdir():
         shutil.copy("/etc/passwd", "passwd")
         p = PyDMT()
         b = Fail("passwd", "copy_of_passwd")
         p.add_builder(b)
         stats = p.build_all()
         self.assertEqual(stats.get_builder_ok(), 0)
         self.assertEqual(stats.get_builder_fail(), 1)
         self.assertEqual(stats.get_copy_missing(), 0)
         self.assertEqual(stats.get_nop(), 0)
Пример #4
0
def build():
    add_to_path()

    pylogconf.core.setup()
    p = PyDMT()

    logger = logging.getLogger(LOGGER_NAME)
    logger.setLevel(ConfigLogging.loglevel)

    add_all_features(p)

    stats = p.build_all()
    sys.exit(stats.get_os_error_code())
Пример #5
0
def clean() -> None:
    add_to_path()

    pylogconf.core.setup()
    p = PyDMT()

    logger = logging.getLogger(LOGGER_NAME)
    logger.setLevel(ConfigLogging.loglevel)

    add_all_features(p)

    shutil.rmtree(".pydmt")
    p.clean_all()
Пример #6
0
 def setup(self, pydmt: PyDMT) -> None:
     if not os.path.isdir(self.yaml_folder):
         return
     for root, _, filenames in os.walk(self.yaml_folder):
         for filename in filenames:
             source = os.path.join(root, filename)
             target_base, ext = os.path.splitext(source)
             if ext == ".yaml":
                 target = os.sep.join([self.validation_folder, target_base, source + ".stamp"])
                 builder = BuilderYaml(
                     source=source,
                     target=target,
                 )
                 pydmt.add_builder(builder)
Пример #7
0
 def setup(self, pydmt: PyDMT) -> None:
     if not os.path.isdir(self.templates_folder):
         return
     for root, _, filenames in os.walk(self.templates_folder):
         for filename in filenames:
             source = os.path.join(root, filename)
             target_base, ext = os.path.splitext(source)
             if ext == '.mako':
                 target = os.sep.join(target_base.split(os.sep)[1:])
                 builder = BuilderMako(
                     source=source,
                     target=target,
                     data=self.data,
                     config_files=files_under_folder(self.config_folder,
                                                     suffix=".py"),
                     snipplet_files=files_under_folder(self.snipplet_folder,
                                                       suffix=".mako"),
                 )
                 pydmt.add_builder(builder)
Пример #8
0
 def test05CopyAfterRemove(self):
     with tempdir():
         shutil.copy("/etc/passwd", "passwd")
         p = PyDMT()
         b = Copy("passwd", "copy_of_passwd")
         p.add_builder(b)
         p.build_all()
         os.unlink("copy_of_passwd")
         stats = p.build_all()
         self.assertEqual(stats.get_builder_ok(), 0)
         self.assertEqual(stats.get_builder_fail(), 0)
         self.assertEqual(stats.get_nop(), 0)
         self.assertEqual(stats.get_copy_missing(), 1)
Пример #9
0
 def setup(self, pydmt: PyDMT) -> None:
     if not os.path.isdir(SPHINX_FOLDER):
         return
     pydmt.add_builder(BuilderSphinx())
Пример #10
0
 def get_std_test():
     shutil.copy("/etc/passwd", "passwd")
     p = PyDMT()
     b = Copy("passwd", "copy_of_passwd")
     p.add_builder(b)
     return p.build_all()
Пример #11
0
 def test02ReturnType(self):
     p = PyDMT()
     stats = p.build_all()
     self.assertIsInstance(stats, BuildProcessStats, "must be BuildProcessStats")
Пример #12
0
 def test01NullBuild(self):
     p = PyDMT()
     p.build_all()
Пример #13
0
 def setup(self, pydmt: PyDMT) -> None:
     if os.path.isfile("config/python.py"):
         pydmt.add_builder(BuilderVenv(
             source="config/python.py",
             target="out/python.stamp",
         ))
Пример #14
0
 def setup(self, pydmt: PyDMT) -> None:
     if self.packages is not None:
         pydmt.add_builder(
             BuilderApt(source="config/deps.py",
                        target="out/deps.stamp",
                        packages=self.packages))
Пример #15
0
 def test00CreatePyDMT(self):
     PyDMT()
Пример #16
0
 def setup(self, pydmt: PyDMT) -> None:
     if not os.path.isfile("config/python.py"):
         return
     pydmt.add_builder(BuilderVenvFull())
Пример #17
0
 def setup(self, pydmt: PyDMT) -> None:
     if os.path.isfile("package.json"):
         pydmt.add_builder(Installer(
             source="package.json",
             target="out/npm.stamp",
         ))