Skip to content

Commit

Permalink
Merge branch 'pslisten' of github.com:nlevitt/psutil into pslisten
Browse files Browse the repository at this point in the history
* 'pslisten' of github.com:nlevitt/psutil: (922 commits)
  Update INSTALL.rst
  Pass python_requires argument to setuptools (giampaolo#1208)
  giampaolo#1152: fix doc to mention CLI command necessary to enable disk_io_counters() on win
  pre release
  pre release
  pre release
  pre-release
  fix giampaolo#1201: document that timeout kwarg is expressed in seconds
  Add mount points to disk_partitions() in Windows (giampaolo#775) (giampaolo#1192)
  add test for cpu_affinity
  what a stupid bug! (giampaolo#1190)
  update doc
  pre release
  pre-release; also get rid of PSUTIL_DEBUG doc instructions (it's kinda useless for the user after all)
  Use FutureWarning instead of DeprecationWarning (giampaolo#1188)
  fix test
  refactor environ() test
  Fix OSX pid 0 bug (giampaolo#1187)
  change assert in test
  refactor Process.__repr__
  Faster Process.children(recursive=True) (giampaolo#1186)
  Speedup Process.children()  (giampaolo#1185)
  update doc
  update HISTORY
  fix giampaolo#1179 / linux / cmdline: handle processes erroneously overwriting /proc/pid/cmdline by using spaces instead of null bytes as args separator
  set x bit to test_aix.py
  fix giampaolo#1181: raise AD if task_for_pid() fails with 5 and errno == ENOENT
  fix posix failure
  Arguments for NoSuchProcess and AccessDenied for the C ext (giampaolo#1180)
  fix travis failure https://travis-ci.org/giampaolo/psutil/jobs/306424509
  be smarter in searching python exe
  do not test platf specific modules on wheelhouse
  try to fix travis failure
  fix travis failures
  try to use PYTHON_EXE instead of sys.executable
  giampaolo#1177: give credits to @wiggin15
  OSX: implement sensors_battery (giampaolo#1177)
  improve error msg for old windows systems giampaolo#811
  add debug messages
  do not mention apt-get as method of installation as it's not recommended
  syntax highlight in doc files
  syntax highlight in doc files
  fix doc indentation
  1173 debug mode (giampaolo#1176)
  code style
  update MANIFEST
  giampaolo#1174: use TimeoutExpired in wait_pid()
  sort imports by name
  Move exceptions to separate file (giampaolo#1174)
  appveyor: enable python warnings when running tests
  refactor winmake.py
  use a C global variable to figure out whether we're in testing mode
  fix unicode err
  define a setup() function which is called on import by all C modules
  move PyUnicode compt fun definition up in the file
  rename C func
  re-enable test on appveyor; remove unused C code
  refactor PSUTIL_TESTING C APIs
  inspect PSUTIL_TESTING env var from C again
  giampaolo#1152: (DeviceIOControl), skip disk on ERROR_INVALID_FUNCTION and ERROR_NOT_SUPPORTED
  giampaolo#1152 / win / disk_io_counters(): DeviceIOControl errors were ignored; che return value and retry call on ERROR_INSUFFICIENT_BUFFER
  upgrade dist cmds
  change make cmds
  disable IPv6 tests if IPv6 is not supported
  travis / OSX: run py 3.6 instead of 3.4
  fix giampaolo#1169: (Linux) users() hostname returns username instead
  update README, bump up version
  get rid of PSUTIL_TESTING env var: it must be necessarily set from cmdline, hence 'python -m psutil.tests' won't work out of the box
  try to set PSUTIL_TESTING env var from python before failing
  skip cpu_freq tests if not available (giampaolo#1170)
  update doc
  pre-release
  giampaolo#1053: drop python 3.3 support
  try to fix appveyor failure; also refactor generate_manifest.py
  giampaolo#1167 give CREDITS to @matray
  Including non-unicast packets in packet count calculation (giampaolo#1167)
  fix giampaolo#1166 (doc mistake)
  provide a 'make help' command
  ifconfig.py humanize bytes
  try to limit false positives on appveyor/windows
  reap_children() in a finally block in order to limit false positives
  unicode tests: use different name for test dir
  fix failure on osx/travis
  update Makefile
  fix test
  giampaolo#1164 give CREDITS to @wiggin15
  AIX: implement num_ctx_switches (giampaolo#1164)
  use new PYTHON_EXE
  improve logic to determine python exe location
  add DEVNOTES file; move TODO.aix into _psutil_aix.c
  Fix test_emulate_energy_full_not_avail (giampaolo#1163)
  update README
  try to limit occasional appveyor failure
  Remove trove classifiers for untested and unsupported platforms (giampaolo#1162)
  Fix giampaolo#1154: remove 'threads' method on older AIX (giampaolo#1156)
  give CREDITS to @adpag for giampaolo#1159, giampaolo#1160 and giampaolo#1161
  Fix test asserts due to leftover test subprocesses (giampaolo#1161)
  Fix network tests for newer ifconfig versions. (giampaolo#1160)
  Fix pre-commit hook for python 3.x. (giampaolo#1159)
  revert last commit
  ...
  • Loading branch information
nlevitt committed Jan 30, 2019
2 parents d734e7c + f92f3bc commit 10a6f5a
Show file tree
Hide file tree
Showing 119 changed files with 17,110 additions and 5,448 deletions.
11 changes: 6 additions & 5 deletions .ci/travis/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
fi

# install psutil
make clean
python setup.py build
python setup.py develop

# run tests (with coverage)
if [[ "$(uname -s)" != 'Darwin' ]]; then
coverage run psutil/tests/runner.py --include="psutil/*" --omit="test/*,*setup*"
if [[ $PYVER == '2.7' ]] && [[ "$(uname -s)" != 'Darwin' ]]; then
PSUTIL_TESTING=1 python -Wa -m coverage run psutil/tests/__main__.py
else
python psutil/tests/runner.py
PSUTIL_TESTING=1 python -Wa psutil/tests/__main__.py
fi

if [ "$PYVER" == "2.7" ] || [ "$PYVER" == "3.5" ]; then
if [ "$PYVER" == "2.7" ] || [ "$PYVER" == "3.6" ]; then
# run mem leaks test
python psutil/tests/test_memory_leaks.py
PSUTIL_TESTING=1 python -Wa psutil/tests/test_memory_leaks.py
# run linter (on Linux only)
if [[ "$(uname -s)" != 'Darwin' ]]; then
python -m flake8
Expand Down
35 changes: 17 additions & 18 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,31 @@

include =
*psutil*

omit =
psutil/_compat.py
psutil/tests/*
setup.py
psutil/_compat.py

exclude_lines =
pragma: no cover
if PY3:
enum.IntEnum
except ImportError:
globals().update
if __name__ == .__main__.:
if sys.platform.startswith
if _WINDOWS:
import enum
if enum is not None:
if BSD
if enum is None:
if enum is not None:
if FREEBSD
if has_enums:
if LINUX
if LITTLE_ENDIAN:
enum.IntEnum
except ImportError:
raise NotImplementedError
if WINDOWS
if OSX
if BSD
if FREEBSD
if OPENBSD
if NETBSD
if SUNOS
if LINUX
if OPENBSD
if OSX
if ppid_map is None:
if PY3:
if SUNOS
if sys.platform.startswith
if WINDOWS
import enum
pragma: no cover
raise NotImplementedError
56 changes: 40 additions & 16 deletions .git-pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@

"""
This gets executed on 'git commit' and rejects the commit in case the
submitted code does not pass validation.
Install it with "make install-git-hooks".
submitted code does not pass validation. Validation is run only against
the *.py files which were modified in the commit. Checks:
- assert no space at EOLs
- assert not pdb.set_trace in code
- assert no bare except clause ("except:") in code
- assert "flake8" returns no warnings
Install this with "make install-git-hooks".
"""

from __future__ import print_function
Expand All @@ -30,6 +37,8 @@ def term_supports_colors():

def hilite(s, ok=True, bold=False):
"""Return an highlighted version of 'string'."""
if not term_supports_colors():
return s
attr = []
if ok is None: # no color
pass
Expand All @@ -43,34 +52,49 @@ def hilite(s, ok=True, bold=False):


def exit(msg):
if term_supports_colors():
msg = hilite(msg, ok=False)
msg = hilite(msg, ok=False)
print(msg, file=sys.stderr)
sys.exit(1)


def sh(cmd):
"""run cmd in a subprocess and return its output.
raises RuntimeError on error.
"""
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, universal_newlines=True)
stdout, stderr = p.communicate()
if p.returncode != 0:
raise RuntimeError(stderr)
if stderr:
print(stderr, file=sys.stderr)
if stdout.endswith('\n'):
stdout = stdout[:-1]
return stdout


def main():
out = subprocess.check_output("git diff --cached --name-only", shell=True)
py_files = [x for x in out.split(b'\n') if x.endswith(b'.py') and
out = sh("git diff --cached --name-only")
py_files = [x for x in out.split('\n') if x.endswith('.py') and
os.path.exists(x)]

lineno = 0
for path in py_files:
with open(path) as f:
data = f.read()

# pdb
if "pdb.set_trace" in data:
for lineno, line in enumerate(data.split('\n'), 1):
for line in f:
lineno += 1
# space at end of line
if line.endswith(' '):
print("%s:%s %r" % (path, lineno, line))
return exit(
"commit aborted: space at end of line")
line = line.rstrip()
# pdb
if "pdb.set_trace" in line:
print("%s:%s %s" % (path, lineno, line))
return exit(
"commit aborted: you forgot a pdb in your python code")

# bare except clause
if "except:" in data:
for lineno, line in enumerate(data.split('\n'), 1):
line = line.rstrip()
# bare except clause
if "except:" in line and not line.endswith("# NOQA"):
print("%s:%s %s" % (path, lineno, line))
return exit("commit aborted: bare except clause")
Expand Down
21 changes: 5 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,26 @@ language: python
cache: pip
matrix:
include:
# Linux
- python: 2.6
- python: 2.7
- python: 3.3
- python: 3.4
- python: 3.5
- "pypy"
# XXX - commented because OSX builds are deadly slow
# - language: generic
# os: osx
# env: PYVER=py26
- python: 3.6
# OSX
- language: generic
os: osx
env: PYVER=py27
# XXX - commented because OSX builds are deadly slow
# - language: generic
# os: osx
# env: PYVER=py33
- language: generic
os: osx
env: PYVER=py34
# XXX - not supported yet
# - language: generic
# os: osx
# env: PYVER=py35
install:
- ./.ci/travis/install.sh
script:
- ./.ci/travis/run.sh
after_success:
# upload reports to coveralls.io
- |
if [ "$(uname -s)" != 'Darwin' ]; then
if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]] && [[ "$(uname -s)" != 'Darwin' ]]; then
echo "sending test coverage results to coveralls.io"
coveralls
fi
109 changes: 102 additions & 7 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,32 @@ C: Italy
E: [email protected]
W: http://grodola.blogspot.com/

Experts
=======

Github usernames of people to CC on github when in need of help.

- NetBSD:
- 0-wiz-0, Thomas Klausner
- ryoqun, Ryo Onodera
- OpenBSD:
- landryb, Landry Breuil
- FreeBSD:
- glebius, Gleb Smirnoff (#1013)
- sunpoet, Po-Chuan Hsieh (pkg maintainer, #1105)
- kostikbel, Konstantin Belousov (#1105)
- OSX:
- whitlockjc, Jeremy Whitlock
- Windows:
- mrjefftang, Jeff Tang
- wj32, Wen Jia Liu
- fbenkstein, Frank Benkstein
- SunOS:
- wiggin15, Arnon Yaari
- alxchk, Oleksii Shevchuk
- AIX:
- wiggin15, Arnon Yaari (maintainer)

Contributors
============

Expand All @@ -29,6 +55,10 @@ E: [email protected]
D: original co-author, initial design/bootstrap and occasional bug fixes
W: http://www.jayloden.com

N: Arnon Yaari (wiggin15)
W: https://github.com/wiggin15
I: 517, 607, 610, 1131, 1123, 1130, 1154, 1164, 1174, 1177

N: Jeff Tang
W: https://github.com/mrjefftang
I: 340, 529, 616, 653, 654, 648, 641
Expand Down Expand Up @@ -339,10 +369,6 @@ N: maozguttman
W: https://github.com/maozguttman
I: 659

N: wiggin15
W: https://github.com/wiggin15
I: 517, 607, 610

N: dasumin
W: https://github.com/dasumin
I: 541
Expand Down Expand Up @@ -388,8 +414,8 @@ E: [email protected]
I: 823

N: Jake Omann
E: https://github.com/jhomann
I: 816
E: https://github.com/jomann09
I: 816, 775

N: Jeremy Humble
W: https://github.com/jhumble
Expand Down Expand Up @@ -419,4 +445,73 @@ I: 919

N: Max Bélanger
W: https://github.com/maxbelanger
I: 936
I: 936, 1133

N: Pierre Fersing
C: France
E: [email protected]
I: 950

N: Thiago Borges Abdnur
W: https://github.com/bolaum
I: 959

N: Nicolas Hennion
W: https://github.com/nicolargo
I: 974

N: Baruch Siach
W: https://github.com/baruchsiach
I: 872

N: Danek Duvall
W: https://github.com/dhduvall
I: 1002

N: Alexander Hasselhuhn
C: Germany
W: https://github.com/alexanha

N: Himanshu Shekhar
W: https://github.com/himanshub16
I: 1036

N: Yannick Gingras
W: https://github.com/ygingras
I: 1057

N: Gleb Smirnoff
W: https://github.com/glebius
I: 1042, 1079

N: Oleksii Shevchuk
W: https://github.com/alxchk
I: 1077, 1093, 1091

N: Prodesire
W: https://github.com/Prodesire
I: 1138

N: Sebastian Saip
W: https://github.com/ssaip
I: 1141

N: Jakub Bacic
W: https://github.com/jakub-bacic
I: 1127

N: Akos Kiss
W: https://github.com/akosthekiss
I: 1150

N: Adrian Page
W: https://github.com/adpag
I: 1159, 1160, 1161

N: Matthew Long
W: https://github.com/matray
I: 1167

N: janderbrain
W: https://github.com/janderbrain
I: 1169
Loading

0 comments on commit 10a6f5a

Please sign in to comment.