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 import sys
# Global name # Global name
__appname__ = 'glances'
__version__ = '2.8_DEVELOP' __version__ = '2.8_DEVELOP'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>' __author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPL' __license__ = 'LGPL'

View File

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

View File

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

View File

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

View File

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

View File

@ -26,7 +26,6 @@ import sys
import uuid import uuid
from io import open from io import open
from glances import __appname__
from glances.compat import b, input from glances.compat import b, input
from glances.globals import BSD, LINUX, OSX, WINDOWS from glances.globals import BSD, LINUX, OSX, WINDOWS
from glances.logger import logger from glances.logger import logger
@ -59,7 +58,7 @@ class GlancesPassword(object):
app_path = '.' app_path = '.'
# Append the Glances folder # Append the Glances folder
app_path = os.path.join(app_path, __appname__) app_path = os.path.join(app_path, 'glances')
return app_path return app_path

View File

@ -23,7 +23,7 @@ Help plugin.
Just a stupid plugin to display the help screen. 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 from glances.plugins.glances_plugin import GlancesPlugin
@ -50,7 +50,7 @@ class Plugin(GlancesPlugin):
pass pass
def generate_view_data(self): 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) self.view_data['psutil_version'] = ' with PSutil {0}'.format(psutil_version)
try: try: