Beispiel #1
0
 def __init__(self,
              filepaths: List[Union[Path, str]],
              *args,
              depends=None,
              cwd=None,
              **kwargs):
     if depends is None:
         depends = []
     if cwd is None:
         cwd = current_project().build_path
     super().__init__(EventKind.GENERATOR,
                      PathList(cwd, *filepaths),
                      *args,
                      depends=depends,
                      cwd=cwd,
                      **kwargs)
Beispiel #2
0
class PathListTestCase(unittest.TestCase):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.lst = PathList(Path('/tmp'), '1', '2')

    def test_nominal(self):
        self.assertTrue(self.lst.absolute() ==
                        [Path('/tmp/1'), Path('/tmp/2')])
        lst = copy.deepcopy(self.lst)
        lst.append(Path('/usr/lib'))
        print(lst.absolute())
        self.assertTrue(lst.absolute(
        ) == [Path('/tmp/1'), Path('/tmp/2'),
              Path('/usr/lib')])

    def test_update_path_list(self):
        lst = copy.deepcopy(self.lst)
        lst.extend(PathList(Path('/usr'), 'lib'))
        self.assertTrue(lst.absolute(
        ) == [Path('/tmp/1'), Path('/tmp/2'),
              Path('/usr/lib')])
Beispiel #3
0
 def test_update_path_list(self):
     lst = copy.deepcopy(self.lst)
     lst.extend(PathList(Path('/usr'), 'lib'))
     self.assertTrue(lst.absolute(
     ) == [Path('/tmp/1'), Path('/tmp/2'),
           Path('/usr/lib')])
Beispiel #4
0
 def __init__(self, datapath: Path = Path.cwd()):
     self._paths = PathList(datapath)
Beispiel #5
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.lst = PathList(Path('/tmp'), '1', '2')
Beispiel #6
0
 def make_link_dirs_option(self, link_dirs: PathList):
     return [f'/LIBPATH:{d.as_posix()}' for d in link_dirs.absolute()]
Beispiel #7
0
 def make_include_dirs_option(self, include_dirs: PathList):
     return [f'/I{d.as_posix()}' for d in include_dirs.absolute()]
Beispiel #8
0
 def make_link_dirs_option(self, link_dirs: PathList):
     return [f'-L{d}' for d in link_dirs.absolute()]
Beispiel #9
0
 def make_include_dirs_option(self, include_dirs: PathList):
     return [f'-I{d}' for d in include_dirs.absolute()]