def copy_resource(self, resource, targetdir):
        """Copies a resource file and returns the source path for monitoring"""
        final_path = resource.final_path()
        if final_path[0] == '/' or (':' in final_path) or ('?' in final_path):
            # Absolute path or URI: Do nothing
            return

        source_path = self.get_source_path(resource)

        if resource.resource_type == DIRECTORY_RESOURCE:
            for file_path in glob.iglob(os.path.join(source_path, '**'), recursive=True):
                if os.path.isdir(file_path):
                    continue
                rest_target_path = file_path[len(source_path)+1:]
                target_path = os.path.join(targetdir, final_path, rest_target_path)
                # Don't yield the result, we don't monitor these.
                self._copy_file(file_path, target_path)
        else:
            target_path = os.path.join(targetdir, final_path)
            yield self._copy_file(source_path, target_path)
def copy_resource ( self , resource , targetdir ) : final_path = resource . final_path ( ) if final_path [ 0 ] == '/' or ( ':' in final_path ) or ( '?' in final_path ) : return source_path = self . get_source_path ( resource ) if resource . resource_type == DIRECTORY_RESOURCE : for file_path in glob . iglob ( os . path . join ( source_path , '**' ) , recursive = True ) : if os . path . isdir ( file_path ) : continue rest_target_path = file_path [ len ( source_path ) + 1 : ] target_path = os . path . join ( targetdir , final_path , rest_target_path ) self . _copy_file ( file_path , target_path ) else : target_path = os . path . join ( targetdir , final_path ) yield self . _copy_file ( source_path , target_path )
Copies a resource file and returns the source path for monitoring