diff --git a/HISTORY.rst b/HISTORY.rst index 4793d3d31..bf694ca49 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,6 +6,8 @@ Bug tracker at https://github.com/giampaolo/psutil/issues **Bug fixes** - #632: [Linux] better error message if cannot parse process UNIX connections. +- #635: [UNIX] crash on module import if 'enum' package is installed on python + < 3.4. 3.0.0 - 2015-06-13 diff --git a/Makefile b/Makefile index f309e84fb..18bc45e18 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,7 @@ install-dev-deps: mock \ nose \ pep8 \ + pyflakes \ sphinx \ sphinx-pypi-upload \ unittest2 \ @@ -80,7 +81,7 @@ test-memleaks: install test-by-name: install @$(PYTHON) -m nose test/test_psutil.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS)) -# same as above but for test_memory_leaks.py script +# 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)) @@ -92,16 +93,13 @@ coverage: install $(PYTHON) -m coverage html $(COVERAGE_OPTS) $(PYTHON) -m webbrowser -t htmlcov/index.html -# requires "pip install pep8" pep8: @git ls-files | grep \\.py$ | xargs $(PYTHON) -m pep8 -# requires "pip install pyflakes" pyflakes: @export PYFLAKES_NODOCTEST=1 && \ git ls-files | grep \\.py$ | xargs $(PYTHON) -m pyflakes -# requires "pip install flake8" flake8: @git ls-files | grep \\.py$ | xargs $(PYTHON) -m flake8 diff --git a/psutil/_common.py b/psutil/_common.py index 132d9d593..e9acf595d 100644 --- a/psutil/_common.py +++ b/psutil/_common.py @@ -12,17 +12,19 @@ import os import socket import stat +import sys +from collections import namedtuple +from socket import AF_INET, SOCK_STREAM, SOCK_DGRAM try: import threading except ImportError: import dummy_threading as threading -try: - import enum # py >= 3.4 -except ImportError: + +if sys.version_info >= (3, 4): + import enum +else: enum = None -from collections import namedtuple -from socket import AF_INET, SOCK_STREAM, SOCK_DGRAM # --- constants