From 0128bee71f734138d3f49f56092688bb0623c6a2 Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 11 Mar 2010 20:27:25 +0100 Subject: working on the configuration system / main method --- INSTALL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'INSTALL') diff --git a/INSTALL b/INSTALL index 4635478b..269140c6 100644 --- a/INSTALL +++ b/INSTALL @@ -27,4 +27,4 @@ To install ranger, follow this instructions: alias rng="source ranger ranger" (Unfortunately this feature is shell dependent. It has been - successfully tested with BASH only.) + successfully tested with BASH and ZSH only.) -- cgit 1.4.1-2-gfad0 From 94c5d83e6752cf6506c78c9454c08b9f3df9371c Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 12 Mar 2010 00:38:07 +0100 Subject: misc changes, make install --- INSTALL | 15 ++++++++++++--- Makefile | 41 +++++++++++++++++++++++++++++++++------- ranger/__init__.py | 3 ++- ranger/colorschemes/default88.py | 2 +- test/__init__.py | 2 ++ test/tc_colorscheme.py | 2 ++ 6 files changed, 53 insertions(+), 12 deletions(-) (limited to 'INSTALL') 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 """ +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): -- cgit 1.4.1-2-gfad0 From 7582555b50f058b316c04ce8ab977bed36da1585 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 12 Mar 2010 19:19:56 +0100 Subject: more documentation --- INSTALL | 22 +++++++++++++++++++--- README | 13 ++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) (limited to 'INSTALL') diff --git a/INSTALL b/INSTALL index ee9e6285..d14d3891 100644 --- a/INSTALL +++ b/INSTALL @@ -1,14 +1,20 @@ Installing ========== -YOU DON'T NEED TO INSTALL ANYTHING. +You don't need to install anything. 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. -If you insist on conventionally install it, for security reasons for -example, follow these instructions: +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) @@ -37,3 +43,13 @@ though you might want to read the Makefile first) (Unfortunately this feature is shell dependent. It has been successfully tested with BASH and ZSH only.) + + +Uninstalling +============ + +Use your package manager to uninstall ranger. If you manually installed +it, revert the steps described above. + +Ranger can also create a configuration directory at ~/.ranger which +you might want to remove as well. diff --git a/README b/README index d133e568..de532379 100644 --- a/README +++ b/README @@ -69,10 +69,17 @@ If this applies to you, please include such a traceback in your report. Getting Started --------------- -At first, it's a good idea to create a symlink in your bin dir: - sudo ln -s /path/to/ranger.py /usr/bin/ranger +If you just want to check out ranger without installing it, type -Now type in ranger to start it. + ./ranger.py --clean + +in the top directory of ranger. By using the --clean switch, it will +leave no trace on your system whatsoever. + +To properly install it, follow the instructions in the INSTALL file, +then type: + + ranger You should see 4 columns. The third is the directory where you are at the moment. To the left, there are the directories above the current -- cgit 1.4.1-2-gfad0