gecko/python/psutil/Makefile

91 lines
2.4 KiB
Makefile
Raw Normal View History

# 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 = test/test_psutil.py
all: test
clean:
rm -f `find . -type f -name \*.py[co]`
rm -f `find . -type f -name \*.so`
rm -f `find . -type f -name .\*~`
rm -f `find . -type f -name \*.orig`
rm -f `find . -type f -name \*.bak`
rm -f `find . -type f -name \*.rej`
rm -rf `find . -type d -name __pycache__`
rm -rf *.egg-info
rm -rf *\$testfile*
rm -rf .tox
rm -rf build
rm -rf dist
rm -rf docs/_build
build: clean
$(PYTHON) setup.py build
install: build
if test $(PYTHON) = python2.4; then \
$(PYTHON) setup.py install; \
elif test $(PYTHON) = python2.5; then \
$(PYTHON) setup.py install; \
else \
$(PYTHON) setup.py install --user; \
fi
uninstall:
if test $(PYTHON) = python2.4; then \
pip-2.4 uninstall -y -v psutil; \
else \
cd ..; $(PYTHON) -m pip uninstall -y -v psutil; \
fi
test: install
$(PYTHON) $(TSCRIPT)
test-process: install
$(PYTHON) -m unittest -v test.test_psutil.TestProcess
test-system: install
$(PYTHON) -m unittest -v test.test_psutil.TestSystemAPIs
test-memleaks: install
$(PYTHON) -m unittest -v test.test_memory_leaks
# 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:
@$(PYTHON) -m nose test/test_psutil.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))
# requires "pip install pep8"
pep8:
@git ls-files | grep \\.py$ | xargs pep8
# requires "pip install pyflakes"
pyflakes:
@export PYFLAKES_NODOCTEST=1 && \
git ls-files | grep \\.py$ | xargs pyflakes
# requires "pip install flake8"
flake8:
@git ls-files | grep \\.py$ | xargs 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-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`
echo "done; now run 'git push --follow-tags' to push the new tag on the remote repo"