Example #1
0
    def _create_place(self, context):
        assert self._graph_executor.is_null() # FIXME

        if self.directory:
            raise RuntimeError("can't create duplicate working directory")

        if self.id:
            self.directory = os.path.join(context.packets_directory, self.id)
            os.makedirs(self.directory)

        while not self.id:
            directory = tempfile.mktemp(dir=context.packets_directory, prefix="pck-")
            id = os.path.split(directory)[-1]
            if not (context.Scheduler.GetPacket(id) or os.path.isdir(directory)): # race
                try:
                    os.makedirs(directory)
                except OSError as e:
                    if e.errno == errno.EEXIST:
                        continue
                    raise
                else:
                    self.directory = directory
                    self.id = id

        osspec.set_common_readable(self.directory)
        osspec.set_common_executable(self.directory)
        self._create_links(context)
Example #2
0
 def __init__(self, path, checksum=None, set_rx_flag=False):
     assert os.path.isfile(path)
     if set_rx_flag:
         osspec.set_common_readable(path)
         osspec.set_common_executable(path)
     getattr(super(BinaryFile, self), "__init__")()
     self.path = path
     self.checksum = checksum if checksum else BinaryFile.calcFileChecksum(self.path)
     self.accessTime = time.time()
Example #3
0
 def __init__(self, path, checksum=None, set_rx_flag=False):
     assert os.path.isfile(path)
     if set_rx_flag:
         osspec.set_common_readable(path)
         osspec.set_common_executable(path)
     getattr(super(BinaryFile, self), "__init__")()
     self.path = path
     self.checksum = checksum if checksum else BinaryFile.calcFileChecksum(
         self.path)
     self.accessTime = time.time()