Updates the embedded version of psutil to one that supports Solaris. Not appropriate for upstream --- mozjs-24.2.0/python/psutil/.travis.yml 1969-12-31 16:00:00.000000000 -0800 +++ mozjs-24.2.0/python/psutil/.travis.yml 2015-06-17 19:33:33.000000000 -0700 @@ -0,0 +1,25 @@ +language: python +python: + - 2.6 + - 2.7 + - 3.2 + - 3.3 + - 3.4 + # - pypy +install: + - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install -U ipaddress unittest2 mock; fi + - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install -U ipaddress mock; fi + - if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then pip install -U ipaddress mock; fi + - if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then pip install -U ipaddress; fi +script: + - pip install flake8 pep8 + - python setup.py build + - python setup.py install + - python test/test_psutil.py + - python test/test_memory_leaks.py + - flake8 + - pep8 +os: + - linux + - osx + --- mozjs-24.2.0/js/src/python/psutil/examples/ifconfig.py 1969-12-31 16:00:00.000000000 -0800 +++ mozjs-24.2.0/js/src/python/psutil/examples/ifconfig.py 2015-06-17 19:33:33.000000000 -0700 @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +A clone of 'ifconfig' on UNIX. + +$ python examples/ifconfig.py +lo (speed=0MB, duplex=?, mtu=65536, up=yes): + IPv4 address : 127.0.0.1 + broadcast : 127.0.0.1 + netmask : 255.0.0.0 + IPv6 address : ::1 + netmask : ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff + MAC address : 00:00:00:00:00:00 + broadcast : 00:00:00:00:00:00 + +wlan0 (speed=0MB, duplex=?, mtu=1500, up=yes): + IPv4 address : 10.0.3.1 + broadcast : 10.0.3.255 + netmask : 255.255.255.0 + IPv6 address : fe80::3005:adff:fe31:8698 + netmask : ffff:ffff:ffff:ffff:: + MAC address : 32:05:ad:31:86:98 + broadcast : ff:ff:ff:ff:ff:ff + +eth0 (speed=100MB, duplex=full, mtu=1500, up=yes): + IPv4 address : 192.168.1.2 + broadcast : 192.168.1.255 + netmask : 255.255.255.0 + IPv6 address : fe80::c685:8ff:fe45:641 + netmask : ffff:ffff:ffff:ffff:: + MAC address : c4:85:08:45:06:41 + broadcast : ff:ff:ff:ff:ff:ff +""" + +from __future__ import print_function +import socket + +import psutil + + +af_map = { + socket.AF_INET: 'IPv4', + socket.AF_INET6: 'IPv6', + psutil.AF_LINK: 'MAC', +} + +duplex_map = { + psutil.NIC_DUPLEX_FULL: "full", + psutil.NIC_DUPLEX_HALF: "half", + psutil.NIC_DUPLEX_UNKNOWN: "?", +} + + +def main(): + stats = psutil.net_if_stats() + for nic, addrs in psutil.net_if_addrs().items(): + if nic in stats: + print("%s (speed=%sMB, duplex=%s, mtu=%s, up=%s):" % ( + nic, stats[nic].speed, duplex_map[stats[nic].duplex], + stats[nic].mtu, "yes" if stats[nic].isup else "no")) + else: + print("%s:" % (nic)) + for addr in addrs: + print(" %-8s" % af_map.get(addr.family, addr.family), end="") + print(" address : %s" % addr.address) + if addr.broadcast: + print(" broadcast : %s" % addr.broadcast) + if addr.netmask: + print(" netmask : %s" % addr.netmask) + print("") + + +if __name__ == '__main__': + main() --- mozjs-24.2.0/python/psutil/examples/pstree.py 1969-12-31 16:00:00.000000000 -0800 +++ mozjs-24.2.0/python/psutil/examples/pstree.py 2015-06-17 19:33:33.000000000 -0700 @@ -0,0 +1,71 @@ +#!/usr/bin/env python + +# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Similar to 'ps aux --forest' on Linux, prints the process list +as a tree structure. + +$ python examples/pstree.py +0 ? +|- 1 init +| |- 289 cgmanager +| |- 616 upstart-socket-bridge +| |- 628 rpcbind +| |- 892 upstart-file-bridge +| |- 907 dbus-daemon +| |- 978 avahi-daemon +| | `_ 979 avahi-daemon +| |- 987 NetworkManager +| | |- 2242 dnsmasq +| | `_ 10699 dhclient +| |- 993 polkitd +| |- 1061 getty +| |- 1066 su +| | `_ 1190 salt-minion... +... +""" + +from __future__ import print_function +import collections +import sys + +import psutil + + +def print_tree(parent, tree, indent=''): + try: + name = psutil.Process(parent).name() + except psutil.Error: + name = "?" + print(parent, name) + if parent not in tree: + return + children = tree[parent][:-1] + for child in children: + sys.stdout.write(indent + "|- ") + print_tree(child, tree, indent + "| ") + child = tree[parent][-1] + sys.stdout.write(indent + "`_ ") + print_tree(child, tree, indent + " ") + + +def main(): + # construct a dict where 'values' are all the processes + # having 'key' as their parent + tree = collections.defaultdict(list) + for p in psutil.process_iter(): + try: + tree[p.ppid()].append(p.pid) + except (psutil.NoSuchProcess, psutil.ZombieProcess): + pass + # on systems supporting PID 0, PID 0's parent is usually 0 + if 0 in tree and 0 in tree[0]: + tree[0].remove(0) + print_tree(min(tree), tree) + + +if __name__ == '__main__': + main()