[Python-modules-commits] [python-psutil] 01/08: Import python-psutil_4.3.1.orig.tar.gz

Sandro Tosi morph at moszumanska.debian.org
Sun Oct 2 20:03:16 UTC 2016


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository python-psutil.

commit 59d1042fdd4f68524fc5f231281e35602d85d86e
Author: Sandro Tosi <morph at debian.org>
Date:   Sun Oct 2 15:38:28 2016 -0400

    Import python-psutil_4.3.1.orig.tar.gz
---
 .ci/appveyor/download_exes.py      |   68 ++-
 .git-pre-commit                    |    2 +-
 CREDITS                            |   16 +
 DEVGUIDE.rst                       |   22 +-
 HISTORY.rst                        |   45 ++
 INSTALL.rst                        |   72 ++-
 Makefile                           |  181 ++++--
 PKG-INFO                           |   37 +-
 README.rst                         |   35 +-
 appveyor.yml                       |    1 -
 docs/Makefile                      |    8 +-
 docs/index.rst                     | 1084 +++++++++++++++++++-----------------
 psutil.egg-info/PKG-INFO           |   37 +-
 psutil.egg-info/SOURCES.txt        |    5 -
 psutil/__init__.py                 |   40 +-
 psutil/_common.py                  |  250 +++++----
 psutil/_compat.py                  |    3 +-
 psutil/_psbsd.py                   |  116 ++--
 psutil/_pslinux.py                 |  317 ++++++-----
 psutil/_psosx.py                   |   80 ++-
 psutil/_psposix.py                 |   40 +-
 psutil/_pssunos.py                 |  160 ++++--
 psutil/_psutil_bsd.c               |    5 +-
 psutil/_psutil_bsd.h               |   36 --
 psutil/_psutil_linux.c             |    2 -
 psutil/_psutil_linux.h             |   21 -
 psutil/_psutil_osx.c               |    1 -
 psutil/_psutil_osx.h               |   43 --
 psutil/_psutil_posix.c             |    2 +-
 psutil/_psutil_sunos.c             |    4 +-
 psutil/_psutil_sunos.h             |   28 -
 psutil/_psutil_windows.c           |   97 +++-
 psutil/_psutil_windows.h           |   70 ---
 psutil/_pswindows.py               |  110 ++--
 psutil/arch/bsd/netbsd.c           |    1 +
 psutil/arch/windows/process_info.c |    2 +
 psutil/arch/windows/services.c     |   72 ++-
 psutil/tests/__init__.py           |  439 +++++++++------
 psutil/tests/test_linux.py         |    9 +-
 psutil/tests/test_memory_leaks.py  |    2 +-
 psutil/tests/test_posix.py         |   31 ++
 psutil/tests/test_process.py       |  128 ++---
 scripts/ps.py                      |   28 +-
 scripts/top.py                     |    8 +-
 44 files changed, 2197 insertions(+), 1561 deletions(-)

diff --git a/.ci/appveyor/download_exes.py b/.ci/appveyor/download_exes.py
index b7baf6b..92435b5 100755
--- a/.ci/appveyor/download_exes.py
+++ b/.ci/appveyor/download_exes.py
@@ -19,11 +19,45 @@ import multiprocessing
 import os
 import requests
 import shutil
+import sys
 
 from concurrent.futures import ThreadPoolExecutor
 
+from psutil import __version__ as PSUTIL_VERSION
+
 
 BASE_URL = 'https://ci.appveyor.com/api'
+PY_VERSIONS = ['2.7', '3.3', '3.4', '3.5']
+
+
+def term_supports_colors(file=sys.stdout):
+    try:
+        import curses
+        assert file.isatty()
+        curses.setupterm()
+        assert curses.tigetnum("colors") > 0
+    except Exception:
+        return False
+    else:
+        return True
+
+
+if term_supports_colors():
+    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)
+else:
+    def hilite(s, *a, **k):
+        return s
 
 
 def safe_makedirs(path):
@@ -47,15 +81,16 @@ def safe_rmtree(path):
 
 
 def download_file(url):
-    local_filename = url.split('/')[-1]
-    local_filename = os.path.join('dist', local_filename)
-    print(local_filename)
+    local_fname = url.split('/')[-1]
+    local_fname = os.path.join('dist', local_fname)
+    print(local_fname)
     safe_makedirs('dist')
     r = requests.get(url, stream=True)
-    with open(local_filename, 'wb') as f:
+    with open(local_fname, 'wb') as f:
         for chunk in r.iter_content(chunk_size=1024):
             if chunk:    # filter out keep-alive new chunks
                 f.write(chunk)
+    return local_fname
 
 
 def get_file_urls(options):
@@ -72,15 +107,38 @@ def get_file_urls(options):
         for item in data:
             file_url = job_url + '/' + item['fileName']
             urls.append(file_url)
+    if not urls:
+        sys.exit("no artifacts found")
     for url in sorted(urls, key=lambda x: os.path.basename(x)):
         yield url
 
 
