Example #1
0
 def _load_eclasses(self):
     """Force an update of the internal view of on disk/remote eclasses."""
     ec = {}
     eclass_len = len(".eclass")
     try:
         files = listdir_files(self.eclassdir)
     except EnvironmentError as e:
         if e.errno not in (errno.ENOENT, errno.ENOTDIR):
             raise
         return ImmutableDict()
     for y in files:
         if not y.endswith(".eclass"):
             continue
         ys = y[:-eclass_len]
         ec[intern(ys)] = LazilyHashedPath(pjoin(self.eclassdir, y),
                                           eclassdir=self.eclassdir)
     return ImmutableDict(ec)
Example #2
0
 def _load_eclasses(self):
     """Force an update of the internal view of on disk/remote eclasses."""
     ec = {}
     eclass_len = len(".eclass")
     try:
         files = listdir_files(self.eclassdir)
     except EnvironmentError as e:
         if e.errno not in (errno.ENOENT, errno.ENOTDIR):
             raise
         return ImmutableDict()
     for y in files:
         if not y.endswith(".eclass"):
             continue
         ys = y[:-eclass_len]
         ec[intern(ys)] = LazilyHashedPath(pjoin(self.eclassdir, y),
                                           eclassdir=self.eclassdir)
     return ImmutableDict(ec)
Example #3
0
    str_size = 1000000000
    chf_type = 'size'

    @staticmethod
    def long2str(val):
        return str(val)

    @staticmethod
    def str2long(val):
        return long(val)

    def __call__(self, file_obj):
        if isinstance(file_obj, base_data_source):
            if file_obj.path is not None:
                file_obj = file_obj.path
            else:
                file_obj = file_obj.get_fileobj()
        if isinstance(file_obj, basestring):
            try:
                st_size = os.lstat(file_obj).st_size
            except OSError:
                return -1
            return st_size
        # seek to the end.
        file_obj.seek(0, 2)
        return long(file_obj.tell())


chksum_types["size"] = SizeChksummer()
chksum_types = dict((intern(k), v) for k, v in chksum_types.iteritems())
Example #4
0
    str_size = 1000000000
    chf_type = 'size'

    @staticmethod
    def long2str(val):
        return str(val)

    @staticmethod
    def str2long(val):
        return long(val)

    def __call__(self, file_obj):
        if isinstance(file_obj, base_data_source):
            if file_obj.path is not None:
                file_obj = file_obj.path
            else:
                file_obj = file_obj.text_fileobj()
        if isinstance(file_obj, basestring):
            try:
                st_size = os.lstat(file_obj).st_size
            except OSError:
                return -1
            return st_size
        # seek to the end.
        file_obj.seek(0, 2)
        return long(file_obj.tell())


chksum_types["size"] = SizeChksummer()
chksum_types = {intern(k): v for k, v in chksum_types.iteritems()}
Example #5
0
    str_size = 1000000000
    chf_type = 'size'

    @staticmethod
    def long2str(val):
        return str(val)

    @staticmethod
    def str2long(val):
        return long(val)

    def __call__(self, file_obj):
        if isinstance(file_obj, base_data_source):
            if file_obj.path is not None:
                file_obj = file_obj.path
            else:
                file_obj = file_obj.text_fileobj()
        if isinstance(file_obj, basestring):
            try:
                st_size = os.lstat(file_obj).st_size
            except OSError:
                return -1
            return st_size
        # seek to the end.
        file_obj.seek(0, 2)
        return long(file_obj.tell())


chksum_types["size"] = SizeChksummer()
chksum_types = dict((intern(k), v) for k, v in chksum_types.iteritems())
Example #6
0
    str_size = 1000000000
    chf_type = 'size'

    @staticmethod
    def long2str(val):
        return str(val)

    @staticmethod
    def str2long(val):
        return long(val)

    def __call__(self, file_obj):
        if isinstance(file_obj, base_data_source):
            if file_obj.path is not None:
                file_obj = file_obj.path
            else:
                file_obj = file_obj.text_fileobj()
        if isinstance(file_obj, basestring):
            try:
                st_size = os.lstat(file_obj).st_size
            except OSError:
                return -1
            return st_size
        # seek to the end.
        file_obj.seek(0, 2)
        return long(file_obj.tell())


chksum_types["size"] = SizeChksummer()
chksum_types = {intern(k): v for k, v in chksum_types.iteritems()}