Ejemplo n.º 1
0
    def handle(self, *args, **options):
        # The dennis command line handler already has all the option
        # and argument parsing. So rather than repeat that here, we
        # tweak some arguments and then pass it through to the dennis
        # command line handler.
        # 
        # Also, it turns out args has different stuff in it depend on
        # whether this command is run through call_command() or
        # ./manage.py. So we selectively nix some args ('manage.py'
        # and the subcommand) if they're there and if not, we don't worry
        # about it.
        if self.dennis_subcommand in args:
            args = args[args.index(self.dennis_subcommand)+1:]

        args = [self.dennis_subcommand] + list(args)

        sys.exit(cmdline_handler('manage.py ' + self.dennis_subcommand, args))
Ejemplo n.º 2
0
#!/usr/bin/env python
import os
import site
import sys


ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
path = lambda *a: os.path.join(ROOT, *a)

prev_sys_path = list(sys.path)

site.addsitedir(path('vendor'))

# Move the new items to the front of sys.path.
new_sys_path = []
for item in list(sys.path):
    if item not in prev_sys_path:
        new_sys_path.append(item)
        sys.path.remove(item)
sys.path[:0] = new_sys_path

# Now we can import from third-party libraries.
from dennis.cmdline import cmdline_handler


if __name__ == '__main__':
    sys.exit(cmdline_handler("dennis-cmd", sys.argv[1:]))