+def rename_27_wheels():
+    # See: https://github.com/giampaolo/psutil/issues/810
+    src = 'dist/psutil-%s-cp27-cp27m-win32.whl' % PSUTIL_VERSION
+    dst = 'dist/psutil-%s-cp27-none-win32.whl' % PSUTIL_VERSION
+    print("rename: %s\n        %s" % (src, dst))
+    os.rename(src, dst)
+    src = 'dist/psutil-%s-cp27-cp27m-win_amd64.whl' % PSUTIL_VERSION
+    dst = 'dist/psutil-%s-cp27-none-win_amd64.whl' % PSUTIL_VERSION
+    print("rename: %s\n        %s" % (src, dst))
+    os.rename(src, dst)
+
+
 def main(options):
+    files = []
     safe_rmtree('dist')
     with ThreadPoolExecutor(max_workers=multiprocessing.cpu_count()) as e:
         for url in get_file_urls(options):
-            e.submit(download_file, url)
+            fut = e.submit(download_file, url)
+            files.append(fut.result())
+    # 2 exes (32 and 64 bit) and 2 wheels (32 and 64 bit) for each ver.
+    expected = len(PY_VERSIONS) * 4
+    got = len(files)
+    if expected != got:
+        print(hilite("expected %s files, got %s" % (expected, got), ok=False),
+              file=sys.stderr)
+    rename_27_wheels()
 
 
 if __name__ == '__main__':
diff --git a/.git-pre-commit b/.git-pre-commit
index 0b838d4..9938772 100755
--- a/.git-pre-commit
+++ b/.git-pre-commit
@@ -11,7 +11,7 @@ import sys
 
 def main():
     out = subprocess.check_output("git diff --cached --name-only", shell=True)
