summary refs log tree commit diff stats
path: root/setup.py
blob: e63e28d27612854a1c449b93ab78708a339123b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/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

if __name__ == '__main__':
	distutils.core.setup(
		name='ranger',
		description='Vim-like file manager',
		long_description=ranger.__doc__,
		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'))
import * class TestSignal(unittest.TestCase): def setUp(self): self.sd = SignalDispatcher() def test_signal_register_emit(self): sd = self.sd def poo(sig): self.assert_('works' in sig) self.assertEqual('yes', sig.works) handler = sd.signal_bind('x', poo) sd.signal_emit('x', works='yes') sd.signal_unbind(handler) sd.signal_emit('x') def test_signal_order(self): sd = self.sd lst = [] def addn(n): return lambda _: lst.append(n) sd.signal_bind('x', addn(6)) sd.signal_bi
#!/usr/bin/python
# coding=utf-8

import sys, os

# Change the directory of the parent shell after exiting Ranger.
# Read the comments in wrapper.sh for more info.
try:
	assert sys.argv[1] == '--cd-after-exit'
	cd_after_exit = True
	sys.stderr = sys.stdout
	del sys.argv[1]
except:
	cd_after_exit = False

from ranger import debug, fm, options, environment, command, keys
from ranger.defaultui import DefaultUI as UI

# TODO: Parse arguments

# TODO: load config

def main():
	import locale, os
	os.stat_float_times(True)
	locale.setlocale(locale.LC_ALL, 'en_US.utf8')

	try:
		path = os.path.abspath('.')
		opt = options.dummy()
		env = environment.Environment(opt)
		commandlist = command.CommandList()
		keys.initialize_commands(commandlist)

		my_ui = UI(env, commandlist)
		my_fm = fm.FM(env)
		my_fm.feed(path, my_ui)
		my_fm.run()

	except BaseException as original_error:
		try: my_ui.exit()
		except: pass
	
		raise original_error

	finally:
		if cd_after_exit:
			try: sys.__stderr__.write(env.pwd.path)
			except: pass

if __name__ == "__main__": main()
lass="p">(
'mysignal') self.assertEqual('ab', ''.join(alphabet)) self.assertFalse(is_deleted[0]) del calc self.assertTrue(is_deleted[0]) def test_weak_refs_dead_on_arrival(self): sd = self.sd is_deleted = [False] class Foo(object): def __init__(self): self.alphabet = ['a'] def calc(self, signal): self.alphabet.append(chr(ord(self.alphabet[-1]) + 1)) def __del__(self): is_deleted[0] = True foo = Foo() alphabet = foo.alphabet self.assertEqual('a', ''.join(alphabet)) sd.signal_bind('mysignal', foo.calc, weak=True) sd.signal_emit('mysignal') self.assertEqual('ab', ''.join(alphabet)) self.assertFalse(is_deleted[0]) del foo sd.signal_emit('mysignal') self.assertEqual('ab', ''.join(alphabet)) self.assertTrue(is_deleted[0]) if __name__ == '__main__': unittest.main()