|
22 | 22 | _OS_TO_CLI_DIST_TEMPLATE = { |
23 | 23 | 'darwin': Template('cycode-mac$suffix$ext'), |
24 | 24 | 'linux': Template('cycode-linux$suffix$ext'), |
25 | | - 'windows': Template('cycode-win$suffix.exe$ext'), |
| 25 | + 'windows': Template('cycode-win$suffix$ext'), |
26 | 26 | } |
27 | 27 | _WINDOWS = 'windows' |
28 | 28 | _WINDOWS_EXECUTABLE_SUFFIX = '.exe' |
@@ -87,8 +87,7 @@ def get_cli_file_name(suffix: str = '', ext: str = '') -> str: |
87 | 87 | if os_name not in _OS_TO_CLI_DIST_TEMPLATE: |
88 | 88 | raise Exception(f'Unsupported OS: {os_name}') |
89 | 89 |
|
90 | | - template = _OS_TO_CLI_DIST_TEMPLATE[os_name] |
91 | | - return template.substitute(suffix=suffix, ext=ext) |
| 90 | + return _OS_TO_CLI_DIST_TEMPLATE[os_name].substitute(suffix=suffix, ext=ext) |
92 | 91 |
|
93 | 92 |
|
94 | 93 | def get_cli_file_suffix(is_onedir: bool) -> str: |
@@ -117,23 +116,25 @@ def write_hashes_db_to_file(hashes: DirHashes, output_path: str) -> None: |
117 | 116 |
|
118 | 117 |
|
119 | 118 | def get_cli_filename(is_onedir: bool) -> str: |
120 | | - return get_cli_file_name(get_cli_file_suffix(is_onedir)) |
| 119 | + # onedir is distributed as an archive of a directory, so only onefile carries .exe |
| 120 | + ext = _WINDOWS_EXECUTABLE_SUFFIX if get_os_name() == _WINDOWS and not is_onedir else '' |
| 121 | + return get_cli_file_name(suffix=get_cli_file_suffix(is_onedir), ext=ext) |
121 | 122 |
|
122 | 123 |
|
123 | 124 | def get_cli_path(output_path: Path, is_onedir: bool) -> str: |
124 | 125 | return os.path.join(output_path, get_cli_filename(is_onedir)) |
125 | 126 |
|
126 | 127 |
|
127 | 128 | def get_cli_hash_filename(is_onedir: bool) -> str: |
128 | | - return get_cli_file_name(suffix=get_cli_file_suffix(is_onedir), ext=_HASH_FILE_EXT) |
| 129 | + return get_cli_filename(is_onedir) + _HASH_FILE_EXT |
129 | 130 |
|
130 | 131 |
|
131 | 132 | def get_cli_hash_path(output_path: Path, is_onedir: bool) -> str: |
132 | 133 | return os.path.join(output_path, get_cli_hash_filename(is_onedir)) |
133 | 134 |
|
134 | 135 |
|
135 | 136 | def get_cli_archive_filename(is_onedir: bool) -> str: |
136 | | - return get_cli_file_name(suffix=get_cli_file_suffix(is_onedir)) |
| 137 | + return get_cli_filename(is_onedir) |
137 | 138 |
|
138 | 139 |
|
139 | 140 | def get_cli_archive_path(output_path: Path, is_onedir: bool) -> str: |
|
0 commit comments