summary refs log blame commit diff stats
path: root/Makefile
blob: 1f75728c46f27c03d83be9c6a9a8cf5dd7dfdf18 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                       
             
               

                   

                       
               

                                                                         


                                                
 
                
                                                            
 



                                  
                                          






                                                      

                                                        


                                                                    
                                                                          
                                             
 




























                                                                                  


                            
                                                                   
 
      
                           

                                                        
             
                                                    





                                                  
         
                                                    
                                                      
 
     
                         

   
                                       

         
                                                                                                    
 
                                                                
                                  
# 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/>.

NAME = ranger
VERSION = 1.0.4
PYTHON ?= python
DOCDIR ?= doc/pydoc
PREFIX ?= /usr
MANPREFIX ?= /share/man
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)

default: compile
	@echo 'Run `make options` for a list of all options'

options: help
	@echo
	@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 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.'

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)")'

cleandoc:
	@echo 'Removing pydoc html documentation...'
	test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html

test:
	@./all_tests.py 1

bm:
	@./all_benchmarks.py $(BMCOUNT)

snapshot:
	git archive HEAD | gzip > $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar.gz

.PHONY: default options all compile clean doc cleandoc test bm \
	install uninstall snapshot
class="w"> Renaming multiple files at once * VIM-like console and hotkeys * Automatically determine file types and run them with correct programs * Change the directory of your shell after exiting ranger * Tabs, Bookmarks, Mouse support Dependencies ------------ * Python (tested with version 2.6, 2.7, 3.1, 3.2) with the "curses" module and (optionally) wide-unicode support. * A pager ("less" by default) Optional: * The "file" program for determining file types * The python module "chardet", in case of encoding detection problems * "sudo" to use the "run as root"-feature * w3m for the "w3mimgdisplay" program to preview images Optional, for enhanced file previews (with "scope.sh"): * img2txt (from caca-utils) for ASCII-art image previews * highlight for syntax highlighting of code * atool for previews of archives * lynx, w3m or elinks for previews of html pages * pdftotext for pdf previews * transmission-show for viewing bit-torrent information * mediainfo or exiftool for viewing information about media files Installing ---------- Use the package manager of your operating system to install ranger. Note that ranger can be started without installing by simply running ranger.py. To install ranger manually: sudo make install This translates roughly to: sudo python setup.py install --optimize=1 --record=install_log.txt This also saves a list of all installed files to install_log.txt, which you can use to uninstall ranger. Getting Started --------------- After starting ranger, you can use the Arrow Keys (or hjkl) to navigate, Enter to open a file or type Q to quit. The third column shows a preview of the current file. The second is the main column and the first shows the parent directory. Ranger can automatically copy default configuration files to ~/.config/ranger if you run it with the switch --copy-config. (see ranger --help for a description of that switch.) Also check ranger/config/ for the default configuration.