10
10
from os import listdir
11
11
from distutils .dir_util import copy_tree
12
12
from shutil import rmtree
13
- from subprocess import Popen
14
13
15
14
16
15
class Installation :
16
+
17
17
def __init__ (self , languages : tuple ):
18
18
self ._install_path = getenv ('LOCALAPPDATA' )
19
19
self ._apertium_path = join (self ._install_path , 'apertium-all-dev' )
@@ -30,7 +30,8 @@ def __init__(self, languages: tuple):
30
30
31
31
self ._languages = languages
32
32
33
- def _download_zip (self , download_files : dict , download_dir , extract_path ):
33
+ @staticmethod
34
+ def _download_zip (download_files : dict , download_dir , extract_path ):
34
35
35
36
for zip_name , zip_link in download_files .items ():
36
37
zip_download_path = join (download_dir , zip_name )
@@ -92,7 +93,7 @@ def mode_editor(self):
92
93
"""
93
94
94
95
# List of Mode Files
95
- mode_path = join (self ._apertium_path , 'share' , 'apertium' , 'modes' )
96
+ mode_path = join (self ._apertium_path , 'share' , 'apertium' , 'modes' )
96
97
only_files = [f for f in listdir (mode_path ) if isfile (join (mode_path , f )) and
97
98
'mode' in f ]
98
99
@@ -121,22 +122,6 @@ def mode_editor(self):
121
122
outfile .close ()
122
123
print (f"Closing { file } " )
123
124
124
- def add_to_system_path (self ):
125
- """Set System Variable: Path, using SETX
126
- SETX is preferred over SET as
127
- SETX modifies the value permanently, whereas
128
- SET modifies the current shell's environment values,
129
- but it is temporary"""
130
-
131
- curr_path_value = getenv ('PATH' )
132
- if 'apertium' in curr_path_value :
133
- print ('Apertium path already exists in System Variable' )
134
- print ('No changes done to System Variable' )
135
- else :
136
- apertium_bin_path = join (self ._apertium_path , 'bin' )
137
- Popen (['SETX' , 'path' , rf'{ curr_path_value } \{ apertium_bin_path } ;' ])
138
- print ('Added path to System Variable' )
139
-
140
125
141
126
def main ():
142
127
@@ -146,7 +131,7 @@ def main():
146
131
p .download_apertium_windows ()
147
132
p .download_language_data ()
148
133
p .mode_editor ()
149
- p . add_to_system_path ()
134
+
150
135
151
136
if __name__ == '__main__' :
152
137
if system () == 'Windows' :
0 commit comments