-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
69 lines (61 loc) · 2.43 KB
/
Copy pathsetup.py
File metadata and controls
69 lines (61 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import os
from shutil import copyfile
class Setup():
def __init__(self, username):
self.dir_path = os.path.dirname(os.path.realpath(__file__))
self.user_path = os.path.join('/Users', username)
def add_proxy(self):
http_proxy = raw_input('Enter your http_proxy: \n')
https_proxy = raw_input('Enter your https_proxy: \n')
z_extra_path = os.path.join(self.user_path, '.zextra')
bash_extra_path = os.path.join(self.user_path, '.extra')
with open(z_extra_path, "a") as A, open(bash_extra_path, "a") as B:
A.write('export ' + http_proxy)
A.write("\n")
A.write('export ' + https_proxy)
A.close()
B.write('export ' + http_proxy)
B.write("\n")
B.write('export ' + https_proxy)
B.close()
def setup_zsh(self):
z_path = os.path.join(self.dir_path, 'zsh')
prezto_path = os.path.join(self.user_path, '.zprezto/runcoms')
prezto_theme_path = os.path.join(self.user_path, '.zprezto/modules/prompt/functions')
for item in os.listdir(z_path):
if item.startswith('.'):
os.symlink(
os.path.join(
z_path, item), os.path.join(
self.user_path, item))
else:
if item != "aaron.zsh-theme" and item.startswith("prompt"):
copyfile(
os.path.join(
z_path, item), os.path.join(
prezto_theme_path, item))
else:
if item != "aaron.zsh-theme" :
copyfile(
os.path.join(
z_path, item), os.path.join(
prezto_path, item))
def setup_bash(self):
b_path = os.path.join(self.dir_path, 'bash')
for item in os.listdir(b_path):
os.symlink(
os.path.join(
b_path, item), os.path.join(
self.user_path, item))
def setup_vim(self):
v_path = os.path.join(self.dir_path, 'vim')
for item in os.listdir(v_path):
os.symlink(
os.path.join(
v_path, item), os.path.join(
self.user_path, item))
S = Setup(raw_input('Enter your username '))
S.add_proxy()
S.setup_zsh()
S.setup_bash()
S.setup_vim()