diff options
author | hut <hut@lavabit.com> | 2010-09-16 18:19:46 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-09-16 18:19:46 +0200 |
commit | 4341846741b6623a1ead43485cfd5cf633453bb6 (patch) | |
tree | fdfdd0b13329ad457ad9a6a0c0091019396ae64a /Makefile | |
parent | 37a60686b340f030a2fc37e7ac9d19a701de9e6b (diff) | |
parent | 0c0849c3d8bf57a8b0d0bd9d6113639c58a28fd2 (diff) | |
download | ranger-4341846741b6623a1ead43485cfd5cf633453bb6.tar.gz |
Merge branch 'master' into cp
Conflicts: ranger/__main__.py ranger/core/actions.py
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 68 |
1 files changed, 17 insertions, 51 deletions
diff --git a/Makefile b/Makefile index 1f75728c..fd525721 100644 --- a/Makefile +++ b/Makefile @@ -14,14 +14,15 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. NAME = ranger -VERSION = 1.0.4 -PYTHON ?= python +VERSION = $(shell grep -m 1 -o '[0-9][0-9.]\+' README) +SNAPSHOT_NAME ?= $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar.gz +# Find suitable python version (need python >= 2.6 or 3.1): +PYTHON ?= $(shell python -c 'import sys; sys.exit(sys.version < "2.6")' && \ + which python || which python3.1 || which python3 || which python2.6) +SETUPOPTS ?= '--record=install_log.txt' DOCDIR ?= doc/pydoc -PREFIX ?= /usr -MANPREFIX ?= /share/man +DESTDIR ?= / PYOPTIMIZE ?= 1 -PYTHON_SITE_DEST ?= $(shell $(PYTHON) -c 'import sys; sys.stdout.write( \ - [p for p in sys.path if "site" in p][0])' 2> /dev/null) BMCOUNT ?= 5 # how often to run the benchmarks? CWD = $(shell pwd) @@ -34,79 +35,44 @@ options: help @echo 'Options:' @echo 'PYTHON = $(PYTHON)' @echo 'PYOPTIMIZE = $(PYOPTIMIZE)' - @echo 'PYTHON_SITE_DEST = $(PYTHON_SITE_DEST)' - @echo 'PREFIX = $(PREFIX)' - @echo 'MANPREFIX = $(MANPREFIX)' @echo 'DOCDIR = $(DOCDIR)' help: - @echo 'make: Compile $(NAME)' + @echo 'make install: Install $(NAME)' @echo 'make doc: Create the pydoc documentation' - @echo 'make install: Install ranger' @echo 'make clean: Remove the compiled files (*.pyc, *.pyo)' @echo 'make cleandoc: Remove the pydoc documentation' - @echo 'make uninstall: Uninstall ranger' @echo 'make snapshot: Create a tar.gz of the current git revision' @echo 'make test: Run all unittests.' -all: test compile install - install: - @if [ '$(PYTHON_SITE_DEST)' == '' ]; then \ - echo -n 'Cannot find a suitable destination for the files.'; \ - echo ' Please install $(NAME) manually.'; \ - false; \ - fi - @echo "Installing $(NAME) version $(VERSION)..." - @mkdir -p $(PREFIX)/bin - cp -f ranger.py $(PREFIX)/bin/ranger - @mkdir -p $(PYTHON_SITE_DEST) - cp -fruT ranger $(PYTHON_SITE_DEST)/ranger - @chmod 755 $(PREFIX)/bin/ranger - @chmod -R +rX $(PYTHON_SITE_DEST)/ranger - @mkdir -p $(PREFIX)$(MANPREFIX)/man1 - cp -f doc/ranger.1 $(PREFIX)$(MANPREFIX)/man1/ranger.1 - @chmod 644 $(PREFIX)$(MANPREFIX)/man1/ranger.1 - -uninstall: - rm -f $(PREFIX)/bin/ranger - rm -f '$(PREFIX)$(MANPREFIX)/man1/ranger.1' - @if [ '$(PYTHON_SITE_DEST)' == '' ]; then \ - echo 'Cannot find a possible location of rangers library files'; \ - false; \ - fi - rm -rf '$(PYTHON_SITE_DEST)/ranger/*' - @echo 'NOTE: By default, configuration files are stored at "~/.ranger".' - @echo 'This script will not delete those.' + $(PYTHON) setup.py install $(SETUPOPTS) \ + '--root=$(DESTDIR)' --optimize=$(PYOPTIMIZE) compile: clean - @echo 'Compiling...' - PYTHONOPTIMIZE=$(PYOPTIMIZE) python -m compileall -q ranger + PYTHONOPTIMIZE=$(PYOPTIMIZE) $(PYTHON) -m compileall -q ranger clean: - @echo 'Cleaning...' find . -regex .\*.py[co]\$$ -exec rm -f -- {} \; doc: cleandoc - @echo 'Creating pydoc html documentation...' mkdir -p $(DOCDIR) cd $(DOCDIR); \ $(PYTHON) -c 'import pydoc, sys; \ sys.path[0] = "$(CWD)"; \ pydoc.writedocs("$(CWD)")' + find . -name \*.html -exec sed -i 's|'$(CWD)'|../..|g' -- {} \; cleandoc: - @echo 'Removing pydoc html documentation...' - test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html + test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html || true test: - @./all_tests.py 1 + @$(PYTHON) test/all_tests.py 1 bm: - @./all_benchmarks.py $(BMCOUNT) + @$(PYTHON) test/all_benchmarks.py $(BMCOUNT) snapshot: - git archive HEAD | gzip > $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar.gz + git archive --prefix='$(NAME)-$(VERSION)/' --format=tar HEAD | gzip > $(SNAPSHOT_NAME) -.PHONY: default options all compile clean doc cleandoc test bm \ - install uninstall snapshot +.PHONY: default options compile clean doc cleandoc test bm snapshot install |