3
3
import os
4
4
import platform
5
5
import zipfile
6
+ import tarfile
6
7
from pathlib import Path
7
8
from typing import Union , Tuple , Optional
8
9
@@ -28,25 +29,24 @@ def _unzip_binary(self):
28
29
arch = 'x64' # Assuming x64 architecture
29
30
30
31
if os_name == 'linux' :
31
- zip_name = f"linux-{ arch } -{ __version__ } .zip"
32
- binary_name = 'linux-64/redlines'
32
+ zip_name = f"linux-{ arch } -{ __version__ } .tar.gz"
33
+ binary_name = 'linux-x64/redlines'
34
+ zip_path = os .path .join (binaries_path , zip_name )
35
+ if not os .path .exists (zip_path ):
36
+ with tarfile .open (zip_path , 'r:gz' ) as tar_ref :
37
+ tar_ref .extractall (target_path )
33
38
34
39
elif os_name == 'windows' :
35
40
zip_name = f"win-{ arch } -{ __version__ } .zip"
36
41
binary_name = 'win-x64/redlines.exe'
42
+ zip_path = os .path .join (binaries_path , zip_name )
43
+ if not os .path .exists (zip_path ):
44
+ with zipfile .ZipFile (zip_path , 'r' ) as zip_ref :
45
+ zip_ref .extractall (target_path )
37
46
38
47
else :
39
48
raise EnvironmentError ("Unsupported OS" )
40
49
41
- full_binary_path = os .path .join (target_path , binary_name )
42
-
43
- if not os .path .exists (full_binary_path ):
44
-
45
- zip_path = os .path .join (binaries_path , zip_name )
46
-
47
- with zipfile .ZipFile (zip_path , 'r' ) as zip_ref :
48
- zip_ref .extractall (target_path )
49
-
50
50
return os .path .join (target_path , binary_name )
51
51
52
52
def run_redline (self , author_tag : str , original : Union [bytes , Path ], modified : Union [bytes , Path ]) \
0 commit comments