Skip to content

Commit b680a6f

Browse files
Restore as it does not correctly fix windows error
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
1 parent 10055e8 commit b680a6f

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

src/build_workflow/builder_from_source.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,10 @@
2121

2222
class BuilderFromSource(Builder):
2323
def checkout(self, work_dir: str) -> None:
24-
# TODO: Reduce temp dir randomized dirname char counts or remove this after qualifier
25-
# This is a temporary fix for OSD Core
26-
# Due to path of node installation is longer than 200 chars and cause path not able to be removed
27-
# https://github.com/opensearch-project/OpenSearch-Dashboards/issues/9397#issuecomment-2727641857
28-
# Even 'osd' would not be enough for the proper cleanup so switch to 'o' for now
29-
# https://github.com/opensearch-project/OpenSearch-Dashboards/issues/9397#issuecomment-2731257431
30-
component_name = self.component.name if self.component.name != 'OpenSearch-Dashboards' else 'o'
3124
self.git_repo = GitRepository(
3225
self.component.repository,
3326
self.component.ref,
34-
os.path.join(work_dir, component_name),
27+
os.path.join(work_dir, self.component.name),
3528
self.component.working_directory,
3629
)
3730

src/system/temporary_directory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(self, keep: bool = False, chdir: bool = False) -> None:
4242
self.keep = keep
4343
if current_platform() == "windows":
4444
windows_home_dir = os.path.abspath("C:\\") # Reduce char counts on windows path
45-
self.name = tempfile.mkdtemp(dir=windows_home_dir)
45+
self.name = tempfile.mkdtemp(dir=windows_home_dir, prefix='') # Reduce char counts on windows path
4646
else:
4747
self.name = tempfile.mkdtemp()
4848

tests/tests_system/test_temporary_directory.py

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def test_path_windows(self) -> None:
5858
with TemporaryDirectory() as work_dir:
5959
if current_platform() == "windows":
6060
windows_home_dir = os.path.abspath("C:\\")
61+
self.assertTrue(not str(work_dir.path).startswith("tmp"))
6162
self.assertTrue(str(work_dir.path).startswith(windows_home_dir))
6263
else:
6364
self.assertTrue(str(work_dir.path).startswith(tempfile.gettempdir()))

0 commit comments

Comments
 (0)