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,24 +29,31 @@ 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
- else :
39
- raise EnvironmentError ("Unsupported OS" )
40
-
41
- full_binary_path = os .path .join (target_path , binary_name )
42
-
43
- if not os .path .exists (full_binary_path ):
44
-
47
+ elif os_name == 'darwin' :
48
+ zip_name = f"osx-{ arch } -{ __version__ } .tar.gz"
49
+ binary_name = 'osx-x64/redlines'
45
50
zip_path = os .path .join (binaries_path , zip_name )
51
+ if not os .path .exists (zip_path ):
52
+ with tarfile .open (zip_path , 'r:gz' ) as tar_ref :
53
+ tar_ref .extractall (target_path )
46
54
47
- with zipfile . ZipFile ( zip_path , 'r' ) as zip_ref :
48
- zip_ref . extractall ( target_path )
55
+ else :
56
+ raise EnvironmentError ( "Unsupported OS" )
49
57
50
58
return os .path .join (target_path , binary_name )
51
59
0 commit comments