summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--INSTALL15
-rw-r--r--Makefile41
-rw-r--r--ranger/__init__.py3
-rw-r--r--ranger/colorschemes/default88.py2
-rw-r--r--test/__init__.py2
-rw-r--r--test/tc_colorscheme.py2
6 files changed, 53 insertions, 12 deletions
diff --git a/INSTALL b/INSTALL
index 269140c6..ee9e6285 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,8 +1,17 @@
-You can run ranger without installing by simply starting the executable
-file ranger.py in the top directory of this package.
+Installing
+==========
 
+YOU DON'T NEED TO INSTALL ANYTHING.
 
-To install ranger, follow this instructions:
+You can run ranger by simply starting the executable file ranger.py
+in the top directory of this package.
+
+
+If you insist on conventionally install it, for security reasons for
+example, follow these instructions:
+
+(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:
diff --git a/Makefile b/Makefile
index feef0bf0..92444a30 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,16 @@
 NAME = ranger
 VERSION = 1.0.3
-PYTHON = python
-DOCDIR = doc/pydoc
+PYTHON ?= python
+DOCDIR ?= doc/pydoc
+PREFIX ?= /usr/local
+PYTHONOPTIMIZE ?= 1
 CWD = $(shell pwd)
-EDITOR = vim
+EDITOR ?= vim
+DEST ?= $(shell $(PYTHON) -c 'import sys; sys.stdout.write( \
+	[p for p in sys.path if "site" in p][0])' 2> /dev/null)/ranger
 
-.PHONY: all clean doc cleandoc edit push test commit install info snapshot minimal_snapshot
+.PHONY: all compile clean doc cleandoc edit push test commit \
+	install uninstall info snapshot minimal_snapshot
 
 info:
 	@echo 'This makefile provides shortcuts for common tasks.'
@@ -21,7 +26,11 @@ info:
 	@echo 'make push: push the changes via git'
 	@echo 'make edit: open all relevant files in your editor'
 
-all: test
+all: test install
+
+compile: clean
+	@echo 'Compiling...'
+	PYTHONOPTIMIZE=$(PYTHONOPTIMIZE) python -m compileall -q ranger
 
 doc: cleandoc
 	mkdir -p $(DOCDIR)
@@ -30,8 +39,26 @@ doc: cleandoc
 		sys.path[0] = "$(CWD)"; \
 		pydoc.writedocs("$(CWD)")'
 
-install:
-	@less -XF INSTALL
+uninstall:
+	@echo 'To uninstall ranger, please remove these files:'
+	@echo $(DEST)'/*'
+	@echo $(PREFIX)'/bin/ranger'
+	@echo 'and optionally the config files at:'
+	@echo '~/.ranger'
+
+install: compile
+	@echo "Installing..."
+	cp ranger.py $(PREFIX)/bin/ranger
+	cp -ruT ranger $(DEST)
+	@echo '--------------------------------------'
+	@echo 'Finished.'
+	@echo 'If you use BASH or ZSH, you can activate an extra feature now:'
+	@echo 'When you exit ranger, the directory of the current shell can be'
+	@echo 'changed to the last visited directory in ranger.  To do so, add'
+	@echo 'this alias to your shell rc file (like ~/.bashrc):'
+	@echo 'alias rng="source ranger ranger"'
+	@echo 'And run ranger by typing rng.'
+
 
 cleandoc:
 	test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html
diff --git a/ranger/__init__.py b/ranger/__init__.py
index 8bd978d7..f4a54279 100644
--- a/ranger/__init__.py
+++ b/ranger/__init__.py
@@ -29,6 +29,7 @@ __copyright__ = """
 Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
 """
 
+arg = None
 USAGE = '%prog [options] [path/filename]'
 DEFAULT_CONFDIR = '~/.ranger'
 RANGERDIR = os.path.dirname(__file__)
@@ -62,4 +63,4 @@ def relpath(*paths):
 	return os.path.join(RANGERDIR, *paths)
 
 
-from ranger.__main__ import main
+from ranger.__main__ import main, parse_arguments
diff --git a/ranger/colorschemes/default88.py b/ranger/colorschemes/default88.py
index b78d1bb5..9af6dca7 100644
--- a/ranger/colorschemes/default88.py
+++ b/ranger/colorschemes/default88.py
@@ -30,7 +30,7 @@ class Scheme(Default):
 	def use(self, context):
 		fg, bg, attr = Default.use(self, context)
 
-		if curses.COLORS != 88:
+		if curses.COLORS < 88:
 			return fg, bg, attr
 
 		try:
diff --git a/test/__init__.py b/test/__init__.py
index 29796ac1..dc6dfc0d 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -18,6 +18,8 @@ import os, sys
 __all__ = [ x[0:x.index('.')] \
 		for x in os.listdir(os.path.dirname(__file__)) \
 		if x.startswith('tc_') ]
+import ranger
+ranger.arg = ranger.parse_arguments()
 
 def init():
 	sys.path.append(os.path.abspath(os.path.join(sys.path[0], '..')))
diff --git a/test/tc_colorscheme.py b/test/tc_colorscheme.py
index c09b9fa9..dbaac1f9 100644
--- a/test/tc_colorscheme.py
+++ b/test/tc_colorscheme.py
@@ -24,6 +24,8 @@ from ranger.gui.context import CONTEXT_KEYS
 class Test(TestCase):
 	def setUp(self):
 		import random
+		import curses
+		curses.COLORS = 88
 		schemes = []
 		for key, mod in vars(ranger.colorschemes).items():
 			if type(mod) == type(random):
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463