Diff of /trunk/cforge/cforge/Package/CFORGE/Scripts/install.py [r10] .. [r11]  Maximize  Restore

Switch to unified view

a/trunk/cforge/cforge/Package/CFORGE/Scripts/install.py b/trunk/cforge/cforge/Package/CFORGE/Scripts/install.py
1
# imports 
1
# imports 
2
import sys
2
import sys
3
3
import os
4
4
5
from System.Diagnostics import Process
5
from System.Diagnostics import Process
6
from System.Diagnostics import Debugger
7
from System.IO import Path
8
from System.Net import WebClient
6
from System.Net import WebClient
9
7
10
#Debugger.Break()
8
9
11
#
10
12
# This is a cforge command (script file)
11
# This is a cforge command (script file)
13
# this will be run as ironpython script.
12
# this will be run as ironpython script.
14
# the filename of this script is automatically the corresponding cforge command 
13
# the filename of this script is automatically the corresponding cforge command 
15
# with some magic functions you can easily integrate it nicely into cforge tool
14
# with some magic functions you can easily integrate it nicely into cforge tool
16
15
...
...
25
24
26
    return help
25
    return help
27
26
28
27
29
28
30
print("command install running")
29
if len(sys.argv) == 1:
31
print("Arguments: " + str(len(sys.argv)))
30
    print("Oh, there are no arguments. Perhaps you forgot something?")
32
for a in sys.argv:
31
    sys.exit()
33
    print(a)
32
34
33
# download 
35
34
36
# download 
35
workingdir = os.path.dirname(sys.argv[0])
37
36
38
localpath = Path.GetFilename(sys.argv[0])
37
downloaddir = os.path.join(workingdir, "downloads")
38
if not os.path.exists(downloaddir):
39
    os.makedirs(downloaddir)
40
41
url = str(sys.argv[1])
39
url = sys.argv[0]
42
40
 
43
print(url)
44
45
localname = os.path.join(downloaddir, url.split("\\")[-1])
46
print(localname)
47
48
41
web_client = WebClient()
49
web_client = WebClient()
42
web_client.DownloadFile(url, localpath)
50
web_client.DownloadFile(url, localpath)
43
51
44
52
45
# and install local package now:
53
# and install local package now:
...
...
48
56
49
57
50
        
58