Skip to content

Commit 50365a2

Browse files
authored
Update env-extra.py
1 parent e4d992b commit 50365a2

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

env-extra.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#pylint: disable = I,E,R,W,C,F
22
from os.path import isfile
33
Import("env") # type: ignore
4-
assert isfile(".env")
5-
try:
6-
f = open(".env", "r")
7-
lines = f.readlines()
8-
envs = []
9-
for line in lines:
10-
line.strip()
11-
if line.startswith('#'):
12-
continue
13-
envs.append("-D{}".format(line.strip()))
14-
env.Append(BUILD_FLAGS=envs) # type: ignore
15-
except IOError:
16-
print("File .env not accessible",)
17-
finally:
18-
f.close()
4+
if isfile(".env"):
5+
try:
6+
f = open(".env", "r")
7+
lines = f.readlines()
8+
envs = []
9+
for line in lines:
10+
line.strip()
11+
if line.startswith('#'):
12+
continue
13+
envs.append("-D{}".format(line.strip()))
14+
env.Append(BUILD_FLAGS=envs) # type: ignore
15+
except IOError:
16+
print("File .env not accessible",)
17+
finally:
18+
f.close()

0 commit comments

Comments
 (0)