diff --git a/bin/cc-cli b/bin/cc-cli index dc2a5a7fd7b6aa751ebc5ce4ea7bf94faddd1d37..196303468f12bdd654e06c9d3a8844ebda158f79 100755 --- a/bin/cc-cli +++ b/bin/cc-cli @@ -29,10 +29,10 @@ import re import warnings from xdg import BaseDirectory -import cccli -from cccli.cli import Cli -from cccli.printer import Printer -from cccli.exception import * +import cloudcontrol.cli as cccli +from cloudcontrol.cli.cli import Cli +from cloudcontrol.cli.printer import Printer +from cloudcontrol.cli.exception import * settings = { "port": "1984", diff --git a/cloudcontrol/__init__.py b/cloudcontrol/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5496c70c57fdf71d55184eb946ac9d6626f127cd --- /dev/null +++ b/cloudcontrol/__init__.py @@ -0,0 +1,17 @@ +# This file is part of CloudControl. +# +# CloudControl is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# CloudControl is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with CloudControl. If not, see <http://www.gnu.org/licenses/>. + + +__import__('pkg_resources').declare_namespace(__name__) diff --git a/cccli/__init__.py b/cloudcontrol/cli/__init__.py similarity index 100% rename from cccli/__init__.py rename to cloudcontrol/cli/__init__.py diff --git a/cccli/cli.py b/cloudcontrol/cli/cli.py similarity index 96% rename from cccli/cli.py rename to cloudcontrol/cli/cli.py index 3fa267a2f96f5add105d158f0c122104b71d6b38..ee2582aee1d5bde756e8cd95811a282ae473712c 100644 --- a/cccli/cli.py +++ b/cloudcontrol/cli/cli.py @@ -19,12 +19,12 @@ CloudControl CLI main module ''' -import cccli -from cccli.exception import * -from cccli.printer import Printer, color -from cccli.command import Commands, Aliases -from cccli.handler import CliHandler -from cccli.tagdisplay import TagDisplay +from cloudcontrol.cli import debug +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import Commands, Aliases +from cloudcontrol.cli.handler import CliHandler +from cloudcontrol.cli.tagdisplay import TagDisplay from sjrpc.core import RpcConnection from sjrpc.utils import RpcHandler import threading @@ -188,7 +188,7 @@ class Cli(object): except EOFError: self.printer.out("") except Exception as e: - if cccli.debug: raise + if debug: raise self.printer.error("%s: %s"%(type(e), str(e))) self.printer.warn("This is a not expected error, please report it!") diff --git a/cccli/command.py b/cloudcontrol/cli/command.py similarity index 98% rename from cccli/command.py rename to cloudcontrol/cli/command.py index 9690c2685bffd4770b262e3a6ac1be151431e8ef..499ae631dfcc0f2a257157773f7731b3d5812535 100644 --- a/cccli/command.py +++ b/cloudcontrol/cli/command.py @@ -26,11 +26,11 @@ import shlex import imp import sys -from cccli.exception import * -from sjrpc.core import RpcError -from cccli.printer import Printer, color +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color from optparse import OptionParser -import cccli.commands +from sjrpc.core import RpcError +import cloudcontrol.cli.commands as commands class Commands(object): '''Command manager''' @@ -39,7 +39,7 @@ class Commands(object): # save cli context self.cli = cli # build command list - self.cmds = self.load_commands(cccli.commands.__path__[0], Command) + self.cmds = self.load_commands(commands.__path__[0], Command) # build remote function list try: self.functions = set([ c["name"] for c in self.cli.rpc.call("functions") ]) diff --git a/cccli/commands/__init__.py b/cloudcontrol/cli/commands/__init__.py similarity index 100% rename from cccli/commands/__init__.py rename to cloudcontrol/cli/commands/__init__.py diff --git a/cccli/commands/account.py b/cloudcontrol/cli/commands/account.py similarity index 97% rename from cccli/commands/account.py rename to cloudcontrol/cli/commands/account.py index 72b4da6db99ee46702f9accb50c4e35b7c171640..1e16825e824b278da6182f0f64ce6e7d2a8d7a0e 100644 --- a/cccli/commands/account.py +++ b/cloudcontrol/cli/commands/account.py @@ -19,10 +19,10 @@ CloudControl accounts related commands ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand class Command_addaccount(TqlCommand): '''Create an account''' diff --git a/cccli/commands/addforward.py b/cloudcontrol/cli/commands/addforward.py similarity index 95% rename from cccli/commands/addforward.py rename to cloudcontrol/cli/commands/addforward.py index 184ab734d8ec91a76d812cfad7ec946f603d6f98..9b7c57b2ffc319d832957659f7b5aaf3f575602e 100644 --- a/cccli/commands/addforward.py +++ b/cloudcontrol/cli/commands/addforward.py @@ -19,9 +19,9 @@ CloudControl addforward command ''' -from cccli.command import TqlCommand -from cccli.tunnel import Forward -from cccli.exception import * +from cloudcontrol.cli.command import TqlCommand +from cloudcontrol.cli.tunnel import Forward +from cloudcontrol.cli.exception import * class Command_addforward(TqlCommand): '''Create a forward''' diff --git a/cccli/commands/alias.py b/cloudcontrol/cli/commands/alias.py similarity index 96% rename from cccli/commands/alias.py rename to cloudcontrol/cli/commands/alias.py index 0cf4ad204dc00adede077e1fb2cc0bf498057c5f..41154ff30bd14c998e15c19aa1b902f5ebfdc6e7 100644 --- a/cccli/commands/alias.py +++ b/cloudcontrol/cli/commands/alias.py @@ -19,8 +19,9 @@ CloudControl alias related command ''' -from cccli.exception import * -from cccli.command import OptionCommand +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.command import OptionCommand + import re class Command_alias(OptionCommand): diff --git a/cccli/commands/attachment.py b/cloudcontrol/cli/commands/attachment.py similarity index 94% rename from cccli/commands/attachment.py rename to cloudcontrol/cli/commands/attachment.py index 23db245fa559911e641a6172edfb8a798ff462ca..3eee51ce847e06a04113f1b4e81345bc251f7945 100644 --- a/cccli/commands/attachment.py +++ b/cloudcontrol/cli/commands/attachment.py @@ -22,8 +22,8 @@ CloudControl attachment command import os import subprocess -from cccli.exception import * -from cccli.command import TqlCommand +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.command import TqlCommand class Command_attachment(TqlCommand): '''Retrieve an attachment''' diff --git a/cccli/commands/cancel.py b/cloudcontrol/cli/commands/cancel.py similarity index 89% rename from cccli/commands/cancel.py rename to cloudcontrol/cli/commands/cancel.py index 2c40809af5f7d005c3e2142c9446f7ada1d8af9e..c271ca31c0e3dc98d58f6dc65b26e507a7f72d07 100644 --- a/cccli/commands/cancel.py +++ b/cloudcontrol/cli/commands/cancel.py @@ -19,10 +19,10 @@ CloudControl cancel command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_cancel(TqlCommand): '''Cancel a job''' diff --git a/cccli/commands/console.py b/cloudcontrol/cli/commands/console.py similarity index 96% rename from cccli/commands/console.py rename to cloudcontrol/cli/commands/console.py index b94726039b8878b4e28e40f14a01fdedb20b33d4..926f1794bd58caf7cebf3e818745b8a3b98d4729 100644 --- a/cccli/commands/console.py +++ b/cloudcontrol/cli/commands/console.py @@ -19,9 +19,9 @@ CloudControl Console related commands ''' -from cccli.command import TqlCommand -from cccli.exception import * -from cccli.printer import FakeTtySocket +from cloudcontrol.cli.command import TqlCommand +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import FakeTtySocket from sjrpc.core.exceptions import * import fcntl import signal diff --git a/cccli/commands/delforward.py b/cloudcontrol/cli/commands/delforward.py similarity index 94% rename from cccli/commands/delforward.py rename to cloudcontrol/cli/commands/delforward.py index 0db7cfe216d954335feb41862fccca177f57e830..66caee131ea4c127d9454a96d946f49eb807c219 100644 --- a/cccli/commands/delforward.py +++ b/cloudcontrol/cli/commands/delforward.py @@ -19,8 +19,8 @@ CloudControl delforward command ''' -from cccli.command import Command -from cccli.exception import * +from cloudcontrol.cli.command import Command +from cloudcontrol.cli.exception import * class Command_delforward(Command): '''Delete forwarded connection''' diff --git a/cccli/commands/execute.py b/cloudcontrol/cli/commands/execute.py similarity index 92% rename from cccli/commands/execute.py rename to cloudcontrol/cli/commands/execute.py index 55ea6a9ec52ff7f6870ad0941cad8ff4f6372095..f720613851591944a75de40690e66628c6844a03 100644 --- a/cccli/commands/execute.py +++ b/cloudcontrol/cli/commands/execute.py @@ -19,10 +19,10 @@ CloudControl execute command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_execute(TqlCommand): '''Execute a command on the remote host''' diff --git a/cccli/commands/expert.py b/cloudcontrol/cli/commands/expert.py similarity index 91% rename from cccli/commands/expert.py rename to cloudcontrol/cli/commands/expert.py index 4de7ff513ee58c12d5091b0829ba29cb2d18a8c0..171e5ce480c0f6d68bb96b3512283c73f94a0f18 100644 --- a/cccli/commands/expert.py +++ b/cloudcontrol/cli/commands/expert.py @@ -18,9 +18,9 @@ ''' CloudControl expert command ''' -from cccli.exception import * -from cccli.printer import Printer, color -from cccli.command import Command +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import Command from sjrpc.utils import ConnectionProxy import code diff --git a/cccli/commands/forwards.py b/cloudcontrol/cli/commands/forwards.py similarity index 93% rename from cccli/commands/forwards.py rename to cloudcontrol/cli/commands/forwards.py index c3846a8976a3482cdb09ea6e44c9b97d03bdbe6a..8b9ffc15a91d5d9e93e0f29b03bbb8dcddcdaee1 100644 --- a/cccli/commands/forwards.py +++ b/cloudcontrol/cli/commands/forwards.py @@ -19,9 +19,9 @@ CloudControl forwards command ''' -from cccli.command import Command -from cccli.printer import color -from cccli.exception import * +from cloudcontrol.cli.command import Command +from cloudcontrol.cli.printer import color +from cloudcontrol.cli.exception import * class Command_forwards(Command): '''List open forwards''' diff --git a/cccli/commands/kill.py b/cloudcontrol/cli/commands/kill.py similarity index 89% rename from cccli/commands/kill.py rename to cloudcontrol/cli/commands/kill.py index 28ab7abbf8df0a9554bab1ecaed0d332e7fbe5e5..307d0df3ca82b972d9063828becf5cfafd003ace 100644 --- a/cccli/commands/kill.py +++ b/cloudcontrol/cli/commands/kill.py @@ -19,10 +19,10 @@ CloudControl Connection related commands ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_kill(TqlCommand): '''Kill a server connection''' diff --git a/cccli/commands/list.py b/cloudcontrol/cli/commands/list.py similarity index 98% rename from cccli/commands/list.py rename to cloudcontrol/cli/commands/list.py index 4125ca98d2f65899ea134a03a8d320a190cf984c..4f5f58728dc618a0e2351567d5b82d3eaf912e41 100644 --- a/cccli/commands/list.py +++ b/cloudcontrol/cli/commands/list.py @@ -19,10 +19,10 @@ CloudControl list command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand import math import os diff --git a/cccli/commands/migrate.py b/cloudcontrol/cli/commands/migrate.py similarity index 96% rename from cccli/commands/migrate.py rename to cloudcontrol/cli/commands/migrate.py index fe87714e1336edf76ad8f1bf25579940468af9d5..cd2e4c7f5946a2321cf2ac8c6723265a04374ebb 100644 --- a/cccli/commands/migrate.py +++ b/cloudcontrol/cli/commands/migrate.py @@ -19,10 +19,10 @@ CloudControl migrate command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_migrate(TqlCommand): '''Migrate vm''' diff --git a/cccli/commands/purge.py b/cloudcontrol/cli/commands/purge.py similarity index 89% rename from cccli/commands/purge.py rename to cloudcontrol/cli/commands/purge.py index d01c4956f4f7b0c5d3ae02caaad2389ea2914776..d37fc8b57d05bccfed12d9a5df687dfe4192d241 100644 --- a/cccli/commands/purge.py +++ b/cloudcontrol/cli/commands/purge.py @@ -19,10 +19,10 @@ CloudControl cancel command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_purge(TqlCommand): '''Purge a job (delete it)''' diff --git a/cccli/commands/right.py b/cloudcontrol/cli/commands/right.py similarity index 96% rename from cccli/commands/right.py rename to cloudcontrol/cli/commands/right.py index 1be1654408b4fcaa2e88073eca6c0f9403217153..b0e5f1e5d434b2d4a7cb00a332b2f4ff4f258f65 100644 --- a/cccli/commands/right.py +++ b/cloudcontrol/cli/commands/right.py @@ -25,10 +25,10 @@ import os import re import pprint -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import Command, RemoteCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import Command, RemoteCommand class Command_rights(RemoteCommand): '''List account rights''' diff --git a/cccli/commands/server.py b/cloudcontrol/cli/commands/server.py similarity index 94% rename from cccli/commands/server.py rename to cloudcontrol/cli/commands/server.py index 62016d8bb9eb4b19b46764b8c6805cbee84e1e79..866d844285eaaa87edb2f677b6d325f890d4d947 100644 --- a/cccli/commands/server.py +++ b/cloudcontrol/cli/commands/server.py @@ -18,10 +18,10 @@ ''' CloudControl server command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import RemoteCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import RemoteCommand class Command_server(RemoteCommand): '''Server manipulation command''' diff --git a/cccli/commands/shell.py b/cloudcontrol/cli/commands/shell.py similarity index 92% rename from cccli/commands/shell.py rename to cloudcontrol/cli/commands/shell.py index 1e8424f6d0bb0998e881dca1f5b50753a8426e04..c5e9501b8db1fca5b12861d7d6a97009658e7e24 100644 --- a/cccli/commands/shell.py +++ b/cloudcontrol/cli/commands/shell.py @@ -19,9 +19,9 @@ CloudControl shells related commands ''' -from cccli.exception import * -from cccli.printer import Printer, color -from cccli.command import Command +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import Command class Command_quit(Command): '''Quit application with respect''' @@ -36,8 +36,8 @@ class Command_version(Command): def __call__(self, argv): if len(argv) != 1: raise cmdBadArgument() - import cccli - self.printer.out(cccli.version) + import cloudcontrol.cli + self.printer.out(cloudcontrol.cli.version) class Command_debug(Command): @@ -45,8 +45,8 @@ class Command_debug(Command): def __call__(self, argv): if len(argv) != 1: raise cmdBadArgument() - import cccli - cccli.debug = not cccli.debug + import cloudcontrol.cli + cloudcontrol.cli.debug = not cloudcontrol.cli.debug class Command_whoami(Command): diff --git a/cccli/commands/shutdown.py b/cloudcontrol/cli/commands/shutdown.py similarity index 92% rename from cccli/commands/shutdown.py rename to cloudcontrol/cli/commands/shutdown.py index e408a974503669db9d73fa1244a069ae28d36cf0..a5c18f4bf6f2f71979baafbdd7a01b22b160de5c 100644 --- a/cccli/commands/shutdown.py +++ b/cloudcontrol/cli/commands/shutdown.py @@ -19,10 +19,10 @@ CloudControl physical host related commands ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_shutdown(TqlCommand): '''Shutdown a physical host''' diff --git a/cccli/commands/tag.py b/cloudcontrol/cli/commands/tag.py similarity index 95% rename from cccli/commands/tag.py rename to cloudcontrol/cli/commands/tag.py index ac89325ece7c5b988a3fac0ab9bb584f127353ad..2da3e1abf9483969a6b662cfa4030e38a246afd2 100644 --- a/cccli/commands/tag.py +++ b/cloudcontrol/cli/commands/tag.py @@ -19,10 +19,10 @@ CloudControl tag releated commands ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand from optparse import OptionParser diff --git a/cccli/commands/tagdisplay.py b/cloudcontrol/cli/commands/tagdisplay.py similarity index 97% rename from cccli/commands/tagdisplay.py rename to cloudcontrol/cli/commands/tagdisplay.py index 2a9d731c55b91e54b2a4174d6a9d971e44023b79..81d5810fa93bc3c5cb5f358264dd2e99ecf4d386 100644 --- a/cccli/commands/tagdisplay.py +++ b/cloudcontrol/cli/commands/tagdisplay.py @@ -18,10 +18,10 @@ ''' CloudControl tagdisplay command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import OptionCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import OptionCommand class Command_tagdisplay(OptionCommand): '''Tagdisplay tool''' diff --git a/cccli/commands/time.py b/cloudcontrol/cli/commands/time.py similarity index 92% rename from cccli/commands/time.py rename to cloudcontrol/cli/commands/time.py index 935e894d81b08d9663d91ae1ac94f32ad25fff46..109106eaa76ddf9793d00058bc3a23d91d37fe4f 100644 --- a/cccli/commands/time.py +++ b/cloudcontrol/cli/commands/time.py @@ -22,10 +22,10 @@ CloudControl time command import time as systime import datetime -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import Command +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import Command class Command_time(Command): diff --git a/cccli/commands/vm.py b/cloudcontrol/cli/commands/vm.py similarity index 98% rename from cccli/commands/vm.py rename to cloudcontrol/cli/commands/vm.py index 0048be615e6bfcca0aef108bf886decd1ccc0635..9ffed6453609e191c8bc54e184ceeed8f69551e5 100644 --- a/cccli/commands/vm.py +++ b/cloudcontrol/cli/commands/vm.py @@ -19,10 +19,10 @@ CloudControl VM related commands ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_start(TqlCommand): '''Start a stopped vm''' diff --git a/cccli/commands/vnc.py b/cloudcontrol/cli/commands/vnc.py similarity index 96% rename from cccli/commands/vnc.py rename to cloudcontrol/cli/commands/vnc.py index eb779c122594f09c2f28d2af935eaf7a4ddd3a42..9ec7c5d0b03535044ee3b35fa010697a4e6234ba 100644 --- a/cccli/commands/vnc.py +++ b/cloudcontrol/cli/commands/vnc.py @@ -19,9 +19,9 @@ CloudControl vnc command ''' -from cccli.command import TqlCommand -from cccli.exception import * -from cccli.tunnel import Forward +from cloudcontrol.cli.command import TqlCommand +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.tunnel import Forward import os import subprocess import threading diff --git a/cccli/commands/watch.py b/cloudcontrol/cli/commands/watch.py similarity index 94% rename from cccli/commands/watch.py rename to cloudcontrol/cli/commands/watch.py index 7b66845428116929ca2b9e0be0024776ed14c277..2173771760594e76926b2326386b40f5762a9ceb 100644 --- a/cccli/commands/watch.py +++ b/cloudcontrol/cli/commands/watch.py @@ -22,10 +22,10 @@ CloudControl watch command import sys import time -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import OptionCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import OptionCommand from cStringIO import StringIO class Command_watch(OptionCommand): diff --git a/cccli/exception.py b/cloudcontrol/cli/exception.py similarity index 100% rename from cccli/exception.py rename to cloudcontrol/cli/exception.py diff --git a/cccli/handler.py b/cloudcontrol/cli/handler.py similarity index 93% rename from cccli/handler.py rename to cloudcontrol/cli/handler.py index 4df2316ff13c5189c53991fd1b5f80234faef370..a94113ba409bbc4001aa31ae97923666a787c070 100644 --- a/cccli/handler.py +++ b/cloudcontrol/cli/handler.py @@ -19,10 +19,11 @@ CloudControl CLI RPC Handler ''' -from cccli.exception import * -from cccli.printer import Printer, color +from cloudcontrol.cli import version +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color from sjrpc.utils import RpcHandler -import cccli + import os, os.path import subprocess import platform @@ -50,7 +51,7 @@ class CliHandler(RpcHandler): def _get_tag_version(self): '''Return tag version''' - return cccli.version + return version def _get_tag_os(self): '''Return Operating system tag''' diff --git a/cccli/printer.py b/cloudcontrol/cli/printer.py similarity index 99% rename from cccli/printer.py rename to cloudcontrol/cli/printer.py index b767337d418840b2164b5a18beac3710cf3016f5..34a60b4cdf1f049c6d0fc5b3c6fa1fefd91d1dcc 100644 --- a/cccli/printer.py +++ b/cloudcontrol/cli/printer.py @@ -19,8 +19,8 @@ CloudControl CLI Printer module ''' -import cccli -from cccli.exception import * +import cloudcontrol.cli as cli +from cloudcontrol.cli.exception import * import fcntl import os @@ -123,7 +123,7 @@ class Printer(object): @staticmethod def debug(message, fd=None, nl=os.linesep): - if cccli.debug: + if cli.debug: Printer.err("%s%s%s"%(color["lgrey"],message,color["reset"]), fd, nl) def isinteractive(self): diff --git a/cccli/tagdisplay.py b/cloudcontrol/cli/tagdisplay.py similarity index 98% rename from cccli/tagdisplay.py rename to cloudcontrol/cli/tagdisplay.py index 1299a97bb67bd403004fa95d6d1fa2c3a4729e1f..7ada5d1e3e684a8df6196fe6cce7d000ef465543 100644 --- a/cccli/tagdisplay.py +++ b/cloudcontrol/cli/tagdisplay.py @@ -19,8 +19,9 @@ CloudControl Tag displaying stuff ''' -from cccli.exception import * -from cccli.printer import Printer, color +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color + import os import re import math diff --git a/cccli/tunnel.py b/cloudcontrol/cli/tunnel.py similarity index 98% rename from cccli/tunnel.py rename to cloudcontrol/cli/tunnel.py index 784870f6d2897b03876f7ba884a26dd854272d1f..7cadd778bfe739ee3d2a98afce37eda6068485e2 100644 --- a/cccli/tunnel.py +++ b/cloudcontrol/cli/tunnel.py @@ -23,7 +23,8 @@ import os import select import socket import threading -from cccli.printer import Printer + +from cloudcontrol.cli.printer import Printer from sjrpc.core import RpcError diff --git a/setup.py b/setup.py index 6da7f80d29924d784af93b085ebcd36b6659237b..80f9f559def98a103d0511d47bcb0eb18110126e 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with CloudControl. If not, see <http://www.gnu.org/licenses/>. -from setuptools import setup +from setuptools import setup, find_packages import cccli import os @@ -30,7 +30,8 @@ setup( author='Sébastien Luttringer', author_email='sebastien.luttringer@smartjog.com', license='GPL2', - packages=['cccli', 'cccli.commands'], + packages=find_packages(), + namespace_packages=['cloudcontrol'], scripts=['bin/cc-cli'], classifiers=[ 'Operating System :: Unix',