From df5e61cf98258f8fe5f940ce80fdc7cd0f7ea222 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 31 Mar 2021 11:47:28 +0200 Subject: [PATCH] Bugfixes for publisher windows support --- src/cpl_cli/publish/publisher_service.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/cpl_cli/publish/publisher_service.py b/src/cpl_cli/publish/publisher_service.py index 8a0c1508..edaa4d75 100644 --- a/src/cpl_cli/publish/publisher_service.py +++ b/src/cpl_cli/publish/publisher_service.py @@ -39,6 +39,10 @@ class PublisherService(PublisherABC): self._included_dirs: list[str] = [] self._distributed_files: list[str] = [] + self._src_path_part = 'src/' + if sys.platform == 'win32': + self._src_path_part = 'src\\' + @property def source_path(self) -> str: return self._source_path @@ -54,8 +58,8 @@ class PublisherService(PublisherABC): :param file: :return: """ - if 'src/' in file: - file = file.replace('src/', '', 1) + if self._src_path_part in file: + file = file.replace(self._src_path_part, '', 1) dirs = os.path.dirname(file).split('/') for d in dirs: @@ -230,8 +234,8 @@ class PublisherService(PublisherABC): for file in self._included_files: dist_file = file - if 'src/' in dist_file: - dist_file = dist_file.replace('src/', '', 1) + if self._src_path_part in dist_file: + dist_file = dist_file.replace(self._src_path_part, '', 1) output_path = os.path.join(build_path, os.path.dirname(dist_file)) output_file = os.path.join(build_path, dist_file) @@ -252,8 +256,8 @@ class PublisherService(PublisherABC): for empty_dir in self._included_dirs: dist_dir = empty_dir - if 'src/' in dist_dir: - dist_dir = dist_dir.replace('src/', '', 1) + if self._src_path_part in dist_dir: + dist_dir = dist_dir.replace(self._src_path_part, '', 1) output_path = os.path.join(build_path, dist_dir) if not os.path.isdir(output_path):