Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
07f24ea9
authored
Sep 24, 2014
by
Csók Tamás
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client: flake8 correction
parent
c7a5e821
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
18 deletions
+19
-18
src/nsi/installer/cloud_connect_from_windows.py
+8
-8
src/nsi/installer/ez_setup.py
+1
-0
src/nsi/installer/pywin_installer.py
+4
-3
src/nsi/installer/win_install.py
+6
-7
No files found.
src/nsi/installer/cloud_connect_from_windows.py
View file @
07f24ea9
...
@@ -31,10 +31,10 @@ def connect(vm):
...
@@ -31,10 +31,10 @@ def connect(vm):
if
vm
.
protocol
==
"SSH"
:
if
vm
.
protocol
==
"SSH"
:
arguments
=
(
"-ssh -P
%(port)
s -pw
%(password)
s"
arguments
=
(
"-ssh -P
%(port)
s -pw
%(password)
s"
"
%(user)
s@
%(host)
s"
%
{
"
%(user)
s@
%(host)
s"
%
{
'port'
:
vm
.
port
,
'port'
:
vm
.
port
,
'password'
:
vm
.
password
,
'password'
:
vm
.
password
,
'user'
:
vm
.
user
,
'user'
:
vm
.
user
,
'host'
:
vm
.
host
})
'host'
:
vm
.
host
})
directory
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
directory
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
subprocess
.
Popen
(
"
%(path)
s
\\
putty.exe
%(arguments)
s"
%
{
subprocess
.
Popen
(
"
%(path)
s
\\
putty.exe
%(arguments)
s"
%
{
'path'
:
directory
,
'path'
:
directory
,
...
@@ -52,7 +52,7 @@ def connect(vm):
...
@@ -52,7 +52,7 @@ def connect(vm):
break
break
if
not
found
:
if
not
found
:
config_file
=
"
%
s
%
s
%
s"
%
(
os
.
path
.
expanduser
(
"~
\\
.nx
\\
config
\\
"
),
config_file
=
"
%
s
%
s
%
s"
%
(
os
.
path
.
expanduser
(
"~
\\
.nx
\\
config
\\
"
),
str
(
int
(
time
.
time
()
*
1000
)),
".nxs"
)
str
(
int
(
time
.
time
()
*
1000
)),
".nxs"
)
password
=
nxkey
.
NXKeyGen
(
vm
.
password
)
.
getEncrypted
()
password
=
nxkey
.
NXKeyGen
(
vm
.
password
)
.
getEncrypted
()
config
=
NX_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
config
=
NX_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
'HOST'
:
vm
.
host
,
'PORT'
:
vm
.
port
}
'HOST'
:
vm
.
host
,
'PORT'
:
vm
.
port
}
...
@@ -61,7 +61,7 @@ def connect(vm):
...
@@ -61,7 +61,7 @@ def connect(vm):
f
.
close
()
f
.
close
()
subprocess
.
Popen
(
config_file
,
shell
=
True
)
subprocess
.
Popen
(
config_file
,
shell
=
True
)
elif
vm
.
protocol
==
"RDP"
:
elif
vm
.
protocol
==
"RDP"
:
listdir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
*.rdp"
listdir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
*.rdp"
found
=
False
found
=
False
full_address
=
"full address:s:
%
s:
%
s"
%
(
vm
.
host
,
vm
.
port
)
full_address
=
"full address:s:
%
s:
%
s"
%
(
vm
.
host
,
vm
.
port
)
user
=
"username:s:
%
s"
%
vm
.
user
user
=
"username:s:
%
s"
%
vm
.
user
...
@@ -73,8 +73,8 @@ def connect(vm):
...
@@ -73,8 +73,8 @@ def connect(vm):
break
break
if
not
found
:
if
not
found
:
config_file
=
"
%
s
%
s
%
s"
%
((
os
.
path
.
dirname
(
config_file
=
"
%
s
%
s
%
s"
%
((
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
"
),
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
"
),
str
(
int
(
time
.
time
()
*
1000
)),
".rdp"
)
str
(
int
(
time
.
time
()
*
1000
)),
".rdp"
)
password
=
binascii
.
hexlify
(
win32crypt
.
CryptProtectData
(
password
=
binascii
.
hexlify
(
win32crypt
.
CryptProtectData
(
u"
%
s"
%
vm
.
password
,
u'psw'
,
None
,
None
,
None
,
0
))
u"
%
s"
%
vm
.
password
,
u'psw'
,
None
,
None
,
None
,
0
))
config
=
RPD_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
config
=
RPD_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
...
...
src/nsi/installer/ez_setup.py
View file @
07f24ea9
#!/usr/bin/env python
#!/usr/bin/env python
# flake8: noqa
"""Bootstrap setuptools installation
"""Bootstrap setuptools installation
To use setuptools in your package's setup.py, include this
To use setuptools in your package's setup.py, include this
...
...
src/nsi/installer/pywin_installer.py
View file @
07f24ea9
...
@@ -22,7 +22,8 @@ def parse_arguments():
...
@@ -22,7 +22,8 @@ def parse_arguments():
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
parser
.
add_argument
(
"change_architect"
,
type
=
str
,
"change_architect"
,
type
=
str
,
help
=
"Whether the 32 bit Python version is installed on a 64bit system"
,
help
=
(
"Whether the 32 bit Python version"
"is installed on a 64bit system"
),
nargs
=
'?'
,
default
=
False
)
nargs
=
'?'
,
default
=
False
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
...
@@ -46,7 +47,7 @@ def main():
...
@@ -46,7 +47,7 @@ def main():
pywin32_version
=
str
(
219
)
pywin32_version
=
str
(
219
)
if
sys
.
hexversion
<
0x02070000
:
if
sys
.
hexversion
<
0x02070000
:
if
(
windowsclasses
.
DecideArchitecture
.
Is64Windows
()
if
(
windowsclasses
.
DecideArchitecture
.
Is64Windows
()
and
not
args
.
change_architect
):
and
not
args
.
change_architect
):
subprocess
.
Popen
(
subprocess
.
Popen
(
"
%
s
\\
x64
\\
pywin32-
%
s.win-amd64-py2.6.exe"
%
(
"
%
s
\\
x64
\\
pywin32-
%
s.win-amd64-py2.6.exe"
%
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
...
@@ -58,7 +59,7 @@ def main():
...
@@ -58,7 +59,7 @@ def main():
pywin32_version
))
.
wait
()
pywin32_version
))
.
wait
()
elif
sys
.
hexversion
<
0x02080000
:
elif
sys
.
hexversion
<
0x02080000
:
if
(
windowsclasses
.
DecideArchitecture
.
Is64Windows
()
if
(
windowsclasses
.
DecideArchitecture
.
Is64Windows
()
and
not
args
.
change_architect
):
and
not
args
.
change_architect
):
subprocess
.
Popen
(
subprocess
.
Popen
(
"
%
s
\\
x64
\\
pywin32-
%
s.win-amd64-py2.7.exe"
%
(
"
%
s
\\
x64
\\
pywin32-
%
s.win-amd64-py2.7.exe"
%
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
...
...
src/nsi/installer/win_install.py
View file @
07f24ea9
...
@@ -71,7 +71,7 @@ def custom_protocol_register(custom_protocol):
...
@@ -71,7 +71,7 @@ def custom_protocol_register(custom_protocol):
"""
"""
if
not
isinstance
(
custom_protocol
,
OrderedDict
):
if
not
isinstance
(
custom_protocol
,
OrderedDict
):
raise
AttributeError
raise
AttributeError
print
"
\t
"
+
custom_protocol
.
iterkeys
()
.
next
()
print
"
\t
"
+
custom_protocol
.
iterkeys
()
.
next
()
try
:
try
:
custom_arguments
=
windowsclasses
.
Struct
()
custom_arguments
=
windowsclasses
.
Struct
()
custom_arguments
.
registry
=
"HKCR"
custom_arguments
.
registry
=
"HKCR"
...
@@ -115,10 +115,10 @@ def main():
...
@@ -115,10 +115,10 @@ def main():
location
=
os
.
path
.
join
(
desktop_path
,
"CIRCLE Client.url"
)
location
=
os
.
path
.
join
(
desktop_path
,
"CIRCLE Client.url"
)
shortcut
=
file
(
location
,
'w'
)
shortcut
=
file
(
location
,
'w'
)
shortcut
.
write
(
'[InternetShortcut]
\n
'
)
shortcut
.
write
(
'[InternetShortcut]
\n
'
)
shortcut
.
write
(
'URL='
+
args
.
target
)
shortcut
.
write
(
'URL='
+
args
.
target
)
shortcut
.
close
()
shortcut
.
close
()
else
:
else
:
shortcut
.
SetPath
(
args
.
location
+
"cloud.py"
)
shortcut
.
SetPath
(
args
.
location
+
"cloud.py"
)
if
args
.
driver
==
"chrome"
:
if
args
.
driver
==
"chrome"
:
shortcut
.
SetArguments
(
"-d chrome"
)
shortcut
.
SetArguments
(
"-d chrome"
)
elif
args
.
driver
==
"iexplore"
:
elif
args
.
driver
==
"iexplore"
:
...
@@ -126,7 +126,7 @@ def main():
...
@@ -126,7 +126,7 @@ def main():
elif
args
.
driver
==
"opera"
:
elif
args
.
driver
==
"opera"
:
shortcut
.
SetArguments
(
"-d opera"
)
shortcut
.
SetArguments
(
"-d opera"
)
shortcut
.
SetDescription
(
"Tool to use CIRCLE Cloud"
)
shortcut
.
SetDescription
(
"Tool to use CIRCLE Cloud"
)
shortcut
.
SetIconLocation
(
args
.
location
+
"cloud.ico"
,
0
)
shortcut
.
SetIconLocation
(
args
.
location
+
"cloud.ico"
,
0
)
desktop_path
=
shell
.
SHGetFolderPath
(
desktop_path
=
shell
.
SHGetFolderPath
(
0
,
shellcon
.
CSIDL_DESKTOP
,
0
,
0
)
0
,
shellcon
.
CSIDL_DESKTOP
,
0
,
0
)
persist_file
=
shortcut
.
QueryInterface
(
persist_file
=
shortcut
.
QueryInterface
(
...
@@ -143,7 +143,7 @@ def main():
...
@@ -143,7 +143,7 @@ def main():
"URL Protocol"
,
"URL Protocol"
,
""
]),
""
]),
(
'circle
\\
URL Protocol'
,
""
),
(
'circle
\\
URL Protocol'
,
""
),
(
'circle
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'circle
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'circle
\\
shell'
,
{
'open'
:
{
(
'circle
\\
shell'
,
{
'open'
:
{
'command'
:
(
'command'
:
(
"
\"
%(prefix)
s
\
pythonw.exe
\"
"
"
\"
%(prefix)
s
\
pythonw.exe
\"
"
...
@@ -151,8 +151,7 @@ def main():
...
@@ -151,8 +151,7 @@ def main():
"cloud.py
\"
"
%
{
"cloud.py
\"
"
%
{
'prefix'
:
sys
.
exec_prefix
,
'prefix'
:
sys
.
exec_prefix
,
'location'
:
args
.
location
'location'
:
args
.
location
}
}
+
r'"
%1
"'
)
+
r'"
%1
"'
)
}})
}})
])
])
custom_protocol_register
(
custom_protocol
)
custom_protocol_register
(
custom_protocol
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment