Skip to content

Commit 7c417a8

Browse files
committed
Update _get_parent_directory #57
* If an existing resource is equa lto Codebase.CACHED_RESOURCE, then create that Resource Signed-off-by: Jono Yang <[email protected]>
1 parent 2e64acf commit 7c417a8

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/commoncode/resource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2036,7 +2036,7 @@ def _get_parent_directory(self, path_segments):
20362036
for segment in path_segments:
20372037
path = posixpath_join(current.path, segment)
20382038
existing = resources_by_path.get(path)
2039-
if not existing:
2039+
if not existing or existing == Codebase.CACHED_RESOURCE:
20402040
existing = self._get_or_create_resource(
20412041
name=segment,
20422042
# build the path based on parent

tests/test_resource.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,18 +1455,8 @@ def test_VirtualCodebase_can_be_created_with_repeated_root_directory(self):
14551455
paths = [
14561456
'to',
14571457
'to/to',
1458-
'to/to/com.liferay.portal.tika-1.0.22.jar',
1459-
'to/to/com.liferay.portal.tika-1.0.22.jar-extract',
1460-
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22',
1461-
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com',
1462-
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay',
1463-
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay/portal',
1464-
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay/portal/tika',
1465-
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay/portal/tika/internal',
1466-
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay/portal/tika/internal/activator',
1467-
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay/portal/tika/internal/activator/TikaBundleActivator.class',
1468-
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/META-INF',
1469-
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/META-INF/MANIFEST.MF',
1458+
'to/to/to',
1459+
'to/to/to/to',
14701460
]
14711461
resources = [{'path': path} for path in paths]
14721462
vc = VirtualCodebase(location={'files': resources})

0 commit comments

Comments
 (0)