Ejemplo n.º 1
0
    def identify(self, name: str) -> Identification:
        for root in self._roots:
            path = TargetResolver._is_group(root, name)
            if path is not None:
                return Identification('group', path)

            path = TargetResolver._is_standalone(root, name)
            if path is not None:
                return Identification('package', path)

            path = TargetResolver._is_cmake(root, name)
            if path is not None:
                return Identification('cmake', path)

            if name in self._virtuals:
                return Identification('virtual')

        if name in self._pkg_configs:
            return Identification('pkg_config', None, self._pkg_configs[name])

        raise TargetNotFoundError(name)
Ejemplo n.º 2
0
 def test_equal_ids(self):
     id1 = Identification('a')
     id2 = Identification('a')
     assert(id1 == id2)
Ejemplo n.º 3
0
 def test_compare_ids_with_non_ids(self):
     id1 = Identification('a')
     assert(id1 != 5)
Ejemplo n.º 4
0
 def test_pkg_identification(self):
     r = TargetResolver(self.config)
     assert(Identification('pkg_config', None, 'bar') == r.identify('foo'))
Ejemplo n.º 5
0
 def test_cmake_identification(self):
     r = TargetResolver(self.config)
     assert(Identification('cmake', P('t2')) == r.identify('t2'))
Ejemplo n.º 6
0
 def test_thirdparty_cmake_identification(self):
     r = TargetResolver(self.config)
     assert(Identification('cmake', P('r')/'thirdparty'/'t1') == \
                                                           r.identify('t1'))
Ejemplo n.º 7
0
 def test_adapter_identification(self):
     r = TargetResolver(self.config)
     assert(Identification('package', P('r')/'adapters'/'p1') == \
                                                           r.identify('p1'))
Ejemplo n.º 8
0
 def test_group_identification(self):
     r = TargetResolver(self.config)
     assert(Identification('group', P('r')/'groups'/'gr1') == \
                                                          r.identify('gr1'))
Ejemplo n.º 9
0
 def test_custom_standalone_identification(self):
     r = TargetResolver(self.config)
     assert(Identification('package', P('r')/'adapters'/'p4') == \
                                                           r.identify('p4'))
Ejemplo n.º 10
0
 def test_standalone_identification(self):
     r = TargetResolver(self.config)
     assert(Identification('package', P('r')/'standalones'/'p1') == \
                                                           r.identify('p1'))
Ejemplo n.º 11
0
 def test_application_identification(self):
     r = TargetResolver(self.config)
     assert(Identification('application', P('r')/'applications'/'app1') == \
                                                         r.identify('app1'))