mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-28 22:55:55 +03:00
Merge branch 'develop' of https://github.com/nicolargo/glances into develop
This commit is contained in:
commit
9686fe6f91
@ -33,7 +33,7 @@ __license__ = 'LGPL'
|
||||
|
||||
# Import psutil
|
||||
try:
|
||||
from psutil import __version__ as __psutil_version
|
||||
from psutil import __version__ as psutil_version
|
||||
except ImportError:
|
||||
print('PSutil library not found. Glances cannot start.')
|
||||
sys.exit(1)
|
||||
@ -62,8 +62,8 @@ if sys.version_info[:2] == (2, 6):
|
||||
|
||||
# Check PSutil version
|
||||
psutil_min_version = (2, 0, 0)
|
||||
psutil_version = tuple([int(num) for num in __psutil_version.split('.')])
|
||||
if psutil_version < psutil_min_version:
|
||||
psutil_version_info = tuple([int(num) for num in psutil_version.split('.')])
|
||||
if psutil_version_info < psutil_min_version:
|
||||
print('PSutil 2.0 or higher is needed. Glances cannot start.')
|
||||
sys.exit(1)
|
||||
|
||||
@ -107,7 +107,7 @@ def main():
|
||||
logger.info('{0} {1} and PSutil {2} detected'.format(
|
||||
platform.python_implementation(),
|
||||
platform.python_version(),
|
||||
__psutil_version))
|
||||
psutil_version))
|
||||
|
||||
# Share global var
|
||||
global core, standalone, client, server, webserver
|
||||
|
@ -22,7 +22,8 @@
|
||||
import socket
|
||||
import sys
|
||||
|
||||
from glances.globals import appname, BSD
|
||||
from glances import __appname__
|
||||
from glances.globals import BSD
|
||||
from glances.logger import logger
|
||||
|
||||
try:
|
||||
@ -46,7 +47,7 @@ if zeroconf_tag:
|
||||
sys.exit(1)
|
||||
|
||||
# Global var
|
||||
zeroconf_type = "_%s._tcp." % appname
|
||||
zeroconf_type = "_%s._tcp." % __appname__
|
||||
|
||||
|
||||
class AutoDiscovered(object):
|
||||
|
@ -23,8 +23,8 @@ import json
|
||||
import socket
|
||||
import sys
|
||||
|
||||
from glances import __version__
|
||||
from glances.compat import Fault, ProtocolError, ServerProxy, Transport
|
||||
from glances.globals import version
|
||||
from glances.logger import logger
|
||||
from glances.stats_client import GlancesStatsClient
|
||||
from glances.outputs.glances_curses import GlancesCursesClient
|
||||
@ -122,11 +122,11 @@ class GlancesClient(object):
|
||||
|
||||
if self.client_mode == 'glances':
|
||||
# Check that both client and server are in the same major version
|
||||
if version.split('.')[0] == client_version.split('.')[0]:
|
||||
if __version__.split('.')[0] == client_version.split('.')[0]:
|
||||
# Init stats
|
||||
self.stats = GlancesStatsClient(config=self.config, args=self.args)
|
||||
self.stats.set_plugins(json.loads(self.client.getAllPlugins()))
|
||||
logger.debug("Client version: {0} / Server version: {1}".format(version, client_version))
|
||||
logger.debug("Client version: {0} / Server version: {1}".format(__version__, client_version))
|
||||
else:
|
||||
self.log_and_exit("Client and server not compatible: \
|
||||
Client version: {0} / Server version: {1}".format(version, client_version))
|
||||
|
@ -23,8 +23,9 @@ import os
|
||||
import sys
|
||||
from io import open
|
||||
|
||||
from glances import __appname__
|
||||
from glances.compat import ConfigParser, NoOptionError
|
||||
from glances.globals import appname, BSD, LINUX, OSX, WINDOWS, sys_prefix
|
||||
from glances.globals import BSD, LINUX, OSX, WINDOWS, sys_prefix
|
||||
from glances.logger import logger
|
||||
|
||||
|
||||
@ -69,22 +70,22 @@ class Config(object):
|
||||
paths.append(
|
||||
os.path.join(os.environ.get('XDG_CONFIG_HOME') or
|
||||
os.path.expanduser('~/.config'),
|
||||
appname, self.config_filename))
|
||||
__appname__, self.config_filename))
|
||||
if BSD:
|
||||
paths.append(
|
||||
os.path.join(sys.prefix, 'etc', appname, self.config_filename))
|
||||
os.path.join(sys.prefix, 'etc', __appname__, self.config_filename))
|
||||
else:
|
||||
paths.append(
|
||||
os.path.join('/etc', appname, self.config_filename))
|
||||
os.path.join('/etc', __appname__, self.config_filename))
|
||||
elif OSX:
|
||||
paths.append(
|
||||
os.path.join(os.path.expanduser('~/Library/Application Support/'),
|
||||
appname, self.config_filename))
|
||||
__appname__, self.config_filename))
|
||||
paths.append(
|
||||
os.path.join(sys_prefix, 'etc', appname, self.config_filename))
|
||||
os.path.join(sys_prefix, 'etc', __appname__, self.config_filename))
|
||||
elif WINDOWS:
|
||||
paths.append(
|
||||
os.path.join(os.environ.get('APPDATA'), appname, self.config_filename))
|
||||
os.path.join(os.environ.get('APPDATA'), __appname__, self.config_filename))
|
||||
|
||||
return paths
|
||||
|
||||
|
@ -22,11 +22,6 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Global information
|
||||
appname = 'glances'
|
||||
version = __import__('glances').__version__
|
||||
psutil_version = __import__('glances').__psutil_version
|
||||
|
||||
# Operating system flag
|
||||
# Note: Somes libs depends of OS
|
||||
BSD = sys.platform.find('bsd') != -1
|
||||
|
@ -24,9 +24,10 @@ import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from glances import __appname__, __version__, psutil_version
|
||||
from glances.compat import input
|
||||
from glances.config import Config
|
||||
from glances.globals import appname, LINUX, WINDOWS, psutil_version, version
|
||||
from glances.globals import LINUX, WINDOWS
|
||||
from glances.logger import logger
|
||||
|
||||
|
||||
@ -86,14 +87,14 @@ Start the client browser (browser mode):\n\
|
||||
|
||||
def init_args(self):
|
||||
"""Init all the command line arguments."""
|
||||
_version = "Glances v" + version + " with psutil v" + psutil_version
|
||||
version = "Glances v" + __version__ + " with psutil v" + psutil_version
|
||||
parser = argparse.ArgumentParser(
|
||||
prog=appname,
|
||||
prog=__appname__,
|
||||
conflict_handler='resolve',
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
epilog=self.example_of_use)
|
||||
parser.add_argument(
|
||||
'-V', '--version', action='version', version=_version)
|
||||
'-V', '--version', action='version', version=version)
|
||||
parser.add_argument('-d', '--debug', action='store_true', default=False,
|
||||
dest='debug', help='enable debug mode')
|
||||
parser.add_argument('-C', '--config', dest='conf_file',
|
||||
|
@ -26,8 +26,9 @@ import sys
|
||||
import uuid
|
||||
from io import open
|
||||
|
||||
from glances import __appname__
|
||||
from glances.compat import b, input
|
||||
from glances.globals import appname, BSD, LINUX, OSX, WINDOWS
|
||||
from glances.globals import BSD, LINUX, OSX, WINDOWS
|
||||
from glances.logger import logger
|
||||
|
||||
|
||||
@ -58,7 +59,7 @@ class GlancesPassword(object):
|
||||
app_path = '.'
|
||||
|
||||
# Append the Glances folder
|
||||
app_path = os.path.join(app_path, appname)
|
||||
app_path = os.path.join(app_path, __appname__)
|
||||
|
||||
return app_path
|
||||
|
||||
|
@ -23,7 +23,7 @@ Help plugin.
|
||||
Just a stupid plugin to display the help screen.
|
||||
"""
|
||||
|
||||
from glances.globals import appname, psutil_version, version
|
||||
from glances import __appname__, __version__, psutil_version
|
||||
from glances.plugins.glances_plugin import GlancesPlugin
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ class Plugin(GlancesPlugin):
|
||||
pass
|
||||
|
||||
def generate_view_data(self):
|
||||
self.view_data['version'] = '{0} {1}'.format(appname.title(), version)
|
||||
self.view_data['version'] = '{0} {1}'.format(__appname__.title(), __version__)
|
||||
self.view_data['psutil_version'] = ' with PSutil {0}'.format(psutil_version)
|
||||
|
||||
try:
|
||||
|
@ -17,13 +17,11 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from glances import psutil_version_info
|
||||
from glances.plugins.glances_plugin import GlancesPlugin
|
||||
|
||||
from psutil import __version__ as __psutil_version
|
||||
|
||||
|
||||
class Plugin(GlancesPlugin):
|
||||
|
||||
"""Get the psutil version for client/server purposes.
|
||||
|
||||
stats is a tuple
|
||||
@ -48,7 +46,7 @@ class Plugin(GlancesPlugin):
|
||||
if self.input_method == 'local':
|
||||
# PsUtil version only available in local
|
||||
try:
|
||||
self.stats = tuple([int(num) for num in __psutil_version.split('.')])
|
||||
self.stats = psutil_version_info
|
||||
except NameError:
|
||||
pass
|
||||
else:
|
||||
|
@ -24,9 +24,9 @@ import socket
|
||||
import sys
|
||||
from base64 import b64decode
|
||||
|
||||
from glances import __version__
|
||||
from glances.compat import SimpleXMLRPCRequestHandler, SimpleXMLRPCServer
|
||||
from glances.autodiscover import GlancesAutoDiscoverClient
|
||||
from glances.globals import version
|
||||
from glances.logger import logger
|
||||
from glances.stats_server import GlancesStatsServer
|
||||
from glances.timer import Timer
|
||||
@ -137,7 +137,7 @@ class GlancesInstance(object):
|
||||
|
||||
def init(self):
|
||||
# Return the Glances version
|
||||
return version
|
||||
return __version__
|
||||
|
||||
def getAll(self):
|
||||
# Update and return all the stats
|
||||
|
@ -25,8 +25,8 @@ import subprocess
|
||||
import time
|
||||
import unittest
|
||||
|
||||
from glances import __version__
|
||||
from glances.compat import text_type
|
||||
from glances.globals import version
|
||||
|
||||
import requests
|
||||
|
||||
@ -36,7 +36,7 @@ pid = None
|
||||
|
||||
# Unitest class
|
||||
# ==============
|
||||
print('RESTful API unitary tests for Glances %s' % version)
|
||||
print('RESTful API unitary tests for Glances %s' % __version__)
|
||||
|
||||
|
||||
class TestGlances(unittest.TestCase):
|
||||
|
@ -26,8 +26,8 @@ import subprocess
|
||||
import time
|
||||
import unittest
|
||||
|
||||
from glances import __version__
|
||||
from glances.compat import ServerProxy
|
||||
from glances.globals import version
|
||||
|
||||
SERVER_PORT = 61234
|
||||
URL = "http://localhost:%s" % SERVER_PORT
|
||||
@ -38,7 +38,7 @@ client = ServerProxy(URL)
|
||||
|
||||
# Unitest class
|
||||
# ==============
|
||||
print('XML-RPC API unitary tests for Glances %s' % version)
|
||||
print('XML-RPC API unitary tests for Glances %s' % __version__)
|
||||
|
||||
|
||||
class TestGlances(unittest.TestCase):
|
||||
|
@ -38,12 +38,13 @@ if not core.is_standalone():
|
||||
from glances.stats import GlancesStats
|
||||
stats = GlancesStats()
|
||||
|
||||
from glances.globals import WINDOWS, version
|
||||
from glances import __version__
|
||||
from glances.globals import WINDOWS
|
||||
from glances.outputs.glances_bars import Bar
|
||||
|
||||
# Unitest class
|
||||
# ==============
|
||||
print('Unitary tests for Glances %s' % version)
|
||||
print('Unitary tests for Glances %s' % __version__)
|
||||
|
||||
|
||||
class TestGlances(unittest.TestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user