Esempio n. 1
0
 async def create_universal_file(self, output, inputlist, dirs):
     tmp_inputs = []
     # relocate all files with the prefix of the merged file.
     # which must be done before merging them.
     for f in inputlist:
         # keep the filename in the suffix to preserve the filename extension
         tmp = tempfile.NamedTemporaryFile(suffix=os.path.basename(f))
         tmp_inputs.append(tmp)
         shutil.copy(f, tmp.name)
         prefix_to_replace = [d for d in dirs if d in f][0]
         relocator = OSXRelocator(self.output_root,
                                  prefix_to_replace,
                                  False,
                                  logfile=self.logfile)
         # since we are using a temporary file, we must force the library id
         # name to real one and not based on the filename
         relocator.relocate_file(tmp.name)
         relocator.change_id(tmp.name,
                             id=f.replace(prefix_to_replace,
                                          self.output_root))
     cmd = [self.LIPO_CMD, '-create'] + [f.name for f in tmp_inputs
                                         ] + ['-output', output]
     shell.new_call(cmd)
     for tmp in tmp_inputs:
         tmp.close()
Esempio n. 2
0
 def relocate_osx_libraries(self):
     '''
     Make OSX libraries relocatable
     '''
     relocator = OSXRelocator(self.config.prefix, self.config.prefix, True)
     for f in self.files_list():
         if f.split('/')[0] in ['lib', 'bin', 'libexec']:
             relocator.relocate_file(os.path.join(self.config.prefix, f))
Esempio n. 3
0
    def relocate_osx_libraries(self):
        '''
        Make OSX libraries relocatable
        '''
        relocator = OSXRelocator(self.config.prefix, self.config.prefix, True)
        def get_real_path(fp):
            return os.path.realpath(os.path.join(self.config.prefix, fp))

        def file_is_relocatable(fp):
            return fp.split('/')[0] in ['lib', 'bin', 'libexec'] and \
                    os.path.splitext(fp)[1] not in ['.a', '.pc', '.la']

        # Only relocate files are that are potentially relocatable and
        # remove duplicates by symbolic links so we relocate libs only
        # once.
        for f in set([get_real_path(x) for x in self.files_list() \
                if file_is_relocatable(x)]):
            relocator.relocate_file(f)
 def create_universal_file(self, output, inputlist, dirs):
     tmp_inputs = []
     # relocate all files with the prefix of the merged file.
     # which must be done before merging them.
     for f in inputlist:
         # keep the filename in the suffix to preserve the filename extension
         tmp = tempfile.NamedTemporaryFile(suffix=os.path.basename(f))
         tmp_inputs.append(tmp)
         shutil.copy(f, tmp.name)
         prefix_to_replace = [d for d in dirs if d in f][0]
         relocator = OSXRelocator (self.output_root, prefix_to_replace, self.output_root,
                                   False)
         # since we are using a temporary file, we must force the library id
         # name to real one and not based on the filename
         relocator.relocate_file(tmp.name,
                 id=f.replace(prefix_to_replace, self.output_root))
     cmd = '%s -create %s -output %s' % (self.LIPO_CMD,
         ' '.join([f.name for f in tmp_inputs]), output)
     self._call(cmd)
 def create_universal_file(self, output, inputlist, dirs):
     tmp_inputs = []
     # relocate all files with the prefix of the merged file.
     # which must be done before merging them.
     for f in inputlist:
         # keep the filename in the suffix to preserve the filename extension
         tmp = tempfile.NamedTemporaryFile(suffix=os.path.basename(f))
         tmp_inputs.append(tmp)
         shutil.copy(f, tmp.name)
         prefix_to_replace = [d for d in dirs if d in f][0]
         relocator = OSXRelocator (self.output_root, prefix_to_replace, self.output_root,
                                   False)
         # since we are using a temporary file, we must force the library id
         # name to real one and not based on the filename
         relocator.relocate_file(tmp.name,
                 id=f.replace(prefix_to_replace, self.output_root))
     cmd = '%s -create %s -output %s' % (self.LIPO_CMD,
         ' '.join([f.name for f in tmp_inputs]), output)
     self._call(cmd)