Remove '__appname__'

Not so useful, one less import.
This commit is contained in:
Alessio Sergi 2016-11-11 20:00:53 +01:00
parent 116d6fb50e
commit 49346dae99
7 changed files with 18 additions and 27 deletions

View File

@ -27,7 +27,6 @@ import signal
import sys
# Global name
__appname__ = 'glances'
__version__ = '2.8_DEVELOP'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPL'

View File

@ -22,7 +22,6 @@
import socket
import sys
from glances import __appname__
from glances.globals import BSD
from glances.logger import logger
@ -48,8 +47,8 @@ if zeroconf_tag:
# Global var
# Recent versions of the zeroconf python package doesnt like a zeroconf type that ends with '._tcp.'.
# Correct issue: zeroconf problem with zeroconf_type = "_%s._tcp." % __appname__ #888
zeroconf_type = "_%s._tcp.local." % __appname__
# Correct issue: zeroconf problem with zeroconf_type = "_%s._tcp." % 'glances' #888
zeroconf_type = "_%s._tcp.local." % 'glances'
class AutoDiscovered(object):

View File

@ -24,7 +24,6 @@ import sys
import multiprocessing
from io import open
from glances import __appname__
from glances.compat import ConfigParser, NoOptionError
from glances.globals import BSD, LINUX, OSX, WINDOWS, sys_prefix
from glances.logger import logger
@ -71,22 +70,18 @@ class Config(object):
paths.append(
os.path.join(os.environ.get('XDG_CONFIG_HOME') or
os.path.expanduser('~/.config'),
__appname__, self.config_filename))
'glances', self.config_filename))
if BSD:
paths.append(
os.path.join(sys.prefix, 'etc', __appname__, self.config_filename))
paths.append(os.path.join(sys.prefix, 'etc', 'glances', self.config_filename))
else:
paths.append(
os.path.join('/etc', __appname__, self.config_filename))
paths.append(os.path.join('/etc/glances', self.config_filename))
elif OSX:
paths.append(
os.path.join(os.path.expanduser('~/Library/Application Support/'),
__appname__, self.config_filename))
paths.append(
os.path.join(sys_prefix, 'etc', __appname__, self.config_filename))
os.path.join(os.path.expanduser('~/Library/Application Support/glances'),
self.config_filename))
paths.append(os.path.join(sys_prefix, 'etc', 'glances', self.config_filename))
elif WINDOWS:
paths.append(
os.path.join(os.environ.get('APPDATA'), __appname__, self.config_filename))
paths.append(os.path.join(os.environ.get('APPDATA'), 'glances', self.config_filename))
return paths

View File

@ -24,7 +24,7 @@ import os
import sys
import tempfile
from glances import __appname__, __version__, psutil_version
from glances import __version__, psutil_version
from glances.compat import input
from glances.config import Config
from glances.globals import LINUX, WINDOWS
@ -88,7 +88,7 @@ Start the client browser (browser mode):\n\
"""Init all the command line arguments."""
version = "Glances v" + __version__ + " with psutil v" + psutil_version
parser = argparse.ArgumentParser(
prog=__appname__,
prog='glances',
conflict_handler='resolve',
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=self.example_of_use)

View File

@ -32,7 +32,7 @@ except ImportError:
else:
outdated_tag = True
from glances import __version__, __appname__
from glances import __version__
from glances.globals import BSD, LINUX, OSX, WINDOWS
from glances.logger import logger
@ -155,12 +155,11 @@ class Outdated(object):
if LINUX or BSD:
return os.path.join(os.environ.get('XDG_CONFIG_HOME') or
os.path.expanduser('~/.config'),
__appname__)
'glances')
elif OSX:
return os.path.join(os.path.expanduser('~/Library/Application Support/'),
__appname__)
return os.path.expanduser('~/Library/Application Support/glances')
elif WINDOWS:
return os.path.join(os.environ.get('APPDATA'), __appname__)
return os.path.join(os.environ.get('APPDATA'), 'glances')
def _update_pypi_version(self):
"""Get the latest Pypi version (as a string) via the Restful JSON API"""

View File

@ -26,7 +26,6 @@ import sys
import uuid
from io import open
from glances import __appname__
from glances.compat import b, input
from glances.globals import BSD, LINUX, OSX, WINDOWS
from glances.logger import logger
@ -59,7 +58,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, 'glances')
return app_path

View File

@ -23,7 +23,7 @@ Help plugin.
Just a stupid plugin to display the help screen.
"""
from glances import __appname__, __version__, psutil_version
from glances import __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('Glances', __version__)
self.view_data['psutil_version'] = ' with PSutil {0}'.format(psutil_version)
try: