Skip to content

Commit 2c58109

Browse files
author
Jared Manning
committed
Tidy up comments and syntax
1 parent 7365266 commit 2c58109

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

env_check.py

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
# Script Name : env_check.py
2-
# Author : Craig Richards
3-
# Created : 14th May 2012
4-
# Last Modified :
5-
# Version : 1.0
1+
# Script Name : env_check.py
2+
# Author : Craig Richards
3+
# Created : 14th May 2012
4+
# Last Modified : 14 February 2016
5+
# Version : 1.0.1
66

7-
# Modifications :
7+
# Modifications : 1.0.1 - Tidy up comments and syntax
88

9-
# Description : This script will check to see if all of the environment variables I require are set
9+
# Description : This script will check to see if all of the environment variables I require are set
1010

1111
import os
1212

13-
confdir = os.getenv("my_config") # Set the variable confdir from the OS environment variable
14-
conffile = 'env_check.conf' # Set the variable conffile
15-
conffilename=os.path.join(confdir, conffile) # Set the variable conffilename by joining confdir and conffile together
13+
confdir = os.getenv("my_config") # Set the variable confdir from the OS environment variable
14+
conffile = 'env_check.conf' # Set the variable conffile
15+
conffilename = os.path.join(confdir, conffile) # Set the variable conffilename by joining confdir and conffile together
1616

17-
for env_check in open(conffilename): # Open the config file and read all the settings
18-
env_check = env_check.strip() # Set the variable as itsself, but strip the extra text out
19-
print '[{}]'.format(env_check) # Format the Output to be in Square Brackets
20-
newenv = os.getenv(env_check) # Set the variable newenv to get the settings from the OS what is currently set for the settings out the configfile
21-
if newenv is None: # If it doesn't exist
22-
print env_check, 'is not set' # Print it is not set
23-
else: # Else if it does exist
17+
for env_check in open(conffilename): # Open the config file and read all the settings
18+
env_check = env_check.strip() # Set the variable as itsself, but strip the extra text out
19+
print '[{}]'.format(env_check) # Format the Output to be in Square Brackets
20+
newenv = os.getenv(env_check) # Set the variable newenv to get the settings from the OS what is currently set for the settings out the configfile
21+
22+
if newenv is None: # If it doesn't exist
23+
print env_check, 'is not set' # Print it is not set
24+
else: # Else if it does exist
2425
print 'Current Setting for {}={}\n'.format(env_check, newenv) # Print out the details

0 commit comments

Comments
 (0)