Commit ecfb7753 by Csók Tamás

client: more debianic layout

parent 2a687b20
[Desktop Entry] [Desktop Entry]
Encoding=UTF-8 Encoding=UTF-8
Version=0.2 Version=0.1
Type=Application Type=Application
Name=Cloud GUI Name=CIRCLE Client
Comment=Tool to use IK Cloud Comment=Tool to enhance the use of the CIRCLE Cloud
Exec=cloud2 %u Exec=cloud %u
Icon=/usr/share/icons/cloud.svg Icon=cloud
Terminal=true Terminal=true
MimeType=x-scheme-handler/circle; MimeType=x-scheme-handler/circle;
Categories=Utility;Application; Categories=Utility;Application;
...@@ -8,6 +8,8 @@ The Client job is to help the ease of use of the cloud system. ...@@ -8,6 +8,8 @@ The Client job is to help the ease of use of the cloud system.
import platform import platform
import argparse import argparse
import imp
import os
try: try:
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
...@@ -32,31 +34,6 @@ class Struct: ...@@ -32,31 +34,6 @@ class Struct:
pass pass
def parse_arguments():
"""
Argument parser, based on the argparse module
Keyword arguments:
@return args -- arguments given by console
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"uri", type=str, help="Specific schema handler", nargs='?',
default=None)
parser.add_argument("-u", "--username", type=str)
parser.add_argument("-p", "--password", type=str)
parser.add_argument(
"-d",
"--driver",
help=("Select webdriver. Aside from Firefox, you have to install "
"first the proper driver."),
type=str,
choices=['firefox', 'chrome', 'ie', 'opera'],
default="firefox")
args = parser.parse_args()
return args
class Browser: class Browser:
""" """
Browser initialisation Browser initialisation
...@@ -119,7 +96,7 @@ class Browser: ...@@ -119,7 +96,7 @@ class Browser:
# cl: connection string converted to list # cl: connection string converted to list
cl = driver.find_element_by_css_selector( cl = driver.find_element_by_css_selector(
"#vm-details-connection-string").get_attribute( "#vm-details-connection-string").get_attribute(
"value").split() "value").split()
if cl[0] == "sshpass": if cl[0] == "sshpass":
vm.protocol = "SSH" vm.protocol = "SSH"
vm.user, vm.host = cl[6].split("@") vm.user, vm.host = cl[6].split("@")
...@@ -135,6 +112,57 @@ class Browser: ...@@ -135,6 +112,57 @@ class Browser:
return vm return vm
def load_from_file(uri, absl=False):
if not absl:
uri = os.path.normpath(os.path.join(os.path.dirname(__file__), uri))
path, fname = os.path.split(uri)
mname, ext = os.path.splitext(fname)
no_ext = os.path.join(path, mname)
if os.path.exists(no_ext + '.pyc'):
try:
return imp.load_compiled(mname, no_ext + '.pyc')
except:
pass
elif os.path.exists(no_ext + '.py'):
try:
return imp.load_source(mname, no_ext + '.py')
except:
pass
elif os.path.exists(no_ext):
try:
return imp.load_source(mname, no_ext)
except:
try:
return imp.load_compiled(mname, no_ext)
except:
pass
def parse_arguments():
"""
Argument parser, based on the argparse module
Keyword arguments:
@return args -- arguments given by console
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"uri", type=str, help="Specific schema handler", nargs='?',
default=None)
parser.add_argument("-u", "--username", type=str)
parser.add_argument("-p", "--password", type=str)
parser.add_argument(
"-d",
"--driver",
help=("Select webdriver. Aside from Firefox, you have to install "
"first the proper driver."),
type=str,
choices=['firefox', 'chrome', 'ie', 'opera'],
default="firefox")
args = parser.parse_args()
return args
def main(): def main():
""" """
Main program Main program
...@@ -151,12 +179,13 @@ def main(): ...@@ -151,12 +179,13 @@ def main():
browser = Browser(args) browser = Browser(args)
vm = browser.main() vm = browser.main()
browser.driver.quit() browser.driver.quit()
if platform.system() == "Linux": if platform.system() == "Linux":
from cloud_connect_from_linux import connect connect = load_from_file("cloud_connect_from_linux")
elif platform.system() == "Windows": elif platform.system() == "Windows":
from cloud_connect_from_windows import connect connect = load_from_file("cloud_connect_from_windows")
if vm.state.upper()[:3] in ("FUT", "RUN"): if vm.state.upper()[:3] in ("FUT", "RUN"):
connect(vm) connect.connect(vm)
except: except:
print "Unknown error occurred! Please contact the developers!" print "Unknown error occurred! Please contact the developers!"
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cloud
if __name__ == '__main__':
try:
cloud.main()
finally:
pass
circle-client (0.1) trusty; urgency=medium circle-client (0.1) trusty; urgency=medium
* Initial release. (Closes: #XXXXXX) * Initial release.
-- Csók Tamás <godhak@gmail.com> Wed, 10 Sep 2014 15:57:26 +0200 -- Csók Tamás <godhak@gmail.com> Wed, 10 Sep 2014 15:57:26 +0200
...@@ -2,13 +2,14 @@ Source: circle-client ...@@ -2,13 +2,14 @@ Source: circle-client
Section: embedded Section: embedded
Priority: optional Priority: optional
Maintainer: Csók Tamás <godhak@gmail.com> Maintainer: Csók Tamás <godhak@gmail.com>
Build-Depends: debhelper (>= 9.20~), python (>= 2.7~), python-support (>= 1.0.15~), cdbs (>= 0.4.122~), python-all-dev, libglib2.0-dev (>=2.40~), libgtk2.0-dev (>=2.24.23~), libgcrypt11-dev (>= 1.5.3~), python-dev (>= 2.7.5~) Build-Depends: debhelper (>= 9.20~), python (>= 2.7~), python-support (>= 1.0.15~), cdbs (>= 0.4.122~), python-all-dev, libglib2.0-dev (>=2.40~), libgtk2.0-dev (>=2.24.23~), libgcrypt11-dev (>= 1.5.3~), python-dev (>= 2.7~)
Standards-Version: 3.9.5 Standards-Version: 3.9.5
Package: circle-client Package: circle-client
Architecture: all Architecture: any
Multi-Arch: foreign
Homepage: http://circlecloud.org/ Homepage: http://circlecloud.org/
Depends: ${misc:Depends}, ${python:Depends}, sshpass (>= 1.05~), remmina (>=1.0.0~), remmina-plugin-nx (>= 1.0.0~), remmina-plugin-rdp (>= 1.0.0~), python (>= 2.7~) Depends: ${misc:Depends}, ${python:Depends}, ${shlibs:Depends}, sshpass (>= 1.05~), remmina (>=1.0.0~), remmina-plugin-nx (>= 1.0.0~), remmina-plugin-rdp (>= 1.0.0~), python (>= 2.7~)
Description: Connectivity helper for CIRCLE cloud system Description: Connectivity helper for CIRCLE cloud system
Tool to enhance ease of use of the CIRCLE Cloud by the Tool to enhance ease of use of the CIRCLE Cloud by the
use of third party connetcion handler programs. These use of third party connetcion handler programs. These
......
...@@ -48,6 +48,8 @@ setup(name='CIRCLE Client', ...@@ -48,6 +48,8 @@ setup(name='CIRCLE Client',
platforms=[ platforms=[
'linux2', 'linux2',
'posix'], 'posix'],
data_files=[('/usr/share/icons', ['cloud.svg']),
('/usr/share/applications', ['CIRCLE Client.desktop'])],
description='Connectivity helper for CIRCLE cloud system', description='Connectivity helper for CIRCLE cloud system',
long_description=( long_description=(
'Tool to enhance ease of use of the CIRCLE by ' 'Tool to enhance ease of use of the CIRCLE by '
...@@ -59,7 +61,7 @@ setup(name='CIRCLE Client', ...@@ -59,7 +61,7 @@ setup(name='CIRCLE Client',
maintainer='BME IK', maintainer='BME IK',
maintainer_email='cloud@ik.bme.hu', maintainer_email='cloud@ik.bme.hu',
url='http://circlecloud.org/', url='http://circlecloud.org/',
scripts=['cloud.py', 'cloud2', 'cloud_connect_from_linux.py'], scripts=['cloud', 'cloud_connect_from_linux'],
classifiers=[ classifiers=[
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',
'Environment :: Web Environment', 'Environment :: Web Environment',
......
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