diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-02-09 12:30:45 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-02-09 12:30:45 +0100 |
commit | 4b78815e7bd1354daa34d56e2b12276836b7cdf9 (patch) | |
tree | d79f771fcfbc251c87a1ccc60e129cdf3adfe7ae | |
parent | ab9f29bd2689ac9623e5ac078c880c2fae7743f3 (diff) | |
download | psutil-4b78815e7bd1354daa34d56e2b12276836b7cdf9.tar.gz |
rename 'examples' dir to 'scripts'
-rw-r--r-- | HISTORY.rst | 3 | ||||
-rw-r--r-- | MANIFEST.in | 2 | ||||
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | docs/index.rst | 38 | ||||
-rw-r--r-- | psutil/__init__.py | 2 | ||||
-rw-r--r-- | psutil/tests/__init__.py | 2 | ||||
-rw-r--r-- | psutil/tests/test_misc.py | 18 | ||||
-rwxr-xr-x | scripts/disk_usage.py (renamed from examples/disk_usage.py) | 2 | ||||
-rwxr-xr-x | scripts/free.py (renamed from examples/free.py) | 2 | ||||
-rwxr-xr-x | scripts/ifconfig.py (renamed from examples/ifconfig.py) | 2 | ||||
-rwxr-xr-x | scripts/iotop.py (renamed from examples/iotop.py) | 2 | ||||
-rwxr-xr-x | scripts/killall.py (renamed from examples/killall.py) | 0 | ||||
-rwxr-xr-x | scripts/meminfo.py (renamed from examples/meminfo.py) | 2 | ||||
-rwxr-xr-x | scripts/netstat.py (renamed from examples/netstat.py) | 2 | ||||
-rwxr-xr-x | scripts/nettop.py (renamed from examples/nettop.py) | 2 | ||||
-rwxr-xr-x | scripts/pidof.py (renamed from examples/pidof.py) | 0 | ||||
-rwxr-xr-x | scripts/pmap.py (renamed from examples/pmap.py) | 2 | ||||
-rwxr-xr-x | scripts/process_detail.py (renamed from examples/process_detail.py) | 4 | ||||
-rwxr-xr-x | scripts/ps.py (renamed from examples/ps.py) | 2 | ||||
-rwxr-xr-x | scripts/pstree.py (renamed from examples/pstree.py) | 2 | ||||
-rwxr-xr-x | scripts/top.py (renamed from examples/top.py) | 2 | ||||
-rwxr-xr-x | scripts/who.py (renamed from examples/who.py) | 2 |
22 files changed, 49 insertions, 48 deletions
diff --git a/HISTORY.rst b/HISTORY.rst index d03ed4df..1b1cf7e1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,6 @@ Bug tracker at https://github.com/giampaolo/psutil/issues -3.5.0 - XXXX-XX-XX +4.0.0 - XXXX-XX-XX ================== **Enhancements** @@ -28,6 +28,7 @@ Bug tracker at https://github.com/giampaolo/psutil/issues - #751: [Linux] fixed call to Py_DECREF on possible Null object. - #754: [Linux] cmdline() can be wrong in case of zombie process. - #759: [Linux] Process.memory_maps() may return paths ending with " (deleted)" +- #761: [Windows] psutil.boot_time() wraps to 0 after 49 days. 3.4.2 - 2016-01-20 diff --git a/MANIFEST.in b/MANIFEST.in index 9753c6c6..ee26657b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -18,5 +18,5 @@ include tox.ini recursive-exclude docs/_build * recursive-include .ci * recursive-include docs * -recursive-include examples *.py +recursive-include scripts *.py *.rst *README recursive-include psutil *.py *.c *.h README* @@ -50,7 +50,7 @@ HIGHER PRIORITY LOWER PRIORITY ============== - * examples/taskmgr-gui.py (using tk). + * scripts/taskmgr-gui.py (using tk). * system-wide number of open file descriptors: * https://jira.hyperic.com/browse/SIGAR-30 @@ -78,7 +78,7 @@ DEBATABLE Process.children() and exposed as a first class function. PROS: on Windows we can take advantage of _psutil_windows.ppid_map() which is faster than iterating over all pids and calling ppid(). - CONS: examples/pstree.py shows this can be easily done in the user code + CONS: scripts/pstree.py shows this can be easily done in the user code so maybe it's not worth the addition. * advanced cmdline interface exposing the whole API and providing different diff --git a/docs/index.rst b/docs/index.rst index 354c64a6..719aacc3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -179,7 +179,7 @@ Memory The sum of **used** and **available** does not necessarily equal **total**. On Windows **available** and **free** are the same. - See `examples/meminfo.py <https://github.com/giampaolo/psutil/blob/master/examples/meminfo.py>`__ + See `scripts/meminfo.py <https://github.com/giampaolo/psutil/blob/master/scripts/meminfo.py>`__ script providing an example on how to convert bytes in a human readable form. >>> import psutil @@ -209,7 +209,7 @@ Memory (cumulative) **sin** and **sout** on Windows are always set to ``0``. - See `examples/meminfo.py <https://github.com/giampaolo/psutil/blob/master/examples/meminfo.py>`__ + See `scripts/meminfo.py <https://github.com/giampaolo/psutil/blob/master/scripts/meminfo.py>`__ script providing an example on how to convert bytes in a human readable form. >>> import psutil @@ -235,7 +235,7 @@ Disks and can be either ``"removable"``, ``"fixed"``, ``"remote"``, ``"cdrom"``, ``"unmounted"`` or ``"ramdisk"``. On OSX and BSD it is retrieved via `getfsstat(2) <http://www.manpagez.com/man/2/getfsstat/>`__. See - `disk_usage.py <https://github.com/giampaolo/psutil/blob/master/examples/disk_usage.py>`__ + `disk_usage.py <https://github.com/giampaolo/psutil/blob/master/scripts/disk_usage.py>`__ script providing an example usage. >>> import psutil @@ -250,13 +250,13 @@ Disks **percentage** usage. `OSError <http://docs.python.org/3/library/exceptions.html#OSError>`__ is raised if *path* does not exist. See - `examples/disk_usage.py <https://github.com/giampaolo/psutil/blob/master/examples/disk_usage.py>`__ + `scripts/disk_usage.py <https://github.com/giampaolo/psutil/blob/master/scripts/disk_usage.py>`__ script providing an example usage. Starting from `Python 3.3 <http://bugs.python.org/issue12442>`__ this is also available as `shutil.disk_usage() <http://docs.python.org/3/library/shutil.html#shutil.disk_usage>`__. See - `disk_usage.py <https://github.com/giampaolo/psutil/blob/master/examples/disk_usage.py>`__ + `disk_usage.py <https://github.com/giampaolo/psutil/blob/master/scripts/disk_usage.py>`__ script providing an example usage. >>> import psutil @@ -278,7 +278,7 @@ Disks If *perdisk* is ``True`` return the same information for every physical disk installed on the system as a dictionary with partition names as the keys and the namedtuple described above as the values. - See `examples/iotop.py <https://github.com/giampaolo/psutil/blob/master/examples/iotop.py>`__ + See `scripts/iotop.py <https://github.com/giampaolo/psutil/blob/master/scripts/iotop.py>`__ for an example application. >>> import psutil @@ -311,7 +311,7 @@ Network If *pernic* is ``True`` return the same information for every network interface installed on the system as a dictionary with network interface names as the keys and the namedtuple described above as the values. - See `examples/nettop.py <https://github.com/giampaolo/psutil/blob/master/examples/nettop.py>`__ + See `scripts/nettop.py <https://github.com/giampaolo/psutil/blob/master/scripts/nettop.py>`__ for an example application. >>> import psutil @@ -389,7 +389,7 @@ Network On OSX this function requires root privileges. To get per-process connections use :meth:`Process.connections`. Also, see - `netstat.py sample script <https://github.com/giampaolo/psutil/blob/master/examples/netstat.py>`__. + `netstat.py sample script <https://github.com/giampaolo/psutil/blob/master/scripts/netstat.py>`__. Example: >>> import psutil @@ -443,7 +443,7 @@ Network snic(family=<AddressFamily.AF_LINK: 17>, address='c4:85:08:45:06:41', netmask=None, broadcast='ff:ff:ff:ff:ff:ff', ptp=None)]} >>> - See also `examples/ifconfig.py <https://github.com/giampaolo/psutil/blob/master/examples/ifconfig.py>`__ + See also `scripts/ifconfig.py <https://github.com/giampaolo/psutil/blob/master/scripts/ifconfig.py>`__ for an example application. .. note:: if you're interested in others families (e.g. AF_BLUETOOTH) you can @@ -476,7 +476,7 @@ Network :const:`NIC_DUPLEX_UNKNOWN`, *speed* is the NIC speed expressed in mega bits (MB), if it can't be determined (e.g. 'localhost') it will be set to ``0``, *mtu* is the maximum transmission unit expressed in bytes. - See also `examples/ifconfig.py <https://github.com/giampaolo/psutil/blob/master/examples/ifconfig.py>`__ + See also `scripts/ifconfig.py <https://github.com/giampaolo/psutil/blob/master/scripts/ifconfig.py>`__ for an example application. Example: @@ -700,7 +700,7 @@ Process class Availability: Linux, OSX, Windows - .. versionadded:: 3.5.0 + .. versionadded:: 4.0.0 .. method:: create_time() @@ -756,7 +756,7 @@ Process class .. method:: uids() - The **real**, **effective** and **saved** user ids of this process as a + The real, effective and saved user ids of this process as a namedtuple. This is the same as `os.getresuid() <http://docs.python.org//library/os.html#os.getresuid>`__ but can be used for any process PID. @@ -765,7 +765,7 @@ Process class .. method:: gids() - The **real**, **effective** and **saved** group ids of this process as a + The real, effective and saved group ids of this process as a namedtuple. This is the same as `os.getresgid() <http://docs.python.org//library/os.html#os.getresgid>`__ but can be used for any process PID. @@ -1052,14 +1052,14 @@ Process class >>> p.memory_info() pmem(rss=15491072, vms=84025344, shared=5206016, text=2555904, lib=0, data=9891840, dirty=0) - .. versionchanged:: 3.5.0 mutiple fields are returned, not only `rss` and + .. versionchanged:: 4.0.0 mutiple fields are returned, not only `rss` and `vms`. .. method:: memory_info_ex() Same as :meth:`memory_info` (deprecated). - .. warning:: depcreated in version 3.5.0; use :meth:`memory_info` instead. + .. warning:: depcreated in version 4.0.0; use :meth:`memory_info` instead. .. method:: memory_addrspace_info() @@ -1095,7 +1095,7 @@ Process class paddrspmem(uss=7421952, pss=7681024, swap=0) >>> - .. versionadded:: 3.5.0 + .. versionadded:: 4.0.0 Availability: Linux, OSX, Windows @@ -1108,7 +1108,7 @@ Process class names returned by :meth:`memory_info` and :meth:`memory_addrspace_info` (defaults to ``"rss"``). - .. versionchanged:: 3.5.0 added `memtype` parameter. + .. versionchanged:: 4.0.0 added `memtype` parameter. .. method:: memory_maps(grouped=True) @@ -1123,7 +1123,7 @@ Process class is ``False`` each mapped region is shown as a single entity and the namedtuple will also include the mapped region's address space (*addr*) and permission set (*perms*). - See `examples/pmap.py <https://github.com/giampaolo/psutil/blob/master/examples/pmap.py>`__ + See `scripts/pmap.py <https://github.com/giampaolo/psutil/blob/master/scripts/pmap.py>`__ for an example application. +---------------+--------------+---------+-----------+--------------+ @@ -1414,7 +1414,7 @@ Constants ``bool`` constants which define what platform you're on. E.g. if on Windows, *WINDOWS* constant will be ``True``, all athers will be ``False``. - .. versionadded:: 3.5.0 + .. versionadded:: 4.0.0 .. _const-procfs_path: .. data:: PROCFS_PATH diff --git a/psutil/__init__.py b/psutil/__init__.py index 4f1bc8c4..169a5e8b 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -186,7 +186,7 @@ __all__ = [ ] __all__.extend(_psplatform.__extra__all__) __author__ = "Giampaolo Rodola'" -__version__ = "3.5.0" +__version__ = "4.0.0" version_info = tuple([int(num) for num in __version__.split('.')]) AF_LINK = _psplatform.AF_LINK _TOTAL_PHYMEM = None diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index 95dcf202..ebce7e7f 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -90,7 +90,7 @@ if not PY3: ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) -EXAMPLES_DIR = os.path.join(ROOT_DIR, 'examples') +SCRIPTS_DIR = os.path.join(ROOT_DIR, 'scripts') WIN_VISTA = (6, 0, 0) if WINDOWS else None VALID_PROC_STATUSES = [getattr(psutil, x) for x in dir(psutil) diff --git a/psutil/tests/test_misc.py b/psutil/tests/test_misc.py index 2126b4bf..93e339d0 100644 --- a/psutil/tests/test_misc.py +++ b/psutil/tests/test_misc.py @@ -22,7 +22,7 @@ from psutil import POSIX from psutil import WINDOWS from psutil._common import supports_ipv6 from psutil.tests import APPVEYOR -from psutil.tests import EXAMPLES_DIR +from psutil.tests import SCRIPTS_DIR from psutil.tests import importlib from psutil.tests import mock from psutil.tests import ROOT_DIR @@ -318,11 +318,11 @@ class TestMisc(unittest.TestCase): # =================================================================== @unittest.skipIf(TOX, "can't test on tox") -class TestExampleScripts(unittest.TestCase): - """Tests for scripts in the examples directory.""" +class TestScripts(unittest.TestCase): + """Tests for scripts in the "scripts" directory.""" def assert_stdout(self, exe, args=None): - exe = os.path.join(EXAMPLES_DIR, exe) + exe = os.path.join(SCRIPTS_DIR, exe) if args: exe = exe + ' ' + args try: @@ -336,7 +336,7 @@ class TestExampleScripts(unittest.TestCase): return out def assert_syntax(self, exe, args=None): - exe = os.path.join(EXAMPLES_DIR, exe) + exe = os.path.join(SCRIPTS_DIR, exe) with open(exe, 'r') as f: src = f.read() ast.parse(src) @@ -344,18 +344,18 @@ class TestExampleScripts(unittest.TestCase): def test_check_presence(self): # make sure all example scripts have a test method defined meths = dir(self) - for name in os.listdir(EXAMPLES_DIR): + for name in os.listdir(SCRIPTS_DIR): if name.endswith('.py'): if 'test_' + os.path.splitext(name)[0] not in meths: # self.assert_stdout(name) self.fail('no test defined for %r script' - % os.path.join(EXAMPLES_DIR, name)) + % os.path.join(SCRIPTS_DIR, name)) @unittest.skipUnless(POSIX, "UNIX only") def test_executable(self): - for name in os.listdir(EXAMPLES_DIR): + for name in os.listdir(SCRIPTS_DIR): if name.endswith('.py'): - path = os.path.join(EXAMPLES_DIR, name) + path = os.path.join(SCRIPTS_DIR, name) if not stat.S_IXUSR & os.stat(path)[stat.ST_MODE]: self.fail('%r is not executable' % path) diff --git a/examples/disk_usage.py b/scripts/disk_usage.py index d8600a8c..2bb928c0 100755 --- a/examples/disk_usage.py +++ b/scripts/disk_usage.py @@ -7,7 +7,7 @@ """ List all mounted disk partitions a-la "df -h" command. -$ python examples/disk_usage.py +$ python scripts/disk_usage.py Device Total Used Free Use % Type Mount /dev/sdb3 18.9G 14.7G 3.3G 77% ext4 / /dev/sda6 345.9G 83.8G 244.5G 24% ext4 /home diff --git a/examples/free.py b/scripts/free.py index 913ca58a..897f006f 100755 --- a/examples/free.py +++ b/scripts/free.py @@ -7,7 +7,7 @@ """ A clone of 'free' cmdline utility. -$ python examples/free.py +$ python scripts/free.py total used free shared buffers cache Mem: 10125520 8625996 1499524 0 349500 3307836 Swap: 0 0 0 diff --git a/examples/ifconfig.py b/scripts/ifconfig.py index 1f1ee985..72cc02fe 100755 --- a/examples/ifconfig.py +++ b/scripts/ifconfig.py @@ -7,7 +7,7 @@ """ A clone of 'ifconfig' on UNIX. -$ python examples/ifconfig.py +$ python scripts/ifconfig.py lo (speed=0MB, duplex=?, mtu=65536, up=yes): IPv4 address : 127.0.0.1 broadcast : 127.0.0.1 diff --git a/examples/iotop.py b/scripts/iotop.py index 16ac7fbf..200926ed 100755 --- a/examples/iotop.py +++ b/scripts/iotop.py @@ -14,7 +14,7 @@ It doesn't work on Windows as curses module is required. Example output: -$ python examples/iotop.py +$ python scripts/iotop.py Total DISK READ: 0.00 B/s | Total DISK WRITE: 472.00 K/s PID USER DISK READ DISK WRITE COMMAND 13155 giampao 0.00 B/s 428.00 K/s /usr/bin/google-chrome-beta diff --git a/examples/killall.py b/scripts/killall.py index b548e7bc..b548e7bc 100755 --- a/examples/killall.py +++ b/scripts/killall.py diff --git a/examples/meminfo.py b/scripts/meminfo.py index c463a3de..3546960b 100755 --- a/examples/meminfo.py +++ b/scripts/meminfo.py @@ -7,7 +7,7 @@ """ Print system memory information. -$ python examples/meminfo.py +$ python scripts/meminfo.py MEMORY ------ Total : 9.7G diff --git a/examples/netstat.py b/scripts/netstat.py index 884622e9..a5e171bc 100755 --- a/examples/netstat.py +++ b/scripts/netstat.py @@ -7,7 +7,7 @@ """ A clone of 'netstat -antp' on Linux. -$ python examples/netstat.py +$ python scripts/netstat.py Proto Local address Remote address Status PID Program name tcp 127.0.0.1:48256 127.0.0.1:45884 ESTABLISHED 13646 chrome tcp 127.0.0.1:47073 127.0.0.1:45884 ESTABLISHED 13646 chrome diff --git a/examples/nettop.py b/scripts/nettop.py index 7a8343ee..acfa6500 100755 --- a/examples/nettop.py +++ b/scripts/nettop.py @@ -11,7 +11,7 @@ Shows real-time network statistics. Author: Giampaolo Rodola' <g.rodola@gmail.com> -$ python examples/nettop.py +$ python scripts/nettop.py ----------------------------------------------------------- total bytes: sent: 1.49 G received: 4.82 G total packets: sent: 7338724 received: 8082712 diff --git a/examples/pidof.py b/scripts/pidof.py index 8692a315..8692a315 100755 --- a/examples/pidof.py +++ b/scripts/pidof.py diff --git a/examples/pmap.py b/scripts/pmap.py index 7593777a..f0d53355 100755 --- a/examples/pmap.py +++ b/scripts/pmap.py @@ -8,7 +8,7 @@ A clone of 'pmap' utility on Linux, 'vmmap' on OSX and 'procstat -v' on BSD. Report memory map of a process. -$ python examples/pmap.py 32402 +$ python scripts/pmap.py 32402 pid=32402, name=hg Address RSS Mode Mapping 0000000000400000 1200K r-xp /usr/bin/python2.7 diff --git a/examples/process_detail.py b/scripts/process_detail.py index e20371ae..bbb0b8e4 100755 --- a/examples/process_detail.py +++ b/scripts/process_detail.py @@ -8,12 +8,12 @@ Print detailed information about a process. Author: Giampaolo Rodola' <g.rodola@gmail.com> -$ python examples/process_detail.py +$ python scripts/process_detail.py pid 820 name python exe /usr/bin/python2.7 parent 29613 (bash) -cmdline python examples/process_detail.py +cmdline python scripts/process_detail.py started 2014-41-27 03:41 user giampaolo uids real=1000, effective=1000, saved=1000 diff --git a/examples/ps.py b/scripts/ps.py index 2b67bd18..9143a557 100755 --- a/examples/ps.py +++ b/scripts/ps.py @@ -7,7 +7,7 @@ """ A clone of 'ps -aux' on UNIX. -$ python examples/ps.py +$ python scripts/ps.py ... """ diff --git a/examples/pstree.py b/scripts/pstree.py index 1bf8c9c0..8e4c9f95 100755 --- a/examples/pstree.py +++ b/scripts/pstree.py @@ -8,7 +8,7 @@ Similar to 'ps aux --forest' on Linux, prints the process list as a tree structure. -$ python examples/pstree.py +$ python scripts/pstree.py 0 ? |- 1 init | |- 289 cgmanager diff --git a/examples/top.py b/scripts/top.py index 4807439c..e172a306 100755 --- a/examples/top.py +++ b/scripts/top.py @@ -9,7 +9,7 @@ A clone of top / htop. Author: Giampaolo Rodola' <g.rodola@gmail.com> -$ python examples/top.py +$ python scripts/top.py CPU0 [| ] 4.9% CPU1 [||| ] 7.8% CPU2 [ ] 2.0% diff --git a/examples/who.py b/scripts/who.py index b382bebf..f64c0093 100755 --- a/examples/who.py +++ b/scripts/who.py @@ -8,7 +8,7 @@ A clone of 'who' command; print information about users who are currently logged in. -$ python examples/who.py +$ python scripts/who.py giampaolo tty7 2014-02-23 17:25 (:0) giampaolo pts/7 2014-02-24 18:25 (:192.168.1.56) giampaolo pts/8 2014-02-24 18:25 (:0) |