-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathenv.py
More file actions
executable file
·47 lines (30 loc) · 1.19 KB
/
Copy pathenv.py
File metadata and controls
executable file
·47 lines (30 loc) · 1.19 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
#!/usr/bin/python3
import subprocess
with open(".env", 'r') as env_file, open("run_script.sh", 'w') as run_script:
run_script.write('#!/bin/bash\n')
lines = env_file.readlines()
for line in lines:
line = line.strip()
if not line:
continue
try:
if line[0] == '#':
continue
key, value = line.split('=')
key = key.strip()
value = value.strip()
run_script.write(f"export {key}='{value}'\n")
# os.environ[key] = value
# print(f"SET {key} = {value}")
except Exception as e:
print("IT BE YOUR OWN")
# run_script.write("make clean\n")
# run_script.write("make\n")
# run_script.write("./search")
# print("Script run_script.sh created successfully.")
# print("Use ./run_script.sh to run the search engine")
# subprocess.run(["chmod", "+x", "run_script.sh"])
# subprocess.run(["./run_script.sh"])
print("Environment script created successfully.")
print("Use source run_scripy.sh to set the environment variables")
print("Use ./search to run the search engine")