OS X -> macOS

This commit is contained in:
Alessio Sergi 2017-01-18 20:00:21 +01:00
parent 9cf2863447
commit 47a85eec5e
12 changed files with 30 additions and 30 deletions

View File

@ -26,5 +26,5 @@ exclude_lines =
except ImportError:
raise NotImplementedError
if WINDOWS
if OSX
if MACOS
if BSD

View File

@ -9,7 +9,7 @@ Glances - An eye on your system
:target: https://github.com/nicolargo/glances/
:alt: Github stars
.. image:: https://img.shields.io/travis/nicolargo/glances/master.svg?maxAge=3600&label=Linux%20/%20BSD%20/%20OSX
.. image:: https://img.shields.io/travis/nicolargo/glances/master.svg?maxAge=3600&label=Linux%20/%20BSD%20/%20macOS
:target: https://travis-ci.org/nicolargo/glances
:alt: Linux tests (Travis)
@ -226,10 +226,10 @@ To install Glances from ports:
# cd /usr/ports/sysutils/py-glances/
# make install clean
OS X
----
macOS
-----
OS X users can install Glances using ``Homebrew`` or ``MacPorts``.
macOS users can install Glances using ``Homebrew`` or ``MacPorts``.
Homebrew
````````

View File

@ -323,7 +323,7 @@ The following commands (key pressed) are supported while in Glances:
``ENTER``
Set the process filter
**Note**: on OS X, please use ``CTRL-H`` to delete
**Note**: on macOS, please use ``CTRL-H`` to delete
filter.
Filter is a regular expression pattern:

View File

@ -20,7 +20,7 @@ You can put your own ``glances.conf`` file in the following locations:
=========== ============================================================
``Linux`` ~/.config/glances ($XDG_CONFIG_HOME environment variable) or /etc/glances
``*BSD`` ~/.config/glances or /usr/local/etc/glances
``OS X`` ~/Library/Application Support/glances or /usr/local/etc/glances
``macOS`` ~/Library/Application Support/glances or /usr/local/etc/glances
``Windows`` %APPDATA%\\glances
=========== ============================================================
@ -108,10 +108,10 @@ line.
By default, the ``glances-USERNAME.log`` file is under the temporary directory:
===================== ==================================================
``Linux, *BSD, OS X`` /tmp
``Windows`` %APPDATA%\\Local\\temp
===================== ==================================================
====================== ==================================================
``Linux, *BSD, macOS`` /tmp
``Windows`` %APPDATA%\\Local\\temp
====================== ==================================================
If you want to use another system path or change the log message, you can use
your own logger configuration. First of all you have to create a glances.json

View File

@ -25,7 +25,7 @@ import multiprocessing
from io import open
from glances.compat import ConfigParser, NoOptionError
from glances.globals import BSD, LINUX, OSX, WINDOWS, sys_prefix
from glances.globals import BSD, LINUX, MACOS, WINDOWS, sys_prefix
from glances.logger import logger
@ -52,8 +52,8 @@ class Config(object):
* custom path: /path/to/glances
* Linux: ~/.config/glances, /etc/glances
* BSD: ~/.config/glances, /usr/local/etc/glances
* OS X: ~/Library/Application Support/glances, /usr/local/etc/glances
* *BSD: ~/.config/glances, /usr/local/etc/glances
* macOS: ~/Library/Application Support/glances, /usr/local/etc/glances
* Windows: %APPDATA%\glances
The config file will be searched in the following order of priority:
@ -75,7 +75,7 @@ class Config(object):
paths.append(os.path.join(sys.prefix, 'etc', 'glances', self.config_filename))
else:
paths.append(os.path.join('/etc/glances', self.config_filename))
elif OSX:
elif MACOS:
paths.append(
os.path.join(os.path.expanduser('~/Library/Application Support/glances'),
self.config_filename))

View File

@ -26,7 +26,7 @@ import sys
# Note: Somes libs depends of OS
BSD = sys.platform.find('bsd') != -1
LINUX = sys.platform.startswith('linux')
OSX = sys.platform.startswith('darwin')
MACOS = sys.platform.startswith('darwin')
SUNOS = sys.platform.startswith('sunos')
WINDOWS = sys.platform.startswith('win')

View File

