Skip to content

Commit 4af13a3

Browse files
Updated dependency installer
Made it dynamically install the dependencies ( if a dependency is already installed, the program will not install it )
1 parent 01dec47 commit 4af13a3

File tree

1 file changed

+61
-35
lines changed

1 file changed

+61
-35
lines changed

InstallDependencies.py

+61-35
Original file line numberDiff line numberDiff line change
@@ -16,66 +16,92 @@
1616
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1717
# See the License for the specific language governing permissions and
1818
# limitations under the License.
19-
20-
19+
2120
import os
2221

2322
#This method will install and test the dependencies
2423
def install():
25-
print "Beginning installation....."
26-
print ""
27-
28-
#Installing CherryPy
29-
os.chdir( "dependencies/CherryPy/" )
30-
os.system( "python setup.py install" )
24+
#Installing each dependency that is not already installed ( we do not want duplicates or any errors to occur because of this )
3125

3226
print ""
33-
print "CherryPy installation complete"
34-
print ""
35-
36-
#Installing PySerial
37-
os.chdir( "../pyserial" )
38-
os.system( "python setup.py install" )
39-
40-
print ""
41-
print "PySerial installation complete"
27+
print "Beginning installation....."
4228
print ""
4329

44-
#Installing ws4py
45-
os.chdir( "../ws4py" )
46-
os.system( "python setup.py install" )
30+
#------------------------------------------------------------------------------------
31+
#Installing CherryPy and testing to see if the installation was successful
4732

48-
print ""
49-
print "ws4py installation complete"
50-
print ""
51-
52-
#--------------------------------------------------------------------------------------
53-
54-
#Testing whether installation was successful for each dependency
33+
os.chdir( "dependencies/CherryPy/" )
5534

56-
#Testing whether CherryPy was installed correctly
5735
version = os.system( 'python -c "import cherrypy;print cherrypy.__version__"' )
5836
if ( version != 0 ):
37+
os.system( "python setup.py install" )
38+
5939
print ""
60-
print "ERROR......INSTALLATION OF CherryPy HAS FAILED"
40+
print "CherryPy installation complete"
6141
print ""
62-
exit()
42+
43+
version = os.system( 'python -c "import cherrypy;print cherrypy.__version__"' )
44+
if ( version != 0 ):
45+
print ""
46+
print "ERROR......INSTALLATION OF CherryPy HAS FAILED"
47+
print ""
48+
exit()
49+
else:
50+
print ""
51+
print "CherryPy already installed.....moving on to next installation"
52+
print ""
53+
54+
#------------------------------------------------------------------------------------
55+
#Installing PySerial and testing to see if the installation was successful
56+
57+
os.chdir( "../pyserial" )
6358

6459
version = os.system( 'python -c "import serial;print serial.Serial()"' )
6560
if ( version != 0 ):
61+
os.system( "python setup.py install" )
62+
63+
print ""
64+
print "PySerial installation complete"
65+
print ""
66+
67+
version = os.system( 'python -c "import serial;print serial.Serial()"' )
68+
if ( version != 0 ):
69+
print ""
70+
print "ERROR......INSTALLATION OF PySerial HAS FAILED"
71+
print ""
72+
exit()
73+
else:
6674
print ""
67-
print "ERROR......INSTALLATION OF PySerial HAS FAILED"
75+
print "PySerial already installed.....moving on to next installation"
6876
print ""
69-
exit()
77+
78+
#------------------------------------------------------------------------------------
79+
#Installing ws4py and testing to see if the installation was successful
80+
81+
os.chdir( "../ws4py" )
7082

7183
version = os.system( 'python -c "import ws4py;print ws4py.__version__"' )
7284
if ( version != 0 ):
85+
os.system( "python setup.py install" )
86+
7387
print ""
74-
print "ERROR......INSTALLATION OF ws4py HAS FAILED"
88+
print "ws4py installation complete"
7589
print ""
76-
exit()
7790

78-
print ""
91+
version = os.system( 'python -c "import ws4py;print ws4py.__version__"' )
92+
if ( version != 0 ):
93+
print ""
94+
print "ERROR......INSTALLATION OF ws4py HAS FAILED"
95+
print ""
96+
exit()
97+
else:
98+
print ""
99+
print "ws4py already installed.....moving on to next installation"
100+
print ""
101+
102+
#------------------------------------------------------------------------------------
103+
#If all of the installations were successful, telling user installation was successful
104+
79105
print "Installation was successful....."
80106
print ""
81107

0 commit comments

Comments
 (0)