From ec598fc7e3919abe2b157592c9a42acaeb3c2e7c Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 17 May 2010 22:46:42 +0200 Subject: make: added DESTDIR to Makefile Patch by David Woodfall --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1f75728c..9cc822a1 100644 --- a/Makefile +++ b/Makefile @@ -58,15 +58,15 @@ install: 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 + @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 -- cgit 1.4.1-2-gfad0 From dee6cfa6f24ad3e8bf83df6dc594038193d069bf Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 17 May 2010 22:58:51 +0200 Subject: make: replace literal python with $(PYTHON) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9cc822a1..5a86d371 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,7 @@ uninstall: compile: clean @echo 'Compiling...' - PYTHONOPTIMIZE=$(PYOPTIMIZE) python -m compileall -q ranger + PYTHONOPTIMIZE=$(PYOPTIMIZE) $(PYTHON) -m compileall -q ranger clean: @echo 'Cleaning...' -- cgit 1.4.1-2-gfad0 From 0d64ca5f078f6a56b0df92e2b90fb5940f7c03d6 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 25 May 2010 18:17:34 +0200 Subject: make bm, make test: make use of PYTHON variable --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5a86d371..6a103a02 100644 --- a/Makefile +++ b/Makefile @@ -100,10 +100,10 @@ cleandoc: test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html test: - @./all_tests.py 1 + @$(PYTHON) all_tests.py 1 bm: - @./all_benchmarks.py $(BMCOUNT) + @$(PYTHON) all_benchmarks.py $(BMCOUNT) snapshot: git archive HEAD | gzip > $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar.gz -- cgit 1.4.1-2-gfad0 From 85fd52880db93c6cd01f2c459eb46e6dd35d777c Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 7 Jun 2010 15:53:01 +0200 Subject: simplified all_tests.py, moved to test/ --- Makefile | 4 ++-- all_benchmarks.py | 58 -------------------------------------------------- all_tests.py | 36 ------------------------------- test/__init__.py | 52 -------------------------------------------- test/all_benchmarks.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ test/all_tests.py | 33 ++++++++++++++++++++++++++++ test/bm_loader.py | 2 +- test/ranger | 1 + test/tc_bookmarks.py | 2 -- test/tc_colorscheme.py | 2 -- test/tc_direction.py | 2 -- test/tc_directory.py | 2 -- test/tc_displayable.py | 4 +--- test/tc_ext.py | 1 - test/tc_history.py | 2 -- test/tc_keyapi.py | 2 -- test/tc_loader.py | 4 +--- test/tc_newkeys.py | 3 +-- test/tc_signal.py | 1 - test/tc_ui.py | 6 ++---- test/tc_utfwidth.py | 2 -- test/test.py | 20 ----------------- test/testlib.py | 43 +++++++++++++++++++++++++++++++++++++ 23 files changed, 143 insertions(+), 197 deletions(-) delete mode 100755 all_benchmarks.py delete mode 100755 all_tests.py create mode 100755 test/all_benchmarks.py create mode 100755 test/all_tests.py create mode 120000 test/ranger delete mode 100644 test/test.py create mode 100644 test/testlib.py (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6a103a02..a5589803 100644 --- a/Makefile +++ b/Makefile @@ -100,10 +100,10 @@ cleandoc: test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html test: - @$(PYTHON) all_tests.py 1 + @$(PYTHON) test/all_tests.py 1 bm: - @$(PYTHON) 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 diff --git a/all_benchmarks.py b/all_benchmarks.py deleted file mode 100755 index 73316658..00000000 --- a/all_benchmarks.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/python -# Copyright (C) 2009, 2010 Roman Zimbelmann -# -# 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 . - -"""Run all the tests inside the test/ directory as a test suite.""" -if __name__ == '__main__': - from re import compile - from test import * - from time import time - from types import FunctionType as function - from sys import argv - bms = [] - try: - n = int(argv[1]) - except IndexError: - n = 10 - if len(argv) > 2: - args = [compile(re) for re in argv[2:]] - def allow(name): - for re in args: - if re.search(name): - return True - else: - return False - else: - allow = lambda name: True - for key, val in vars().copy().items(): - if key.startswith('bm_'): - bms.extend(v for k,v in vars(val).items() if type(v) == type) - for bmclass in bms: - for attrname in vars(bmclass): - if not attrname.startswith('bm_'): - continue - bmobj = bmclass() - t1 = time() - method = getattr(bmobj, attrname) - methodname = "{0}.{1}".format(bmobj.__class__.__name__, method.__name__) - if allow(methodname): - try: - method(n) - except: - print("{0} failed!".format(methodname)) - raise - else: - t2 = time() - print("{0:60}: {1:10}s".format(methodname, t2 - t1)) diff --git a/all_tests.py b/all_tests.py deleted file mode 100755 index 90926918..00000000 --- a/all_tests.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/python -# Copyright (C) 2009, 2010 Roman Zimbelmann -# -# 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 . - -"""Run all the tests inside the test/ directory as a test suite.""" -if __name__ == '__main__': - import unittest - from test import * - from sys import exit, argv - - try: - verbosity = int(argv[1]) - except IndexError: - verbosity = 2 - - tests = [] - for key, val in vars().copy().items(): - if key.startswith('tc_'): - tests.extend(v for k,v in vars(val).items() if type(v) == type) - - suite = unittest.TestSuite(map(unittest.makeSuite, tests)) - result = unittest.TextTestRunner(verbosity=verbosity).run(suite) - if len(result.errors) + len(result.failures) > 0: - exit(1) diff --git a/test/__init__.py b/test/__init__.py index d87d1fc2..e69de29b 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1,52 +0,0 @@ -# Copyright (C) 2009, 2010 Roman Zimbelmann -# -# 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 . - -import os, sys - -__all__ = [ x[0:x.index('.')] \ - for x in os.listdir(os.path.dirname(__file__)) \ - if x.startswith('tc_') or x.startswith('bm_')] - -def TODO(fnc): - def result(*arg, **kw): - try: - fnc(*arg, **kw) - except: - pass # failure expected - return result - -def init(): - sys.path.append(os.path.abspath(os.path.join(sys.path[0], '..'))) - -class Fake(object): - def __getattr__(self, attrname): - val = Fake() - self.__dict__[attrname] = val - return val - - def __call__(self, *_, **__): - return Fake() - - def __clear__(self): - self.__dict__.clear() - - def __iter__(self): - return iter(()) - -class OK(Exception): - pass - -def raise_ok(*_, **__): - raise OK() diff --git a/test/all_benchmarks.py b/test/all_benchmarks.py new file mode 100755 index 00000000..73316658 --- /dev/null +++ b/test/all_benchmarks.py @@ -0,0 +1,58 @@ +#!/usr/bin/python +# Copyright (C) 2009, 2010 Roman Zimbelmann +# +# 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 . + +"""Run all the tests inside the test/ directory as a test suite.""" +if __name__ == '__main__': + from re import compile + from test import * + from time import time + from types import FunctionType as function + from sys import argv + bms = [] + try: + n = int(argv[1]) + except IndexError: + n = 10 + if len(argv) > 2: + args = [compile(re) for re in argv[2:]] + def allow(name): + for re in args: + if re.search(name): + return True + else: + return False + else: + allow = lambda name: True + for key, val in vars().copy().items(): + if key.startswith('bm_'): + bms.extend(v for k,v in vars(val).items() if type(v) == type) + for bmclass in bms: + for attrname in vars(bmclass): + if not attrname.startswith('bm_'): + continue + bmobj = bmclass() + t1 = time() + method = getattr(bmobj, attrname) + methodname = "{0}.{1}".format(bmobj.__class__.__name__, method.__name__) + if allow(methodname): + try: + method(n) + except: + print("{0} failed!".format(methodname)) + raise + else: + t2 = time() + print("{0:60}: {1:10}s".format(methodname, t2 - t1)) diff --git a/test/all_tests.py b/test/all_tests.py new file mode 100755 index 00000000..dff49b60 --- /dev/null +++ b/test/all_tests.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +# Copyright (C) 2009, 2010 Roman Zimbelmann +# +# 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 . + +"""Run all the tests inside the test/ directory as a test suite.""" +if __name__ == '__main__': + import unittest + import sys + import os + + try: + verbosity = int(sys.argv[1]) + except IndexError: + verbosity = 2 + + ls = os.listdir(sys.path[0]) + paths = [p[:-3] for p in ls if p[:3] == 'tc_' and p[-3:] == '.py'] + suite = unittest.TestLoader().loadTestsFromNames(paths) + result = unittest.TextTestRunner(verbosity=verbosity).run(suite) + if len(result.errors) + len(result.failures) > 0: + sys.exit(1) diff --git a/test/bm_loader.py b/test/bm_loader.py index 745e6f3b..968640a5 100644 --- a/test/bm_loader.py +++ b/test/bm_loader.py @@ -18,7 +18,7 @@ from ranger.fsobject import Directory, File from ranger.ext.openstruct import OpenStruct import os.path from ranger.shared import FileManagerAware, SettingsAware -from test import Fake +from testlib import Fake from os.path import realpath, join, dirname from subprocess import Popen, PIPE TESTDIR = realpath(join(dirname(__file__), '/usr/include')) diff --git a/test/ranger b/test/ranger new file mode 120000 index 00000000..5459458c --- /dev/null +++ b/test/ranger @@ -0,0 +1 @@ +../ranger \ No newline at end of file diff --git a/test/tc_bookmarks.py b/test/tc_bookmarks.py index f45ba061..9b41f1c6 100644 --- a/test/tc_bookmarks.py +++ b/test/tc_bookmarks.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() - from os.path import realpath, join, dirname import unittest import os diff --git a/test/tc_colorscheme.py b/test/tc_colorscheme.py index dbaac1f9..8d6adee6 100644 --- a/test/tc_colorscheme.py +++ b/test/tc_colorscheme.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() - from unittest import TestCase, main import random import ranger.colorschemes diff --git a/test/tc_direction.py b/test/tc_direction.py index f45b4b36..5c1776cf 100644 --- a/test/tc_direction.py +++ b/test/tc_direction.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() - import unittest from ranger.ext.direction import Direction from ranger.ext.openstruct import OpenStruct diff --git a/test/tc_directory.py b/test/tc_directory.py index 024ebc9d..a702c4db 100644 --- a/test/tc_directory.py +++ b/test/tc_directory.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() - import sys from os.path import realpath, join, dirname diff --git a/test/tc_displayable.py b/test/tc_displayable.py index 50f37845..1c66a40e 100644 --- a/test/tc_displayable.py +++ b/test/tc_displayable.py @@ -13,14 +13,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() - import unittest import curses from random import randint from ranger.gui.displayable import Displayable, DisplayableContainer -from test import Fake, OK, raise_ok, TODO +from testlib import Fake, OK, raise_ok, TODO class TestWithFakeCurses(unittest.TestCase): def setUp(self): diff --git a/test/tc_ext.py b/test/tc_ext.py index b8094233..919f35a2 100644 --- a/test/tc_ext.py +++ b/test/tc_ext.py @@ -13,7 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() import unittest from collections import deque diff --git a/test/tc_history.py b/test/tc_history.py index d027231a..33784e14 100644 --- a/test/tc_history.py +++ b/test/tc_history.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() - from ranger.container import History from unittest import TestCase, main import unittest diff --git a/test/tc_keyapi.py b/test/tc_keyapi.py index 2f522173..48282a7d 100644 --- a/test/tc_keyapi.py +++ b/test/tc_keyapi.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() - from unittest import TestCase, main class Test(TestCase): diff --git a/test/tc_loader.py b/test/tc_loader.py index 53ac5617..9f7f7322 100644 --- a/test/tc_loader.py +++ b/test/tc_loader.py @@ -13,13 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() - import unittest import os from os.path import realpath, join, dirname -from test import Fake +from testlib import Fake from ranger.shared import FileManagerAware, SettingsAware from ranger.core.loader import Loader from ranger.fsobject import Directory, File diff --git a/test/tc_newkeys.py b/test/tc_newkeys.py index c7a33025..fd856f17 100644 --- a/test/tc_newkeys.py +++ b/test/tc_newkeys.py @@ -14,10 +14,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() from unittest import TestCase, main -from test import TODO +from testlib import TODO from ranger.ext.tree import Tree from ranger.container.keymap import * from ranger.container.keybuffer import KeyBuffer diff --git a/test/tc_signal.py b/test/tc_signal.py index 35b4eebe..f31681f4 100644 --- a/test/tc_signal.py +++ b/test/tc_signal.py @@ -13,7 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() import unittest import gc from ranger.ext.signal_dispatcher import * diff --git a/test/tc_ui.py b/test/tc_ui.py index 3c659459..dc8d669d 100644 --- a/test/tc_ui.py +++ b/test/tc_ui.py @@ -13,14 +13,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() - import unittest import curses from ranger.gui import ui -from test import Fake, OK, raise_ok +from testlib import Fake, OK, raise_ok ui.curses = Fake() @@ -39,7 +37,7 @@ class Test(unittest.TestCase): def tearDown(self): self.ui.destroy() - + def test_passing(self): # Test whether certain method calls are passed to widgets widget = self.ui.widget diff --git a/test/tc_utfwidth.py b/test/tc_utfwidth.py index d8ffbe1d..2aa5fa6d 100644 --- a/test/tc_utfwidth.py +++ b/test/tc_utfwidth.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if __name__ == '__main__': from __init__ import init; init() - from unittest import TestCase, main from ranger.ext.utfwidth import * diff --git a/test/test.py b/test/test.py deleted file mode 100644 index d0a69e5a..00000000 --- a/test/test.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (C) 2009, 2010 Roman Zimbelmann -# -# 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 . - -"""Workaround to allow running single test cases directly""" -try: - from __init__ import init, Fake, OK, raise_ok, TODO -except: - from test import init, Fake, OK, raise_ok, TODO diff --git a/test/testlib.py b/test/testlib.py new file mode 100644 index 00000000..29dd9e07 --- /dev/null +++ b/test/testlib.py @@ -0,0 +1,43 @@ +# Copyright (C) 2009, 2010 Roman Zimbelmann +# +# 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 . + +def TODO(fnc): + def result(*arg, **kw): + try: + fnc(*arg, **kw) + except: + pass # failure expected + return result + +class Fake(object): + def __getattr__(self, attrname): + val = Fake() + self.__dict__[attrname] = val + return val + + def __call__(self, *_, **__): + return Fake() + + def __clear__(self): + self.__dict__.clear() + + def __iter__(self): + return iter(()) + +class OK(Exception): + pass + +def raise_ok(*_, **__): + raise OK() -- cgit 1.4.1-2-gfad0 From 8c275ccfa881998d96bdb5c1585118882630254b Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 9 Jun 2010 10:49:15 +0200 Subject: Makefile: dynamically get the version number --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a5589803..dc030b5a 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ # along with this program. If not, see . NAME = ranger -VERSION = 1.0.4 +VERSION = $(shell cat README | grep -m 1 -o '[0-9][0-9.]\+') PYTHON ?= python DOCDIR ?= doc/pydoc PREFIX ?= /usr -- cgit 1.4.1-2-gfad0 From 7906e083ad518e821f89ead5ba47b8cfce989d28 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 14 Jun 2010 20:32:16 +0200 Subject: make install: Fixed script for finding PYTHON_SITE_DEST --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index dc030b5a..57a3f8f2 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,12 @@ 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) +# 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) -- cgit 1.4.1-2-gfad0 From e278a0035654437cfd28d9c139ba0a08cb01294a Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 14 Jun 2010 20:35:26 +0200 Subject: make snapshot: prefix ranger-$VERSION/ in archives --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 57a3f8f2..047f4e26 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ bm: @$(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 > $(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 -- cgit 1.4.1-2-gfad0 From 636d93936d26fccdf6fe530568db1b4c41c3f2bf Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 18 Jun 2010 12:58:17 +0200 Subject: Makefile: removed functions which are now handled by setup.py --- Makefile | 55 ++++--------------------------------------------------- 1 file changed, 4 insertions(+), 51 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 047f4e26..fc5b1cf8 100644 --- a/Makefile +++ b/Makefile @@ -15,17 +15,10 @@ NAME = ranger VERSION = $(shell cat README | grep -m 1 -o '[0-9][0-9.]\+') +SNAPSHOT_NAME ?= $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar.gz PYTHON ?= python DOCDIR ?= doc/pydoc -PREFIX ?= /usr -MANPREFIX ?= /share/man 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 +31,30 @@ 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 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.' - 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 +64,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 -- cgit 1.4.1-2-gfad0 From 582f3519f70332f88fea0055cdd1b2291e029a2e Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 18 Jun 2010 16:04:43 +0200 Subject: Rewrote INSTALL and "make (un)install" --- INSTALL | 48 ++++++++++++++---------------------------------- Makefile | 14 ++++++++++++-- 2 files changed, 26 insertions(+), 36 deletions(-) (limited to 'Makefile') diff --git a/INSTALL b/INSTALL index 9939c11b..b5b1f066 100644 --- a/INSTALL +++ b/INSTALL @@ -1,45 +1,25 @@ 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. +Ranger uses python distutils to install ranger which does not support automatic +uninstalling. + +However, after installing ranger with one of the ways above, all installed +files are recorded to "uninstall_info". This information can be used to +remove ranger: +cat uninstall_info | xargs -d "\n" sudo rm -- -Ranger can also create a configuration directory at ~/.ranger which -you might want to remove as well. +or simply: +sudo make uninstall diff --git a/Makefile b/Makefile index fc5b1cf8..2f2417de 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,11 @@ NAME = ranger VERSION = $(shell cat README | grep -m 1 -o '[0-9][0-9.]\+') SNAPSHOT_NAME ?= $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar.gz -PYTHON ?= python +# 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) DOCDIR ?= doc/pydoc +DESTDIR ?= / PYOPTIMIZE ?= 1 BMCOUNT ?= 5 # how often to run the benchmarks? @@ -40,6 +43,13 @@ help: @echo 'make snapshot: Create a tar.gz of the current git revision' @echo 'make test: Run all unittests.' +install: + $(PYTHON) setup.py install --record=uninstall_info \ + '--root=$(DESTDIR)' --optimize=$(PYOPTIMIZE) + +uninstall: + cd $(DESTDIR) && cat $(CWD)/uninstall_info | xargs -d "\n" rm -- + compile: clean PYTHONOPTIMIZE=$(PYOPTIMIZE) $(PYTHON) -m compileall -q ranger @@ -66,4 +76,4 @@ bm: snapshot: git archive --prefix='$(NAME)-$(VERSION)/' --format=tar HEAD | gzip > $(SNAPSHOT_NAME) -.PHONY: default options compile clean doc cleandoc test bm snapshot +.PHONY: default options compile clean doc cleandoc test bm snapshot install uninstall -- cgit 1.4.1-2-gfad0 From b06433bc03632ae0fe74381fa0a474d64b0fee94 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 18 Jun 2010 17:11:54 +0200 Subject: Removed built-in support for uninstalling. Since distutils (setup.py) is used and distutils doesn't support uninstalling, I shouldn't implement my own half-assed, potentially dangerous uninstall script either. --- INSTALL | 14 ++++++-------- Makefile | 9 ++++----- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'Makefile') diff --git a/INSTALL b/INSTALL index b5b1f066..3f4e0198 100644 --- a/INSTALL +++ b/INSTALL @@ -13,13 +13,11 @@ sudo make install Uninstalling ============ -Ranger uses python distutils to install ranger which does not support automatic -uninstalling. +Again, use your package manager to uninstall ranger. No other way for +automatically removing ranger is supported! -However, after installing ranger with one of the ways above, all installed -files are recorded to "uninstall_info". This information can be used to -remove ranger: -cat uninstall_info | xargs -d "\n" sudo rm -- +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.: -or simply: -sudo make uninstall +cat uninstall_info | xargs -d "\n" sudo rm -- diff --git a/Makefile b/Makefile index 2f2417de..88abe024 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ SNAPSHOT_NAME ?= $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar # 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 DESTDIR ?= / PYOPTIMIZE ?= 1 @@ -37,6 +38,7 @@ options: help @echo 'DOCDIR = $(DOCDIR)' help: + @echo 'make install: Install $(NAME)' @echo 'make doc: Create the pydoc documentation' @echo 'make clean: Remove the compiled files (*.pyc, *.pyo)' @echo 'make cleandoc: Remove the pydoc documentation' @@ -44,12 +46,9 @@ help: @echo 'make test: Run all unittests.' install: - $(PYTHON) setup.py install --record=uninstall_info \ + $(PYTHON) setup.py install $(SETUPOPTS) \ '--root=$(DESTDIR)' --optimize=$(PYOPTIMIZE) -uninstall: - cd $(DESTDIR) && cat $(CWD)/uninstall_info | xargs -d "\n" rm -- - compile: clean PYTHONOPTIMIZE=$(PYOPTIMIZE) $(PYTHON) -m compileall -q ranger @@ -76,4 +75,4 @@ bm: snapshot: git archive --prefix='$(NAME)-$(VERSION)/' --format=tar HEAD | gzip > $(SNAPSHOT_NAME) -.PHONY: default options compile clean doc cleandoc test bm snapshot install uninstall +.PHONY: default options compile clean doc cleandoc test bm snapshot install -- cgit 1.4.1-2-gfad0 From 3edc9f863190f7792e0e5d0fa828e6dfa2ddbf29 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 18 Jun 2010 19:58:53 +0200 Subject: INSTALL: changed logname from uninstall_info to install_log.txt --- INSTALL | 6 +++--- Makefile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/INSTALL b/INSTALL index 3f4e0198..fc594c86 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ Installing Use the package manager of your operating system to install ranger. To install ranger manually, use either: -sudo ./setup.py install --optimize=1 --record=uninstall_info +sudo ./setup.py install --optimize=1 --record=install_log.txt or for short: sudo make install @@ -17,7 +17,7 @@ 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 +have been recorded to "install_log.txt". This information can be used to remove ranger by hand, e.g.: -cat uninstall_info | xargs -d "\n" sudo rm -- +cat install_log.txt | xargs -d "\n" sudo rm -- diff --git a/Makefile b/Makefile index 88abe024..09463244 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ SNAPSHOT_NAME ?= $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar # 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' +SETUPOPTS ?= '--record=install_log.txt' DOCDIR ?= doc/pydoc DESTDIR ?= / PYOPTIMIZE ?= 1 -- cgit 1.4.1-2-gfad0 From ad75190ca665da01940b0c01e12b767f29dc8bc0 Mon Sep 17 00:00:00 2001 From: shpelda Date: Sun, 20 Jun 2010 01:57:43 +0200 Subject: commited pydocs are author agnostic --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 09463244..cc9fff9c 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,8 @@ doc: cleandoc $(PYTHON) -c 'import pydoc, sys; \ sys.path[0] = "$(CWD)"; \ pydoc.writedocs("$(CWD)")' - rm $(DOCDIR)/test* + rm $(DOCDIR)/test*; \ + find . -name \*.html -exec sed -i 's|'$(CWD)'|../..|g' -- {} \; cleandoc: test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html -- cgit 1.4.1-2-gfad0 From 25a4162d4249c0c148438bfa2255c9f6af702569 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 21 Jun 2010 00:18:32 +0200 Subject: make doc: minor cleanup and fix --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index cc9fff9c..57db7b11 100644 --- a/Makefile +++ b/Makefile @@ -61,11 +61,11 @@ doc: cleandoc $(PYTHON) -c 'import pydoc, sys; \ sys.path[0] = "$(CWD)"; \ pydoc.writedocs("$(CWD)")' - rm $(DOCDIR)/test*; \ + rm $(DOCDIR)/test* find . -name \*.html -exec sed -i 's|'$(CWD)'|../..|g' -- {} \; cleandoc: - test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html + test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html || true test: @$(PYTHON) test/all_tests.py 1 -- cgit 1.4.1-2-gfad0 From df2e1f7df4296e32f9597f6a78eac27f544ca12b Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 24 Jun 2010 20:31:41 +0200 Subject: Makefile: simplification --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 57db7b11..1b26e117 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ # along with this program. If not, see . NAME = ranger -VERSION = $(shell cat README | grep -m 1 -o '[0-9][0-9.]\+') +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")' && \ -- cgit 1.4.1-2-gfad0 From 27eec7c6b53303acfd7713f7cc696ea50894a6b1 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 11 Sep 2010 22:56:00 +0200 Subject: Makefile, setup.py: Fixed `make doc` --- Makefile | 1 - setup.py | 47 ++++++++++++++++++++++++----------------------- 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1b26e117..fd525721 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,6 @@ doc: cleandoc $(PYTHON) -c 'import pydoc, sys; \ sys.path[0] = "$(CWD)"; \ pydoc.writedocs("$(CWD)")' - rm $(DOCDIR)/test* find . -name \*.html -exec sed -i 's|'$(CWD)'|../..|g' -- {} \; cleandoc: diff --git a/setup.py b/setup.py index 17cfc660..587b52c0 100755 --- a/setup.py +++ b/setup.py @@ -17,26 +17,27 @@ 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')) +if __name__ == '__main__': + 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')) -- cgit 1.4.1-2-gfad0