@ -33,7 +33,7 @@ else:
outdated_tag = True
from glances import __version__
from glances.globals import BSD, LINUX, OSX, WINDOWS
from glances.globals import BSD, LINUX, MACOS, WINDOWS
from glances.logger import logger
@ -156,7 +156,7 @@ class Outdated(object):
return os.path.join(os.environ.get('XDG_CONFIG_HOME') or
os.path.expanduser('~/.config'),
'glances')
elif OSX:
elif MACOS:
return os.path.expanduser('~/Library/Application Support/glances')
elif WINDOWS:
return os.path.join(os.environ.get('APPDATA'), 'glances')

View File

@ -23,7 +23,7 @@ import re
import sys
from glances.compat import u, itervalues
from glances.globals import OSX, WINDOWS
from glances.globals import MACOS, WINDOWS
from glances.logger import logger
from glances.logs import glances_logs
from glances.processes import glances_processes
@ -751,7 +751,7 @@ class _GlancesCurses(object):
self.new_line()
self.display_plugin(stat_display["processlist"],
display_optional=(self.screen.getmaxyx()[1] > 102),
display_additional=(not OSX),
display_additional=(not MACOS),
max_y=(self.screen.getmaxyx()[0] - self.get_stats_display_height(stat_display["alert"]) - 2))
self.new_line()
self.display_plugin(stat_display["alert"])

View File

@ -27,7 +27,7 @@ import uuid
from io import open
from glances.compat import b, input
from glances.globals import BSD, LINUX, OSX, WINDOWS
from glances.globals import BSD, LINUX, MACOS, WINDOWS
from glances.logger import logger
@ -44,13 +44,13 @@ class GlancesPassword(object):
def get_password_path(self):
r"""Get the path where the password file will be stored.
* Linux and BSD: ~/.config/glances
* OS X: ~/Library/glances
* Linux and *BSD: ~/.config/glances
* macOS: ~/Library/glances
* Windows: %APPDATA%\glances
"""
if LINUX or BSD:
app_path = os.environ.get('XDG_CONFIG_HOME') or os.path.expanduser('~/.config')
elif OSX:
elif MACOS:
app_path = os.path.join(os.environ.get('HOME'), 'Library')
elif WINDOWS:
app_path = os.environ.get('APPDATA')

View File

@ -99,7 +99,7 @@ class Plugin(GlancesPlugin):
# inactive: (UNIX): memory that is marked as not used.
# buffers: (Linux, BSD): cache for things like file system metadata.
# cached: (Linux, BSD): cache for various things.
# wired: (BSD, OSX): memory that is marked to always stay in RAM. It is never moved to disk.
# wired: (BSD, macOS): memory that is marked to always stay in RAM. It is never moved to disk.
# shared: (BSD): memory that may be simultaneously accessed by multiple processes.
self.reset()
for mem in ['total', 'available', 'percent', 'used', 'free',

View File

@ -287,7 +287,7 @@ class Plugin(GlancesPlugin):
except (OverflowError, TypeError) as e:
# Catch OverflowError on some Amazon EC2 server
# See https://github.com/nicolargo/glances/issues/87
# Also catch TypeError on Mac OS X
# Also catch TypeError on macOS
# See: https://github.com/nicolargo/glances/issues/622
logger.debug("Cannot get TIME+ ({})".format(e))
self.tag_proc_time = False

View File

@ -21,7 +21,7 @@ import operator
import os
from glances.compat import iteritems, itervalues, listitems
from glances.globals import BSD, LINUX, OSX, SUNOS, WINDOWS
from glances.globals import BSD, LINUX, MACOS, SUNOS, WINDOWS
from glances.timer import Timer, getTimeSinceLastUpdate
from glances.processes_tree import ProcessTreeNode
from glances.filter import GlancesFilter
@ -279,7 +279,7 @@ class GlancesProcesses(object):
# If io_tag = 0 > Access denied (display "?")
# If io_tag = 1 > No access denied (display the IO rate)
# Availability: all platforms except macOS and Illumos/Solaris
if not (OSX or SUNOS):
if not (MACOS or SUNOS):
try:
# Get the process IO counters
proc_io = proc.io_counters()
@ -428,12 +428,12 @@ class GlancesProcesses(object):
standard_stats=self.max_processes is None)
# Check if s is note None (issue #879)
# ignore the 'idle' process on Windows and *BSD
# ignore the 'kernel_task' process on OS X
# ignore the 'kernel_task' process on macOS
# waiting for upstream patch from psutil
if (s is None or
BSD and s['name'] == 'idle' or
WINDOWS and s['name'] == 'System Idle Process' or
OSX and s['name'] == 'kernel_task'):
MACOS and s['name'] == 'kernel_task'):
continue
# Continue to the next process if it has to be filtered
if self._filter.is_filtered(s):