diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-20 05:00:31 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-20 05:00:31 +0200 |
commit | 2df0da912eba8a241cd953e140e2a43ab4884dd7 (patch) | |
tree | e847eb1305545f4fc0bb4590e26391ca7e4eec1a | |
parent | d4e4df68881021f476a3f73caeab20d1ef1b3611 (diff) | |
parent | 65cc00e0998cc0e645f0df386045365380be79ad (diff) | |
download | psutil-2df0da912eba8a241cd953e140e2a43ab4884dd7.tar.gz |
Merge branch 'master' into win-openprocess-fix-2
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | psutil/__init__.py | 4 | ||||
-rwxr-xr-x | psutil/tests/test_unicode.py | 15 | ||||
-rwxr-xr-x | scripts/internal/winmake.py | 7 |
4 files changed, 12 insertions, 19 deletions
@@ -63,20 +63,21 @@ _: # Compile without installing. build: _ + # make sure setuptools is installed (needed for 'develop' / edit mode) + $(PYTHON) -c "import setuptools" PYTHONWARNINGS=all $(PYTHON) setup.py build @# copies compiled *.so files in ./psutil directory in order to allow @# "import psutil" when using the interactive interpreter from within @# this directory. PYTHONWARNINGS=all $(PYTHON) setup.py build_ext -i rm -rf tmp + $(PYTHON) -c "import psutil" # make sure it actually worked # Install this package + GIT hooks. 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: ${MAKE} build - # make sure setuptools is installed (needed for 'develop' / edit mode) - $(PYTHON) -c "import setuptools" PYTHONWARNINGS=all $(PYTHON) setup.py develop $(INSTALL_OPTS) rm -rf tmp diff --git a/psutil/__init__.py b/psutil/__init__.py index fc45abf1..50ae2a33 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -1646,7 +1646,9 @@ def cpu_count(logical=True): ret = _psplatform.cpu_count_logical() else: ret = _psplatform.cpu_count_physical() - return ret if ret >= 1 else None + if ret is not None and ret < 1: + ret = None + return ret def cpu_times(percpu=False): diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py index 05e0ebcb..9b99fdf9 100755 --- a/psutil/tests/test_unicode.py +++ b/psutil/tests/test_unicode.py @@ -52,7 +52,6 @@ For a detailed explanation of how psutil handles unicode see: - https://pythonhosted.org/psutil/#unicode """ -import errno import os import traceback import warnings @@ -153,20 +152,6 @@ class _BaseFSAPIsTests(object): reap_children() safe_rmpath(self.funky_name) - def safe_rmpath(self, name): - if POSIX: - safe_rmpath(name) - else: - # https://ci.appveyor.com/project/giampaolo/psutil/build/ - # 1225/job/1yec67sr6e9rl217 - try: - safe_rmpath(name) - except OSError as err: - if err.errno in (errno.EACCES, errno.EPERM): - traceback.print_exc() - else: - raise - def expect_exact_path_match(self): raise NotImplementedError("must be implemented in subclass") diff --git a/scripts/internal/winmake.py b/scripts/internal/winmake.py index 40ba3742..57546bd6 100755 --- a/scripts/internal/winmake.py +++ b/scripts/internal/winmake.py @@ -192,11 +192,16 @@ def help(): @cmd def build(): """Build / compile""" + # Make sure setuptools is installed (needed for 'develop' / + # edit mode). + sh("%s -c import setuptools" % PYTHON) sh("%s setup.py build" % PYTHON) - # copies compiled *.pyd files in ./psutil directory in order to + # Copies compiled *.pyd files in ./psutil directory in order to # allow "import psutil" when using the interactive interpreter # from within this directory. sh("%s setup.py build_ext -i" % PYTHON) + # Make sure it actually worked. + sh("%s -c 'import psutil'" % PYTHON) @cmd |