diff options
author | hut <hut@lavabit.com> | 2010-06-18 19:52:42 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-06-18 19:52:42 +0200 |
commit | 9518af1e5838643ef0fb68fd75fb275bb461ca3c (patch) | |
tree | 9e4db9eabe3574cc074bf3e3edba9d2a5d8e4111 | |
parent | dade4742ddcad69454f9a46f325edb930e72dd5a (diff) | |
parent | b06433bc03632ae0fe74381fa0a474d64b0fee94 (diff) | |
download | ranger-9518af1e5838643ef0fb68fd75fb275bb461ca3c.tar.gz |
Merge branch 'setup2'
-rw-r--r-- | INSTALL | 46 | ||||
-rw-r--r-- | Makefile | 62 | ||||
l--------- | scripts/ranger | 1 | ||||
-rwxr-xr-x | setup.py | 42 |
4 files changed, 67 insertions, 84 deletions
diff --git a/INSTALL b/INSTALL index 9939c11b..3f4e0198 100644 --- a/INSTALL +++ b/INSTALL @@ -1,45 +1,23 @@ Installing ========== -You don't need to install anything. +Use the package manager of your operating system to install ranger. -You can run ranger by simply starting the executable file ranger.py -in the top directory of this package. -Use the --clean option and it will leave no trace whatsoever on your system. +To install ranger manually, use either: +sudo ./setup.py install --optimize=1 --record=uninstall_info - -If you insist on conventionally install it, use the package manager -of your operating system. If there is no package or it is out of date, -you can also follow these instructions: - - -Step by step -============ - -(This is all done automagically if you type `sudo make install', -though you might want to read the Makefile first) - -0. Make sure you have a recent version of python, including the - curses module, which is the case if this shell command prints no errors: - python -c 'import curses, sys; assert sys.version >= "2.6"' - - -1. Copy the file "ranger.py" into any of the directories in the PATH - environment variable, for example to "/usr/bin/ranger" - - -2. Copy the directory "ranger" into one of the python module search - paths, for example to "/usr/lib/python2.6/site-packages/ranger". - - Ensure that the path is listed by the command: - python -c 'import sys; print("\n".join(sys.path))' +or for short: +sudo make install Uninstalling ============ -Use your package manager to uninstall ranger. If you manually installed -it, revert the steps described above. +Again, use your package manager to uninstall ranger. No other way for +automatically removing ranger is supported! + +However, if you installed ranger with the command above, all installed files +have been recorded to "uninstall_info". This information can be used to remove +ranger by hand, e.g.: -Ranger can also create a configuration directory at ~/.ranger which -you might want to remove as well. +cat uninstall_info | xargs -d "\n" sudo rm -- diff --git a/Makefile b/Makefile index 047f4e26..88abe024 100644 --- a/Makefile +++ b/Makefile @@ -15,17 +15,14 @@ NAME = ranger VERSION = $(shell cat README | grep -m 1 -o '[0-9][0-9.]\+') -PYTHON ?= python +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=uninstall_info' DOCDIR ?= doc/pydoc -PREFIX ?= /usr -MANPREFIX ?= /share/man +DESTDIR ?= / PYOPTIMIZE ?= 1 -# this finds the shortest item in sys.path that contains "site" or "dist" -# for example: /usr/lib/python2.6/site-packages -PYTHON_SITE_DEST ?= $(shell $(PYTHON) -c 'import sys; \ - dests = sorted([p for p in sys.path if "site" in p or "dist" in p], \ - key=lambda dest: len(dest)); \ - sys.stdout.write(dests[0])' 2> /dev/null) BMCOUNT ?= 5 # how often to run the benchmarks? CWD = $(shell pwd) @@ -38,69 +35,35 @@ 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 $(DESTDIR)$(PREFIX)/bin - cp -f ranger.py $(DESTDIR)$(PREFIX)/bin/ranger - @mkdir -p $(DESTDIR)$(PYTHON_SITE_DEST) - cp -fruT ranger $(DESTDIR)$(PYTHON_SITE_DEST)/ranger - @chmod 755 $(DESTDIR)$(PREFIX)/bin/ranger - @chmod -R +rX $(DESTDIR)$(PYTHON_SITE_DEST)/ranger - @mkdir -p $(DESTDIR)$(PREFIX)$(MANPREFIX)/man1 - cp -f doc/ranger.1 $(DESTDIR)$(PREFIX)$(MANPREFIX)/man1/ranger.1 - @chmod 644 $(DESTDIR)$(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 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)")' + rm $(DOCDIR)/test* cleandoc: - @echo 'Removing pydoc html documentation...' test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html test: @@ -110,7 +73,6 @@ bm: @$(PYTHON) test/all_benchmarks.py $(BMCOUNT) snapshot: - git archive --prefix='$(NAME)-$(VERSION)/' --format=tar 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 diff --git a/scripts/ranger b/scripts/ranger new file mode 120000 index 00000000..21b7d3ee --- /dev/null +++ b/scripts/ranger @@ -0,0 +1 @@ +../ranger.py \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100755 index 00000000..17cfc660 --- /dev/null +++ b/setup.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# Copyright (C) 2009, 2010 Roman Zimbelmann <romanz@lavabit.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import distutils.core +import ranger + +distutils.core.setup( + name='ranger', + description='Vim-like file manager', + version=ranger.__version__, + author=ranger.__author__, + author_email=ranger.__email__, + license=ranger.__license__, + url='http://savannah.nongnu.org/projects/ranger', + scripts=['scripts/ranger'], + data_files=[('share/man/man1', ['doc/ranger.1'])], + package_data={'ranger': ['data/*']}, + packages=('ranger', + 'ranger.api', + 'ranger.colorschemes', + 'ranger.container', + 'ranger.core', + 'ranger.defaults', + 'ranger.ext', + 'ranger.fsobject', + 'ranger.gui', + 'ranger.gui.widgets', + 'ranger.help', + 'ranger.shared')) |