コード例 #1
0
 def _is_redundant(source, target):
     # If this install already installs something @ target, we raise an
     # error unless the content is exactly the same
     if not target in installed_files:
         installed_files[target] = source
         return False
     else:
         if not same_content(source, installed_files[target]):
             raise IOError("Multiple source for same target %r !" % target)
         else:
             return True
コード例 #2
0
 def _is_redundant(source, target):
     source_path = source.abspath()
     target_path = target.abspath()
     # If this install already installs something @ target, we raise an
     # error unless the content is exactly the same
     if not target_path in installed_files:
         installed_files[target_path] = source_path
         return False
     else:
         if not same_content(source_path, installed_files[target_path]):
             raise IOError("Multiple source_path for same target_path %r !" % target_path)
         else:
             return True
コード例 #3
0
ファイル: test_utils.py プロジェクト: aspidites/Bento
 def test_same(self):
     f1 = NamedTemporaryFile("wt", delete=False)
     try:
         f1.write("fofo")
         f1.close()
         f2 = NamedTemporaryFile("wt", delete=False)
         try:
             f2.write("fofo")
             f2.close()
             self.assertTrue(same_content(f1.name, f2.name))
         finally:
             os.remove(f2.name)
     finally:
         os.remove(f1.name)