示例#1
0
    def _process_srcs(self, srcs):
        """
        Process sources which could be regular files, directories or
        location references.
        """
        for s in srcs:
            if isinstance(s, tuple):
                src, dst = s
            elif isinstance(s, str):
                src, dst = s, ''
            else:
                console.error_exit('%s: Invalid src %s. src should '
                                   'be either str or tuple.' % (self.fullname, s))

            m = location_re.search(src)
            if m:
                self._add_location_reference(m, dst)
            else:
                self._add_package_source(src, dst)
示例#2
0
    def _process_srcs(self, srcs):
        """
        Process sources which could be regular files, directories or
        location references.
        """
        for s in srcs:
            if isinstance(s, tuple):
                src, dst = s
            elif isinstance(s, str):
                src, dst = s, ''
            else:
                console.error_exit('%s: Invalid src %s. src should '
                                   'be either str or tuple.' % (self.fullname, s))

            m = location_re.search(src)
            if m:
                self._add_location_reference(m, dst)
            else:
                self._add_package_source(src, dst)
示例#3
0
    def _process_resources(self, resources):
        """
        Process resources which could be regular files/directories or
        location references.
        """
        self.data['resources'], self.data['location_resources'] = [], []
        for resource in resources:
            if isinstance(resource, tuple):
                src, dst = resource
            elif isinstance(resource, str):
                src, dst = resource, ''
            else:
                console.error_exit('%s: Invalid resource %s. Resource should '
                                   'be either str or tuple.' % (self.fullname, resource))

            m = location_re.search(src)
            if m:
                key, type = self._add_location_reference_target(m)
                self.data['location_resources'].append((key, type, dst))
            else:
                self.data['resources'].append((src, dst))
示例#4
0
    def _process_test_data(self, testdata):
        """
        Process test data of which the source could be regular file
        or location reference.
        """
        self.data['testdata'], self.data['locations'] = [], []
        for td in testdata:
            if isinstance(td, tuple):
                src, dst = td
            elif isinstance(td, str):
                src, dst = td, ''
            else:
                console.error_exit('%s: Invalid testdata %s. Test data should '
                                   'be either str or tuple.' % (self.fullname, td))

            m = location_re.search(src)
            if m:
                key, type = self._add_location_reference_target(m)
                self.data['locations'].append((key, type, dst))
            else:
                self.data['testdata'].append(td)
示例#5
0
    def _process_resources(self, resources):
        """
        Process resources which could be regular files/directories or
        location references.
        """
        self.data['resources'], self.data['location_resources'] = [], []
        for resource in resources:
            if isinstance(resource, tuple):
                src, dst = resource
            elif isinstance(resource, str):
                src, dst = resource, ''
            else:
                console.error_exit('%s: Invalid resource %s. Resource should '
                                   'be either str or tuple.' % (self.fullname, resource))

            m = location_re.search(src)
            if m:
                key, type = self._add_location_reference_target(m)
                self.data['location_resources'].append((key, type, dst))
            else:
                self.data['resources'].append((src, dst))
示例#6
0
    def _process_test_data(self, testdata):
        """
        Process test data of which the source could be regular file
        or location reference.
        """
        self.data['testdata'], self.data['locations'] = [], []
        for td in testdata:
            if isinstance(td, tuple):
                src, dst = td
            elif isinstance(td, str):
                src, dst = td, ''
            else:
                console.error_exit('%s: Invalid testdata %s. Test data should '
                                   'be either str or tuple.' %
                                   (self.fullname, td))

            m = location_re.search(src)
            if m:
                key, type = self._add_location_reference_target(m)
                self.data['locations'].append((key, type, dst))
            else:
                self.data['testdata'].append(td)