Skip to content

Commit

Permalink
Merge branch 'master' into pslisten
Browse files Browse the repository at this point in the history
* master: (375 commits)
  update psutil
  fix procsmem script which was not printing processes
  try to fix tests on travis
  try to fix tests on travis
  OSX: fix compilation warning
  giampaolo#936: give credits to Max Bélanger
  giampaolo#811: move DLL check logic in _pswindows.py
  winmake: use the right win slashes
  winmake: do not try to install GIT commit hook if this is not a GIT cloned dir
  giampaolo#811: on Win XP let the possibility to install psutil from sources as it still (kind of) works)
  giampaolo#811: add a Q&A section in the doc; tell what Win versions are supported
  giampaolo#811: raise a meaningful error message if on Windows XP
  update doc; bump up version
  giampaolo#939: update MANIFEST to include only src files and not much else
  update HISTORY
  travis: execute mem leaks and flake8 tests only on py 2.7 and 3.5; no need to test all python versions
  bump up version
  update version in doc
  add simple test case for oneshot() ctx manager
  add simple test case for oneshot() ctx manager
  speedup fetch all process test by using oneshot
  giampaolo#799 - oneshot / linux: speedup memory_full_info and memory_maps
  fix flake8
  first pass
  giampaolo#943: better error message in case of version conflict on import.
  update doc
  799 onshot / win: no longer store the handle in python; I am now sure this is slower than using OpenProcess/CloseHandle in C
  update doc
  (win) add memleak test for proc_info()
  move stuff around
  memleak: fix false positive on windows
  giampaolo#933 (win) fix memory leak in WindowsService.description()
  giampaolo#933 (win) fix memory leak in cpu_stats() (missing free())
  refactoring
  giampaolo#799 / win: pass handle also to memory_maps() and username() functions
  fix numbers
  mem leak script: provide better error output in case of failure
  refactor memleak script
  refactor memleak script
  refactor memleak script
  refactor memleak script
  refactor memleak script: get rid of no longer used logic to deal with Process properties
  memleak script refactoring
  doc styling
  giampaolo#799 / win: use oneshot() around num_threads() and num_ctx_switches(); speedup from 1.2x to 1.8x
  refactor windows tests
  win: enable dueal process impl tests
  win / C: refactor memory_info_2 code() and return it along side other proc_info() metrics
  windows c refactor proc_info() code
  update windmake script
  winmake clean: make it an order of magnitude faster; also update Makefile
  update doc
  bench script: add psutil ver
  winmake: more aggressive logic to uninstall psutil
  adjust bench2 script to new perf API
  try to adjust perf
  upgrade perf code
  memory leak script: humanize memory difference in case of failure
  style changes
  fix giampaolo#932 / netbsd: check connections return value and raise exception
  netbsd / connections: refactoring
  netbsd / connections: refactoring
  netbsd / connections: refactoring
  netbsd / connections: refactoring
  netbsd / connections: refactoring
  testing make clean with unittests was a bad idea after all
  make 'make clean' 4x faster!
  add test for make clean
  adjust winmake script
  fix netbsd/openvsd compilation failure
  bsd: fix mem leak
  osx: fix memory leak
  pre-release
  refactoring
  update IDEAS
  add mtu test for osx and bsd
  osx: separate IFFLAGS function
  osx/bsd: separate IFFLAGS function
  linux: separate IFFLAGS function
  share C function to retrieve MTU across all UNIXes
  HISTORY: make anchors more easily referenceable
  fix giampaolo#927: Popen.__del__ may cause maximum recursion depth error.
  fix Popen test which is occasionally failing
  more releases timeline from README to doc
  ignore failing tests on OSX + TRAVIS
  update INSTALL instructions
  update print_announce.py script
  update HISTORY
  HISTORY: provide links to issues on the bug tracker
  update IDEAS
  giampaolo#910: [OSX / BSD] in case of error, psutil.pids() raised RuntimeError instead of the original OSError exception.
  fix unicode tests on windows / py3
  small test refactoring
  fix giampaolo#926: [OSX] Process.environ() on Python 3 can crash interpreter if process environ has an invalid unicode string.
  osx: fix compiler warnings
  refactor unicode tests
  fix unicode test
  giampaolo#783: fix some unicode related test failures on osx
  test refactoring
  test refactroring
  ...
  • Loading branch information
nlevitt committed Nov 15, 2016
2 parents 2015585 + 1703f06 commit d734e7c
Show file tree
Hide file tree
Showing 88 changed files with 7,088 additions and 4,117 deletions.
4 changes: 2 additions & 2 deletions .ci/travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
fi

