Commit c4902525 by Csók Tamás

client: installation stabilility fix

parent 1e0e7dea
......@@ -50,8 +50,8 @@ def parse_arguments():
help="Remove installed files instead of creating them",
action="store_true", required=False)
parser.add_argument(
"-u", "--url",
help="Whether we installed and we want to use selenium or not",
"-n", "--nx",
help="Whether we want to install the NX Client or not",
action="store_true", required=False)
parser.add_argument(
"-t", "--target",
......@@ -110,8 +110,8 @@ def main():
os.remove("%s%s" % (location, ".url"))
print "%s%s file successfully removed" % (location, ".url")
for subdir, dirs, files in os.walk(args.location):
for file in files:
path = os.path.join(subdir, file)
for current_file in files:
path = os.path.join(subdir, current_file)
fileName, fileExtension = os.path.splitext(path)
if ((fileExtension == '.pyc' or
fileExtension == '.lnk' or
......@@ -122,12 +122,36 @@ def main():
os.remove(path)
print "%s file successfully removed" % path
else:
subprocess.call(
"python %s\\nx_client_installer.py" % os.path.dirname(
os.path.realpath(__file__)))
print "Creating custom URL protocol handlers"
try:
custom_protocol = OrderedDict([
('circle', ["default",
"URL:circle Protocol",
"URL Protocol",
""]),
('circle\\URL Protocol', ""),
('circle\\DefaultIcon', args.location + "cloud.ico"),
('circle\\shell', {'open': {
'command': (
"\"%(prefix)s\pythonw.exe\""
" \"%(location)s"
"cloud.py\" " % {
'prefix': sys.exec_prefix,
'location': args.location
} + r'"%1"')
}})
])
custom_protocol_register(custom_protocol)
except:
print "Error! URL Protocol handler installation aborted!"
if args.nx:
print "Running NX Client install"
subprocess.call(
"python %s\\nx_client_installer.py" % os.path.dirname(
os.path.realpath(__file__)))
if args.url:
location = os.path.join(desktop_path, "CIRCLE Client.url")
shortcut = file(location, 'w')
shortcut = open(location, "w")
shortcut.write('[InternetShortcut]\n')
shortcut.write('URL=' + args.target)
shortcut.close()
......@@ -149,28 +173,6 @@ def main():
persist_file.Save(location, 0)
print "Icon successfully created on desktop"
shutil.copy(location, args.location)
print "Creating custom URL protocol handlers"
try:
custom_protocol = OrderedDict([
('circle', ["default",
"URL:circle Protocol",
"URL Protocol",
""]),
('circle\\URL Protocol', ""),
('circle\\DefaultIcon', args.location + "cloud.ico"),
('circle\\shell', {'open': {
'command': (
"\"%(prefix)s\pythonw.exe\""
" \"%(location)s"
"cloud.py\" " % {
'prefix': sys.exec_prefix,
'location': args.location
} + r'"%1"')
}})
])
custom_protocol_register(custom_protocol)
except:
print "Error! URL Protocol handler installation aborted!"
except:
print "Unknown error occurred! Please contact the developers!"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment