Commit c4902525 by Csók Tamás

client: installation stabilility fix

parent 1e0e7dea
...@@ -50,8 +50,8 @@ def parse_arguments(): ...@@ -50,8 +50,8 @@ def parse_arguments():
help="Remove installed files instead of creating them", help="Remove installed files instead of creating them",
action="store_true", required=False) action="store_true", required=False)
parser.add_argument( parser.add_argument(
"-u", "--url", "-n", "--nx",
help="Whether we installed and we want to use selenium or not", help="Whether we want to install the NX Client or not",
action="store_true", required=False) action="store_true", required=False)
parser.add_argument( parser.add_argument(
"-t", "--target", "-t", "--target",
...@@ -110,8 +110,8 @@ def main(): ...@@ -110,8 +110,8 @@ def main():
os.remove("%s%s" % (location, ".url")) os.remove("%s%s" % (location, ".url"))
print "%s%s file successfully removed" % (location, ".url") print "%s%s file successfully removed" % (location, ".url")
for subdir, dirs, files in os.walk(args.location): for subdir, dirs, files in os.walk(args.location):
for file in files: for current_file in files:
path = os.path.join(subdir, file) path = os.path.join(subdir, current_file)
fileName, fileExtension = os.path.splitext(path) fileName, fileExtension = os.path.splitext(path)
if ((fileExtension == '.pyc' or if ((fileExtension == '.pyc' or
fileExtension == '.lnk' or fileExtension == '.lnk' or
...@@ -122,12 +122,36 @@ def main(): ...@@ -122,12 +122,36 @@ def main():
os.remove(path) os.remove(path)
print "%s file successfully removed" % path print "%s file successfully removed" % path
else: else:
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( subprocess.call(
"python %s\\nx_client_installer.py" % os.path.dirname( "python %s\\nx_client_installer.py" % os.path.dirname(
os.path.realpath(__file__))) os.path.realpath(__file__)))
if args.url: if args.url:
location = os.path.join(desktop_path, "CIRCLE Client.url") location = os.path.join(desktop_path, "CIRCLE Client.url")
shortcut = file(location, 'w') shortcut = open(location, "w")
shortcut.write('[InternetShortcut]\n') shortcut.write('[InternetShortcut]\n')
shortcut.write('URL=' + args.target) shortcut.write('URL=' + args.target)
shortcut.close() shortcut.close()
...@@ -149,28 +173,6 @@ def main(): ...@@ -149,28 +173,6 @@ def main():
persist_file.Save(location, 0) persist_file.Save(location, 0)
print "Icon successfully created on desktop" print "Icon successfully created on desktop"
shutil.copy(location, args.location) 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: except:
print "Unknown error occurred! Please contact the developers!" 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