コード例 #1
0
ファイル: directories.py プロジェクト: ntrrgc/blockwart
 def get_auto_deps(self, items):
     deps = []
     for item in items:
         if item == self:
             continue
         if (
             (
                 item.ITEM_TYPE_NAME == "file" and
                 is_subdirectory(item.name, self.name)
             )
             or
             (
                 item.ITEM_TYPE_NAME in ("file", "symlink") and
                 item.name == self.name
             )
         ):
             raise BundleError(_(
                 "{item1} (from bundle '{bundle1}') blocking path to "
                 "{item2} (from bundle '{bundle2}')"
             ).format(
                 item1=item.id,
                 bundle1=item.bundle.name,
                 item2=self.id,
                 bundle2=self.bundle.name,
             ))
         elif item.ITEM_TYPE_NAME in ("directory", "symlink"):
             if is_subdirectory(item.name, self.name):
                 deps.append(item.id)
     return deps
コード例 #2
0
ファイル: text_tests.py プロジェクト: ntrrgc/blockwart
 def test_simple_subdir(self):
     self.assertTrue(text.is_subdirectory("/foo/bar", "/foo/bar/baz"))
コード例 #3
0
ファイル: text_tests.py プロジェクト: ntrrgc/blockwart
 def test_relative(self):
     with self.assertRaises(ValueError):
         text.is_subdirectory("/foo", "bar")
コード例 #4
0
ファイル: text_tests.py プロジェクト: ntrrgc/blockwart
 def test_slash(self):
     self.assertFalse(text.is_subdirectory("/foo", "/foo\/bar"))
コード例 #5
0
ファイル: text_tests.py プロジェクト: ntrrgc/blockwart
 def test_identical(self):
     self.assertFalse(text.is_subdirectory("/foo", "/foo"))
コード例 #6
0
ファイル: text_tests.py プロジェクト: ntrrgc/blockwart
 def test_root(self):
     self.assertTrue(text.is_subdirectory("/", "/foo"))
コード例 #7
0
ファイル: text_tests.py プロジェクト: ntrrgc/blockwart
 def test_simple_substr(self):
     self.assertFalse(text.is_subdirectory("/foo/bar", "/foo/barbaz"))