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
Exemplo n.º 2
0
 def test_different(self):
     f1 = NamedTemporaryFile("wt", delete=False)
     try:
         f1.write("fofo")
         f1.close()
         f2 = NamedTemporaryFile("wt", delete=False)
         try:
             f2.write("fofa")
             f2.close()
             self.assertFalse(same_content(f1.name, f2.name))
         finally:
             os.remove(f2.name)
     finally:
         os.remove(f1.name)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
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 in installed_files:
         installed_files[target] = source
         return False
     else:
         if not same_content(source_path, installed_files[target].abspath()):
             # See top comment: not sure there is any good solution to
             # select which one should be selected when a target has
             # multiple sources
             if source.is_src() and installed_files[target].is_bld():
                 return False
             if source.is_bld() and installed_files[target].is_src():
                 return True
             else:
                 raise IOError("Multiple source_path for same target_path %r ! %s and %s" % \
                               (target_path, source_path, installed_files[target].abspath()))
         else:
             return True