-    files = [x for x in out.split('\n') if x.endswith('.py') and
+    files = [x for x in out.split(b'\n') if x.endswith(b'.py') and
              os.path.exists(x)]
 
     for path in files:
diff --git a/CREDITS b/CREDITS
index 2d46e44..ab555ef 100644
--- a/CREDITS
+++ b/CREDITS
@@ -382,3 +382,19 @@ D: sample code for process USS memory.
 N: wxwright
 W: https://github.com/wxwright
 I: 776
+
+N: Farhan Khan
+E: khanzf at gmail.com
+I: 823
+
+N: Jake Omann
+E: https://github.com/jhomann
+I: 816
+
+N: Jeremy Humble
+W: https://github.com/jhumble
+I: 863
+
+N: Ilya Georgievsky
+W: https://github.com/xBeAsTx
+I: 870
diff --git a/DEVGUIDE.rst b/DEVGUIDE.rst
index 691d5db..ebd919a 100644
--- a/DEVGUIDE.rst
+++ b/DEVGUIDE.rst
@@ -16,9 +16,13 @@ If you plan on hacking on psutil this is what you're supposed to do first:
   $ make setup-dev-env
 
 - bear in mind that ``make`` (see `Makefile <https://github.com/giampaolo/psutil/blob/master/Makefile>`_)
-  is the designated tool to run tests, build etc. and that it is also available
-  on Windows (see `make.bat <https://github.com/giampaolo/psutil/blob/master/make.bat>`_).
-- (UNIX only) run ``make install-git-hooks``: this will reject your commit
+  is the designated tool to run tests, build, install etc. and that it is also
+  available on Windows
+  (see `make.bat <https://github.com/giampaolo/psutil/blob/master/make.bat>`_).
+- bear in mind that both psutil (``make install``) and any other lib
+  (``make setup-dev-env``) is installed as a limited user
+  (``pip install --user ...``), so develop as such (don't use root).
+- (UNIX only) run ``make install-git-hooks``: this will reject your commits
   if python code is not PEP8 compliant.
 - run ``make test`` to run tests.
 
@@ -38,6 +42,7 @@ Makefile
 Some useful make commands::
 
   $ make install        # install
+  $ make setup-dev-env  # install useful dev libs (pyflakes, unittest2, etc.)
   $ make test           # run all tests
   $ make test-memleaks  # run memory leak tests
   $ make coverage       # run test coverage
@@ -67,8 +72,10 @@ Typical process occurring when adding a new functionality (API):
   ``psutil/_psutil_{platform}.c`` (e.g. ``psutil/_psutil_linux.c``).
 - write a generic test in ``psutil/tests/test_system.py`` or
   ``psutil/tests/test_process.py``.
-- if possible, write a cross platform test in
+- if possible, write a platform specific test in
   ``psutil/tests/test_{platform}.py`` (e.g. ``test_linux.py``).
+  This usually means testing the return value of the new feature against
+  a system CLI tool.
 - update doc in ``doc/index.py``.
 - update ``HISTORY.rst``.
 - update ``README.rst`` (if necessary).
@@ -127,7 +134,7 @@ Documentation
 - it uses `RsT syntax <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_
   and it's built with `sphinx <http://sphinx-doc.org/>`_.
 - doc can be built with ``make setup-dev-env; cd docs; make html``.
-- public is hosted on http://pythonhosted.org/psutil/.
+- public doc is hosted on http://pythonhosted.org/psutil/.
 - it is uploaded on every new release with ``make upload-doc``.
 
 =======================
@@ -139,6 +146,8 @@ 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.
@@ -150,7 +159,8 @@ FreeBSD notes
 - setup:
 
 .. code-block:: bash
+
   $ pkg install python python3 gcc git vim screen bash
   $ chsh -s /usr/local/bin/bash user  # set bash as default shell
 
-- `/usr/src` contains the source codes for all installed CLI tools (grep in it).
\ No newline at end of file
+- ``/usr/src`` contains the source codes for all installed CLI tools (grep in it).
diff --git a/HISTORY.rst b/HISTORY.rst
index e8a6ed9..3a75c75 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,5 +1,50 @@
 Bug tracker at https://github.com/giampaolo/psutil/issues
 
+4.3.1 - XXXX-XX-XX
+==================
+
+**Enhancements**
+
+- #881: "make install" now works also when using a virtual env.
+
+**Bug fixes**
+
+- #854: Process.as_dict() raises ValueError if passed an erroneous attrs name.
+- #857: [SunOS] Process cpu_times(), cpu_percent(), threads() amd memory_maps()
+  may raise RuntimeError if attempting to query a 64bit process with a 32bit
+  python. "Null" values are returned as a fallback.
+- #858: Process.as_dict() should not return memory_info_ex() because it's
+  deprecated.
+- #863: [Windows] memory_map truncates addresses above 32 bits
+- #866: [Windows] win_service_iter() and services in general are not able to
+  handle unicode service names / descriptions.
+- #869: [Windows] Process.wait() may raise TimeoutExpired with wrong timeout
+  unit (ms instead of sec).
+- #870: [Windows] Handle leak inside psutil_get_process_data.
+
+
+4.3.0 - 2016-06-18
+==================
+
+**Enhancements**
+
+- #819: [Linux] different speedup improvements:
+  Process.ppid() is 20% faster
+  Process.status() is 28% faster
+  Process.name() is 25% faster
+  Process.num_threads is 20% faster on Python 3
+
+**Bug fixes**
+
+- #810: [Windows] Windows wheels are incompatible with pip 7.1.2.
+- #812: [NetBSD] fix compilation on NetBSD-5.x.
+- #823: [NetBSD] virtual_memory() raises TypeError on Python 3.
+- #829: [UNIX] psutil.disk_usage() percent field takes root reserved space
+  into account.
+- #816: [Windows] fixed net_io_counter() values wrapping after 4.3GB in
+  Windows Vista (NT 6.0) and above using 64bit values from newer win APIs.
+
+
 4.2.0 - 2016-05-14
 ==================
 
diff --git a/INSTALL.rst b/INSTALL.rst
index e9794c4..05bbc9c 100644
--- a/INSTALL.rst
+++ b/INSTALL.rst
@@ -1,20 +1,39 @@
 *Note: pip is the easiest way to install psutil.
 It is shipped by default with Python 2.7.9+ and 3.4+. If you're using an
 older Python version* `install pip <https://pip.pypa.io/en/latest/installing/>`__
-*first.*
+*first.* If you cloned psutil source code you can also install it with
+``make install-pip``.
+
+Permission issues
+=================
+
+Except for Linux, the commands below assume you're running as root.
+If you're not and you bump into permission errors you can either:
+
+* prepend ``sudo``, e.g.:
+
+::
+
+    sudo pip install psutil
+
+* install psutil for your user only (not at system level):
+
+::
+
+    pip install --user psutil
 
 Linux
 =====
 
-Ubuntu / Debian (use `python3-dev` for python 3)::
+Ubuntu / Debian (use ``python3-dev`` and ``python3-pip`` for python 3)::
 
-    $ sudo apt-get install gcc python-dev
-    $ pip install psutil
+    sudo apt-get install gcc python-dev python-pip
+    pip install psutil
 
-RedHat (use `python3-devel` for python 3)::
+RedHat (use ``python3-devel`` and ``python3-pip`` for python 3)::
 
-    $ sudo yum install gcc python-devel
-    $ pip install psutil
+    sudo yum install gcc python-devel python-pip
+    pip install psutil
 
 OSX
 ===
@@ -24,7 +43,7 @@ first, then:
 
 ::
 
-    $ pip install psutil
+    pip install psutil
 
 Windows
 =======
@@ -33,7 +52,7 @@ The easiest way to install psutil on Windows is to just use the pre-compiled
 exe/wheel installers on
 `PYPI <https://pypi.python.org/pypi/psutil/#downloads>`__ via pip::
 
-    $ C:\Python27\python.exe -m pip install psutil
+    C:\Python27\python.exe -m pip install psutil
 
 If you want to compile psutil from sources you'll need **Visual Studio**
 (Mingw32 is no longer supported):
@@ -48,40 +67,51 @@ Once installed run vcvars64.bat, then you can finally compile (see
 `here <http://stackoverflow.com/questions/11072521/>`__).
 To compile / install psutil from sources on Windows run::
 
-    $ make.bat build
-    $ make.bat install
+    make.bat build
+    make.bat install
 
 FreeBSD
 =======
 
 ::
 
-    $ pkg install python gcc
-    $ python -m pip install psutil
+    pkg install python gcc
+    python -m pip install psutil
 
 OpenBSD
 =======
 
 ::
 
-    $ export PKG_PATH=http://ftp.usa.openbsd.org/pub/OpenBSD/`uname -r`/packages/`arch -s`
-    $ pkg_add -v python gcc
-    $ python -m pip install psutil
+    export PKG_PATH=http://ftp.usa.openbsd.org/pub/OpenBSD/`uname -r`/packages/`arch -s`
+    pkg_add -v python gcc
+    python -m pip install psutil
 
 NetBSD
 ======
 
 ::
 
-    $ export PKG_PATH="ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All"
-    $ pkg_add -v pkgin
-    $ pkgin install python gcc
-    $ python -m pip install psutil
+    export PKG_PATH="ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All"
+    pkg_add -v pkgin
+    pkgin install python gcc
+    python -m pip install psutil
 
 Solaris
 =======
 
-XXX
+If ``cc`` compiler is not installed create a symlink to ``gcc``:
+
+::
+
+    sudo ln -s /usr/bin/gcc /usr/local/bin/cc
+
+Install:
+
+::
+
+    pkg install gcc
+    python -m pip install psutil
 
 Dev Guide
 =========
diff --git a/Makefile b/Makefile
index a20f6a8..b8c118f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,39 @@
 # Shortcuts for various tasks (UNIX only).
-# To use a specific Python version run:
-# $ make install PYTHON=python3.3
-
-# You can set these variables from the command line.
-PYTHON    = python
-TSCRIPT   = psutil/tests/runner.py
+# To use a specific Python version run: "make install PYTHON=python3.3"
+
+# You can set the following variables from the command line.
+PYTHON = python
+TSCRIPT = psutil/tests/runner.py
+INSTALL_OPTS =
+
+# List of nice-to-have dev libs.
+DEPS = coverage \
+	flake8 \
+	futures \
+	ipdb \
+	mock==1.0.1 \
+	nose \
+	pep8 \
+	pyflakes \
+	requests \
+	sphinx \
+	sphinx-pypi-upload \
+	twine \
+	unittest2
+
+# In case of venv, omit --user options during install.
+_IS_VENV = $(shell $(PYTHON) -c "import sys; print(1 if hasattr(sys, 'real_prefix') else 0)")
+ifeq ($(_IS_VENV), 0)
+	INSTALL_OPTS += "--user"
+endif
 
 all: test
 
+# ===================================================================
+# Install
+# ===================================================================
+
+# Remove all build files.
 clean:
 	rm -f `find . -type f -name \*.py[co]`
 	rm -f `find . -type f -name \*.so`
@@ -21,70 +47,95 @@ clean:
 	rm -rf *\$testfile*
 	rm -rf .coverage
 	rm -rf .tox
-	rm -rf build
-	rm -rf dist
-	rm -rf docs/_build
-	rm -rf htmlcov
+	rm -rf build/
+	rm -rf dist/
+	rm -rf docs/_build/
+	rm -rf htmlcov/
+	rm -rf tmp/
 
+# Compile without installing.
 build: clean
 	$(PYTHON) setup.py build
 	@# copies *.so files in ./psutil directory in order to allow
 	@# "import psutil" when using the interactive interpreter from within
 	@# this directory.
 	$(PYTHON) setup.py build_ext -i
+	rm -rf tmp
 
-# useful deps which are nice to have while developing / testing
-setup-dev-env: install-git-hooks
-	python -c  "import urllib2, ssl; \
-				context = ssl._create_unverified_context() if hasattr(ssl, '_create_unverified_context') else None; \
-				kw = dict(context=context) if context else {}; \
-				r = urllib2.urlopen('https://bootstrap.pypa.io/get-pip.py', **kw); \
-				open('/tmp/get-pip.py', 'w').write(r.read());"
-	$(PYTHON) /tmp/get-pip.py --user
-	rm /tmp/get-pip.py
-	$(PYTHON) -m pip install --user --upgrade pip
-	$(PYTHON) -m pip install --user --upgrade \
-		coverage  \
-		flake8 \
-		ipaddress \
-		ipdb \
-		mock==1.0.1 \
-		nose \
-		pep8 \
-		pyflakes \
-		requests \
-		sphinx \
-		sphinx-pypi-upload \
-		unittest2 \
-
+# Install this package. Install is done:
+# - as the current user, in order to avoid permission issues
+# - in development / edit mode, so that source can be modified on the fly
 install: build
-	$(PYTHON) setup.py develop --user
+	$(PYTHON) setup.py develop $(INSTALL_OPTS)
+	rm -rf tmp
 
+# Uninstall this package via pip.
 uninstall:
 	cd ..; $(PYTHON) -m pip uninstall -y -v psutil
 
+# Install PIP (only if necessary).
+install-pip:
+	$(PYTHON) -c \
+		"import sys, ssl, os, pkgutil, tempfile, atexit; \
+		sys.exit(0) if pkgutil.find_loader('pip') else None; \
+		pyexc = 'from urllib.request import urlopen' if sys.version_info[0] == 3 else 'from urllib2 import urlopen'; \
+		exec(pyexc); \
+		ctx = ssl._create_unverified_context() if hasattr(ssl, '_create_unverified_context') else None; \
+		kw = dict(context=ctx) if ctx else {}; \
+		req = urlopen('https://bootstrap.pypa.io/get-pip.py', **kw); \
+		data = req.read(); \
+		f = tempfile.NamedTemporaryFile(suffix='.py'); \
+		atexit.register(f.close); \
+		f.write(data); \
+		f.flush(); \
+		print('downloaded %s' % f.name); \
+		code = os.system('%s %s --user' % (sys.executable, f.name)); \
+		f.close(); \
+		sys.exit(code);"
+
+# Install:
+# - GIT hooks
+# - pip (if necessary)
+# - useful deps which are nice to have while developing / testing;
+#   deps these are also upgraded
+setup-dev-env: install-git-hooks install-pip
+	$(PYTHON) -m pip install $(INSTALL_OPTS) --upgrade pip
+	$(PYTHON) -m pip install $(INSTALL_OPTS) --upgrade $(DEPS)
+
+# ===================================================================
+# Tests
+# ===================================================================
+
+# Run all tests.
 test: install
 	$(PYTHON) $(TSCRIPT)
 
+# Test psutil process-related APIs.
 test-process: install
 	$(PYTHON) -m unittest -v psutil.tests.test_process
 
+# Test psutil system-related APIs.
 test-system: install
 	$(PYTHON) -m unittest -v psutil.tests.test_system
 
+# Test misc.
+test-misc: install
+	$(PYTHON) psutil/tests/test_misc.py
+
+# Test memory leaks.
 test-memleaks: install
 	$(PYTHON) psutil/tests/test_memory_leaks.py
 
+# Run specific platform tests only.
+test-platform: install
+	$(PYTHON) psutil/tests/test_`$(PYTHON) -c 'import psutil; print([x.lower() for x in ("LINUX", "BSD", "OSX", "SUNOS", "WINDOWS") if getattr(psutil, x)][0])'`.py
+
 # Run a specific test by name; e.g. "make test-by-name disk_" will run
 # all test methods containing "disk_" in their name.
 # Requires "pip install nose".
 test-by-name: install
 	@$(PYTHON) -m nose psutil/tests/*.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))
 
-# Run specific platform tests only.
-test-platform: install
-	$(PYTHON) psutil/tests/test_`$(PYTHON) -c 'import psutil; print([x.lower() for x in ("LINUX", "BSD", "OSX", "SUNOS", "WINDOWS") if getattr(psutil, x)][0])'`.py
-
 # Same as above but for test_memory_leaks.py script.
 test-memleaks-by-name: install
 	@$(PYTHON) -m nose test/test_memory_leaks.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))
@@ -98,6 +149,10 @@ coverage: install
 	$(PYTHON) -m coverage html
 	$(PYTHON) -m webbrowser -t htmlcov/index.html
 
+# ===================================================================
+# Linters
+# ===================================================================
+
 pep8:
 	@git ls-files | grep \\.py$ | xargs $(PYTHON) -m pep8
 
@@ -108,30 +163,54 @@ pyflakes:
 flake8:
 	@git ls-files | grep \\.py$ | xargs $(PYTHON) -m flake8
 
-# Upload source tarball on https://pypi.python.org/pypi/psutil.
-upload-src: clean
-	$(PYTHON) setup.py sdist upload
-
-# Build and upload doc on https://pythonhosted.org/psutil/.
-# Requires "pip install sphinx-pypi-upload".
-upload-doc:
-	cd docs; make html
-	$(PYTHON) setup.py upload_sphinx --upload-dir=docs/_build/html
+# ===================================================================
+# GIT
+# ===================================================================
 
 # git-tag a new release
 git-tag-release:
 	git tag -a release-`python -c "import setup; print(setup.get_version())"` -m `git rev-list HEAD --count`:`git rev-parse --short HEAD`
 	git push --follow-tags
 
-# install GIT pre-commit hook
+# Install GIT pre-commit hook.
 install-git-hooks:
 	ln -sf ../../.git-pre-commit .git/hooks/pre-commit
 	chmod +x .git/hooks/pre-commit
 
-# download exes/wheels hosted on appveyor
+# ===================================================================
+# Distribution
+# ===================================================================
+
+# Upload source tarball on https://pypi.python.org/pypi/psutil.
+upload-src: clean
+	$(PYTHON) setup.py sdist upload
+
+# Build and upload doc on https://pythonhosted.org/psutil/.
+# Requires "pip install sphinx-pypi-upload".
+upload-doc:
+	cd docs && make html
+	$(PYTHON) setup.py upload_sphinx --upload-dir=docs/_build/html
+
+# Download exes/wheels hosted on appveyor.
 win-download-exes:
 	$(PYTHON) .ci/appveyor/download_exes.py --user giampaolo --project psutil
 
-# upload exes/wheels in dist/* directory to PYPI
+# Upload exes/wheels in dist/* directory to PYPI.
 win-upload-exes:
 	$(PYTHON) -m twine upload dist/*
+
+# All the necessary steps before making a release.
+pre-release:
+	${MAKE} clean
+	${MAKE} setup-dev-env  # mainly to update sphinx and install twine
+	${MAKE} install  # to import psutil from download_exes.py
+	${MAKE} win-download-exes
+	$(PYTHON) setup.py sdist
+
+# Create a release: creates tar.gz and exes/wheels, uploads them, upload doc,
+# git tag release.
+release:
+	${MAKE} pre-release
+	$(PYTHON) -m twine upload dist/*  # upload tar.gz, exes, wheels on PYPI
+	${MAKE} git-tag-release
+	${MAKE} upload-doc
diff --git a/PKG-INFO b/PKG-INFO
index 1313744..4556b05 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,28 +1,24 @@
 Metadata-Version: 1.1
 Name: psutil
-Version: 4.2.0
+Version: 4.3.1
 Summary: psutil is a cross-platform library for retrieving information onrunning processes and system utilization (CPU, memory, disks, network)in Python.
 Home-page: https://github.com/giampaolo/psutil
 Author: Giampaolo Rodola
 Author-email: g.rodola <at> gmail <dot> com
 License: BSD
-Description: .. image:: https://img.shields.io/pypi/dm/psutil.svg
-            :target: https://pypi.python.org/pypi/psutil#downloads
-            :alt: Downloads this month
-        
-        .. image:: https://api.travis-ci.org/giampaolo/psutil.png?branch=master
+Description: .. image:: https://img.shields.io/travis/giampaolo/psutil/master.svg?maxAge=3600&label=Linux%20/%20OSX
             :target: https://travis-ci.org/giampaolo/psutil
             :alt: Linux tests (Travis)
         
-        .. image:: https://ci.appveyor.com/api/projects/status/qdwvw7v1t915ywr5/branch/master?svg=true
+        .. image:: https://img.shields.io/appveyor/ci/giampaolo/psutil/master.svg?maxAge=3600&label=Windows
             :target: https://ci.appveyor.com/project/giampaolo/psutil
             :alt: Windows tests (Appveyor)
         
-        .. image:: https://coveralls.io/repos/giampaolo/psutil/badge.svg?branch=master&service=github
+        .. image:: https://coveralls.io/repos/github/giampaolo/psutil/badge.svg?branch=master
             :target: https://coveralls.io/github/giampaolo/psutil?branch=master
             :alt: Test coverage (coverall.io)
         
-        .. image:: https://img.shields.io/pypi/v/psutil.svg
+        .. image:: https://img.shields.io/pypi/v/psutil.svg?label=version
             :target: https://pypi.python.org/pypi/psutil/
             :alt: Latest version
         
@@ -68,23 +64,10 @@ Description: .. image:: https://img.shields.io/pypi/dm/psutil.svg
         Example applications
         ====================
         
-        .. image:: http://psutil.googlecode.com/svn/wiki/images/top-thumb.png
-            :target: http://psutil.googlecode.com/svn/wiki/images/top.png
-            :alt: top
-        
-        .. image:: http://psutil.googlecode.com/svn/wiki/images/nettop-thumb.png
-            :target: http://psutil.googlecode.com/svn/wiki/images/nettop.png
-            :alt: nettop
-        
-        .. image:: http://psutil.googlecode.com/svn/wiki/images/iotop-thumb.png
-            :target: http://psutil.googlecode.com/svn/wiki/images/iotop.png
-            :alt: iotop
-        
-        See also:
-        
-         * https://github.com/nicolargo/glances
-         * https://github.com/google/grr
-         * https://github.com/Jahaja/psdash
+        - https://github.com/nicolargo/glances
+        - https://github.com/google/grr
+        - https://github.com/Jahaja/psdash
+        - https://github.com/giampaolo/psutil/tree/master/scripts
         
         ==============
         Example usages
@@ -386,6 +369,8 @@ Description: .. image:: https://img.shields.io/pypi/dm/psutil.svg
         Timeline
         ========
         
+        - 2016-06-18: `psutil-4.3.0.tar.gz <https://pypi.python.org/packages/source/p/psutil/psutil-4.3.0.tar.gz>`_
+        - 2016-05-15: `psutil-4.2.0.tar.gz <https://pypi.python.org/packages/source/p/psutil/psutil-4.2.0.tar.gz>`_
         - 2016-03-12: `psutil-4.1.0.tar.gz <https://pypi.python.org/packages/source/p/psutil/psutil-4.1.0.tar.gz>`_
         - 2016-02-17: `psutil-4.0.0.tar.gz <https://pypi.python.org/packages/source/p/psutil/psutil-4.0.0.tar.gz>`_
         - 2016-01-20: `psutil-3.4.2.tar.gz <https://pypi.python.org/packages/source/p/psutil/psutil-3.4.2.tar.gz>`_
diff --git a/README.rst b/README.rst
index ffe3514..eed2483 100644
--- a/README.rst
+++ b/README.rst
@@ -1,20 +1,16 @@
-.. image:: https://img.shields.io/pypi/dm/psutil.svg
-    :target: https://pypi.python.org/pypi/psutil#downloads
-    :alt: Downloads this month
-
-.. image:: https://api.travis-ci.org/giampaolo/psutil.png?branch=master
+.. image:: https://img.shields.io/travis/giampaolo/psutil/master.svg?maxAge=3600&label=Linux%20/%20OSX
     :target: https://travis-ci.org/giampaolo/psutil
     :alt: Linux tests (Travis)
 
-.. image:: https://ci.appveyor.com/api/projects/status/qdwvw7v1t915ywr5/branch/master?svg=true
+.. image:: https://img.shields.io/appveyor/ci/giampaolo/psutil/master.svg?maxAge=3600&label=Windows
     :target: https://ci.appveyor.com/project/giampaolo/psutil
     :alt: Windows tests (Appveyor)
 
-.. image:: https://coveralls.io/repos/giampaolo/psutil/badge.svg?branch=master&service=github
+.. image:: https://coveralls.io/repos/github/giampaolo/psutil/badge.svg?branch=master
     :target: https://coveralls.io/github/giampaolo/psutil?branch=master
     :alt: Test coverage (coverall.io)
 
-.. image:: https://img.shields.io/pypi/v/psutil.svg
+.. image:: https://img.shields.io/pypi/v/psutil.svg?label=version
     :target: https://pypi.python.org/pypi/psutil/
     :alt: Latest version
 
@@ -60,23 +56,10 @@ to 3.5** (users of Python 2.4 and 2.5 may use
 Example applications
 ====================
 
-.. image:: http://psutil.googlecode.com/svn/wiki/images/top-thumb.png
-    :target: http://psutil.googlecode.com/svn/wiki/images/top.png
-    :alt: top
-
-.. image:: http://psutil.googlecode.com/svn/wiki/images/nettop-thumb.png
-    :target: http://psutil.googlecode.com/svn/wiki/images/nettop.png
-    :alt: nettop
-
-.. image:: http://psutil.googlecode.com/svn/wiki/images/iotop-thumb.png
-    :target: http://psutil.googlecode.com/svn/wiki/images/iotop.png
-    :alt: iotop
-
-See also:
-
- * https://github.com/nicolargo/glances
- * https://github.com/google/grr
- * https://github.com/Jahaja/psdash
+- https://github.com/nicolargo/glances
+- https://github.com/google/grr
+- https://github.com/Jahaja/psdash
+- https://github.com/giampaolo/psutil/tree/master/scripts
 
 ==============
 Example usages
@@ -378,6 +361,8 @@ http://groups.google.com/group/psutil/
 Timeline
 ========
 
+- 2016-06-18: `psutil-4.3.0.tar.gz <https://pypi.python.org/packages/source/p/psutil/psutil-4.3.0.tar.gz>`_
+- 2016-05-15: `psutil-4.2.0.tar.gz <https://pypi.python.org/packages/source/p/psutil/psutil-4.2.0.tar.gz>`_
 - 2016-03-12: `psutil-4.1.0.tar.gz <https://pypi.python.org/packages/source/p/psutil/psutil-4.1.0.tar.gz>`_
 - 2016-02-17: `psutil-4.0.0.tar.gz <https://pypi.python.org/packages/source/p/psutil/psutil-4.0.0.tar.gz>`_
 - 2016-01-20: `psutil-3.4.2.tar.gz <https://pypi.python.org/packages/source/p/psutil/psutil-3.4.2.tar.gz>`_
diff --git a/appveyor.yml b/appveyor.yml
index 52e56ba..5299720 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -64,7 +64,6 @@ init:
 install:
   - "powershell .ci\\appveyor\\install.ps1"
   # - ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
-  - "%WITH_COMPILER% %PYTHON%/python.exe -m pip install --upgrade --user setuptools pip"
   - "%WITH_COMPILER% %PYTHON%/python.exe -m pip --version"
   - "%WITH_COMPILER% %PYTHON%/python.exe -m pip install --upgrade --user unittest2 ipaddress pypiwin32 wmi wheel"
   - "%WITH_COMPILER% %PYTHON%/python.exe -m pip freeze"
diff --git a/docs/Makefile b/docs/Makefile
index b23ab4b..a69fc32 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -2,16 +2,12 @@
 #
 
 # You can set these variables from the command line.
+PYTHON        = python
 SPHINXOPTS    =
-SPHINXBUILD   = sphinx-build
+SPHINXBUILD   = $(PYTHON) -m sphinx
 PAPER         =
 BUILDDIR      = _build
 
-# User-friendly check for sphinx-build
-ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
-$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
-endif
-
 # Internal variables.
 PAPEROPT_a4     = -D latex_paper_size=a4
 PAPEROPT_letter = -D latex_paper_size=letter
diff --git a/docs/index.rst b/docs/index.rst
index 1873366..dbd1d32 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -106,7 +106,6 @@ CPU
     >>>
 
   .. warning::
-
     the first time this function is called with *interval* = ``0.0`` or ``None``
     it will return a meaningless ``0.0`` value which you are supposed to
     ignore.
@@ -120,28 +119,27 @@ CPU
   *percpu* arguments have the same meaning as in :func:`cpu_percent()`.
 
   .. warning::
-
     the first time this function is called with *interval* = ``0.0`` or
     ``None`` it will return a meaningless ``0.0`` value which you are supposed
     to ignore.
 
-  .. versionchanged:: 4.1.0 two new *interrupt* and *dpc* fields are returned
-     on Windows.
+  .. versionchanged::
+    4.1.0 two new *interrupt* and *dpc* fields are returned on Windows.
 
 .. function:: cpu_count(logical=True)
 
-    Return the number of logical CPUs in the system (same as
-    `os.cpu_count() <http://docs.python.org/3/library/os.html#os.cpu_count>`__
-    in Python 3.4).
-    If *logical* is ``False`` return the number of physical cores only (hyper
-    thread CPUs are excluded). Return ``None`` if undetermined.
+  Return the number of logical CPUs in the system (same as
+  `os.cpu_count() <http://docs.python.org/3/library/os.html#os.cpu_count>`__
+  in Python 3.4).
+  If *logical* is ``False`` return the number of physical cores only (hyper
+  thread CPUs are excluded). Return ``None`` if undetermined.
 
-      >>> import psutil
-      >>> psutil.cpu_count()
-      4
-      >>> psutil.cpu_count(logical=False)
-      2
-      >>>
+    >>> import psutil
+    >>> psutil.cpu_count()
+    4
+    >>> psutil.cpu_count(logical=False)
+    2
+    >>>
 
 .. function:: cpu_stats()
 
@@ -207,16 +205,19 @@ Memory
   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
-    >>> mem = psutil.virtual_memory()
-    >>> mem
-    svmem(total=10367352832, available=6472179712, percent=37.6, used=8186245120, free=2181107712, active=4748992512, inactive=2758115328, buffers=790724608, cached=3500347392, shared=787554304)
-    >>>
-    >>> THRESHOLD = 100 * 1024 * 1024  # 100MB
-    >>> if mem.available <= THRESHOLD:
-    ...     print("warning")
-    ...
-    >>>
+  .. note:: if you just want to know how much physical memory is left in a
+    cross platform fashion simply rely on the **available** field.
+
+  >>> import psutil
+  >>> mem = psutil.virtual_memory()
+  >>> mem
+  svmem(total=10367352832, available=6472179712, percent=37.6, used=8186245120, free=2181107712, active=4748992512, inactive=2758115328, buffers=790724608, cached=3500347392, shared=787554304)
+  >>>
+  >>> THRESHOLD = 100 * 1024 * 1024  # 100MB
+  >>> if mem.available <= THRESHOLD:
+  ...     print("warning")
+  ...
+  >>>
 
   .. versionchanged:: 4.2.0 added *shared* metrics on Linux.
 
@@ -275,20 +276,29 @@ Disks
   **total**, **used** and **free** space expressed in bytes, plus the
   **percentage** usage.
   `OSError <http://docs.python.org/3/library/exceptions.html#OSError>`__ is
-  raised if *path* does not exist. See
-  `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
+  raised if *path* does not exist.
+  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/scripts/disk_usage.py>`__
-  script providing an example usage.
+  See `disk_usage.py <https://github.com/giampaolo/psutil/blob/master/scripts/disk_usage.py>`__ script providing an example usage.
 
     >>> import psutil
     >>> psutil.disk_usage('/')
     sdiskusage(total=21378641920, used=4809781248, free=15482871808, percent=22.5)
 
+  .. note::
+    UNIX usually reserves 5% of the total disk space for the root user.
+    *total* and *used* fields on UNIX refer to the overall total and used
... 4960 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-psutil.git



More information about the Python-modules-commits mailing list