|
16 | 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17 | 17 | # See the License for the specific language governing permissions and
|
18 | 18 | # limitations under the License.
|
19 |
| - |
20 |
| - |
| 19 | + |
21 | 20 | import os
|
22 | 21 |
|
23 | 22 | #This method will install and test the dependencies
|
24 | 23 | 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 ) |
31 | 25 |
|
32 | 26 | 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....." |
42 | 28 | print ""
|
43 | 29 |
|
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 |
47 | 32 |
|
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/" ) |
55 | 34 |
|
56 |
| - #Testing whether CherryPy was installed correctly |
57 | 35 | version = os.system( 'python -c "import cherrypy;print cherrypy.__version__"' )
|
58 | 36 | if ( version != 0 ):
|
| 37 | + os.system( "python setup.py install" ) |
| 38 | + |
59 | 39 | print ""
|
60 |
| - print "ERROR......INSTALLATION OF CherryPy HAS FAILED" |
| 40 | + print "CherryPy installation complete" |
61 | 41 | 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" ) |
63 | 58 |
|
64 | 59 | version = os.system( 'python -c "import serial;print serial.Serial()"' )
|
65 | 60 | 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: |
66 | 74 | print ""
|
67 |
| - print "ERROR......INSTALLATION OF PySerial HAS FAILED" |
| 75 | + print "PySerial already installed.....moving on to next installation" |
68 | 76 | print ""
|
69 |
| - exit() |
| 77 | + |
| 78 | + #------------------------------------------------------------------------------------ |
| 79 | + #Installing ws4py and testing to see if the installation was successful |
| 80 | + |
| 81 | + os.chdir( "../ws4py" ) |
70 | 82 |
|
71 | 83 | version = os.system( 'python -c "import ws4py;print ws4py.__version__"' )
|
72 | 84 | if ( version != 0 ):
|
| 85 | + os.system( "python setup.py install" ) |
| 86 | + |
73 | 87 | print ""
|
74 |
| - print "ERROR......INSTALLATION OF ws4py HAS FAILED" |
| 88 | + print "ws4py installation complete" |
75 | 89 | print ""
|
76 |
| - exit() |
77 | 90 |
|
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 | + |
79 | 105 | print "Installation was successful....."
|
80 | 106 | print ""
|
81 | 107 |
|
|
0 commit comments