File: debtorrent-tracker.py

package info (click to toggle)
debtorrent 0.1.9
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 1,452 kB
  • ctags: 1,183
  • sloc: python: 13,526; sh: 274; makefile: 51
file content (38 lines) | stat: -rwxr-xr-x 1,036 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env python
#
# Written by Bram Cohen
# Modified by Cameron Dale
# see LICENSE.txt for license information
#
# $Id: debtorrent-tracker.py 270 2007-08-19 07:33:13Z camrdale-guest $

"""Start a debtorrent download tracker."""

from DebTorrent import PSYCO
if PSYCO.psyco:
    try:
        import psyco
        assert psyco.__version__ >= 0x010100f0
        psyco.full()
    except:
        pass

PROFILE = 0
    
from sys import argv, version_info
from DebTorrent.BT1.track import track

assert version_info >= (2,3), 'Requires Python 2.3 or better'

if __name__ == '__main__':
    if PROFILE:
        import profile, pstats
        p = profile.Profile()
        p.runcall(track, argv[1:])
        p.dump_stats('debtorrent-tracker.pstat')
#        pstats.Stats(p).strip_dirs().sort_stats('cumulative').print_stats()
        pstats.Stats(p).strip_dirs().sort_stats('time').print_stats()
    else:
        # Run the tracker in a loop, exiting when it says it shouldn't be restarted
        while track(argv[1:]):
            pass