if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]] || [[ $PYVER == 'py26' ]]; then
pip install -U ipaddress unittest2 mock==1.0.1
pip install -U ipaddress unittest2 argparse mock==1.0.1
elif [[ $TRAVIS_PYTHON_VERSION == '2.7' ]] || [[ $PYVER == 'py27' ]]; then
pip install -U ipaddress mock
elif [[ $TRAVIS_PYTHON_VERSION == '3.2' ]] || [[ $PYVER == 'py32' ]]; then
Expand All @@ -51,4 +51,4 @@ elif [[ $TRAVIS_PYTHON_VERSION == '3.3' ]] || [[ $PYVER == 'py33' ]]; then
pip install -U ipaddress
fi

pip install coverage coveralls flake8 pep8 setuptools
pip install -U coverage coveralls flake8 pep8 setuptools
16 changes: 13 additions & 3 deletions .ci/travis/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,32 @@
set -e
set -x

PYVER=`python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))'`

# setup OSX
if [[ "$(uname -s)" == 'Darwin' ]]; then
if which pyenv > /dev/null; then
eval "$(pyenv init -)"
fi
pyenv activate psutil
fi

# install psutil
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*"
else
python psutil/tests/runner.py
fi

python psutil/tests/test_memory_leaks.py
flake8
pep8
if [ "$PYVER" == "2.7" ] || [ "$PYVER" == "3.5" ]; then
# run mem leaks test
python psutil/tests/test_memory_leaks.py
# run linter (on Linux only)
if [[ "$(uname -s)" != 'Darwin' ]]; then
python -m flake8
fi
fi
79 changes: 63 additions & 16 deletions .git-pre-commit
Original file line number Diff line number Diff line change
@@ -1,20 +1,60 @@
#!/usr/bin/env python

# 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"
# 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.

"""
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".
"""

from __future__ import print_function
import os
import subprocess
import sys


def term_supports_colors():
try:
import curses
assert sys.stderr.isatty()
curses.setupterm()
assert curses.tigetnum("colors") > 0
except Exception:
return False
else:
return True


def hilite(s, ok=True, bold=False):
"""Return an highlighted version of 'string'."""
attr = []
if ok is None: # no color
pass
elif ok: # green
attr.append('32')
else: # red
attr.append('31')
if bold:
attr.append('1')
return '\x1b[%sm%s\x1b[0m' % (';'.join(attr), s)


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


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

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

Expand All @@ -23,25 +63,32 @@ def main():
for lineno, line in enumerate(data.split('\n'), 1):
line = line.rstrip()
if "pdb.set_trace" in line:
print("%s: %s" % (lineno, line))
sys.exit(
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()
if "except:" in line and not line.endswith("# NOQA"):
print("%s: %s" % (lineno, line))
sys.exit("commit aborted: bare except clause")
print("%s:%s %s" % (path, lineno, line))
return exit("commit aborted: bare except clause")

# flake8
failed = False
for path in files:
ret = subprocess.call("python -m flake8 %s" % path, shell=True)
if py_files:
try:
import flake8 # NOQA
except ImportError:
return exit("commit aborted: flake8 is not installed; "
"run 'make setup-dev-env'")

# XXX: we should scape spaces and possibly other amenities here
ret = subprocess.call(
"%s -m flake8 %s" % (sys.executable, " ".join(py_files)),
shell=True)
if ret != 0:
failed = True
if failed:
sys.exit("commit aborted: python code is not flake8-compliant")
return exit("commit aborted: python code is not flake8 compliant")


main()
26 changes: 26 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,29 @@ I: 816
N: Jeremy Humble
W: https://github.com/jhumble
I: 863

N: Ilya Georgievsky
W: https://github.com/xBeAsTx
I: 870

N: Yago Jesus
W: https://github.com/YJesus
I: 798

N: Andre Caron
C: Montreal, QC, Canada
E: andre.l.caron@gmail.com
W: https://github.com/AndreLouisCaron
I: 880

N: ewedlund
W: https://github.com/ewedlund
I: 874

N: Arcadiy Ivanov
W: https://github.com/arcivanov
I: 919

N: Max Bélanger
W: https://github.com/maxbelanger
I: 936
15 changes: 5 additions & 10 deletions DEVGUIDE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,11 @@ Documentation
Releasing a new version
=======================

These are note for myself (Giampaolo):

- make sure all tests pass and all builds are green.
- upload source tarball on PYPI with ``make upload-src``.
- upload exe and wheel files for windows on PYPI with ``make upload-all``.
- ...or by using atrifacts hosted on AppVeyor with ``make win-download-exes``
and ``make win-upload-exes``,
- upload updated doc on http://pythonhosted.org/psutil with ``make upload-doc``.
- GIT tag the new release with ``make git-tag-release``.
- post on psutil and python-announce mailing lists, twitter, g+, blog.
These are notes for myself (Giampaolo):

- ``make release``
- post announce (``make print-announce``) on psutil and python-announce mailing
lists, twitter, g+, blog.

=============
FreeBSD notes
Expand Down
Loading

0 comments on commit d734e7c

Please sign in to comment.