Beispiel #1
0
  def __init__(self, input, output, namegen):
    self.input = input
    self.output = pathtools.normpath(output) if output else output
    self.steps = []
    self.namegen = namegen

    # "input" can be a list of files or a single file.
    # If we're compiling for a single file, then we use
    # TempNameForInput. If there are multiple files
    # (e.g. linking), then we use TempNameForOutput.
    if isinstance(self.input, str):
      self.use_names_for_input = True
      self.input = pathtools.normpath(self.input) if self.input else self.input
      CheckPathLength(self.input)
    else:
      self.use_names_for_input = False
      self.input = [pathtools.normpath(p) if p else p for p in self.input]
      for path in self.input:
        CheckPathLength(path)
    CheckPathLength(output)
  def __init__(self, input, output, namegen):
    self.input = input
    self.output = pathtools.normpath(output) if output else output
    self.steps = []
    self.namegen = namegen

    # "input" can be a list of files or a single file.
    # If we're compiling for a single file, then we use
    # TempNameForInput. If there are multiple files
    # (e.g. linking), then we use TempNameForOutput.
    if isinstance(self.input, str):
      self.use_names_for_input = True
      self.input = pathtools.normpath(self.input) if self.input else self.input
      CheckPathLength(self.input)
    else:
      self.use_names_for_input = False
      self.input = [pathtools.normpath(p) if p else p for p in self.input]
      for path in self.input:
        CheckPathLength(path)
    CheckPathLength(output)
Beispiel #3
0
 def ValidatePathLength(self, temp, imtype):
   temp = pathtools.normpath(temp) if temp else temp
   # If the temp name is too long, just pick a random one instead.
   if not CheckPathLength(temp, exit_on_failure=False):
     # imtype is sometimes just an extension, and sometimes a compound
     # extension (e.g. pre_opt.pexe). To keep name length shorter,
     # only take the last extension
     if '.' in imtype:
       imtype = imtype[imtype.rfind('.') + 1:]
     temp = pathtools.join(
         self.OutputDir,
         str(random.randrange(100000, 1000000)) + '.' + imtype)
     CheckPathLength(temp)
   return temp
Beispiel #4
0
 def ValidatePathLength(self, temp, imtype):
     temp = pathtools.normpath(temp) if temp else temp
     # If the temp name is too long, just pick a random one instead.
     if not CheckPathLength(temp, exit_on_failure=False):
         # imtype is sometimes just an extension, and sometimes a compound
         # extension (e.g. pre_opt.pexe). To keep name length shorter,
         # only take the last extension
         if '.' in imtype:
             imtype = imtype[imtype.rfind('.') + 1:]
         temp = pathtools.join(
             self.OutputDir,
             str(random.randrange(100000, 1000000)) + '.' + imtype)
         CheckPathLength(temp)
     return temp