File: server.py

package info (click to toggle)
rdiff-backup 2.2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,640 kB
  • sloc: python: 24,129; javascript: 9,512; sh: 1,230; ansic: 580; makefile: 36
file content (36 lines) | stat: -rwxr-xr-x 843 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
#!/usr/bin/env python3

import sys

__doc__ = """

This starts an rdiff-backup server using the existing source files.
If not run from the source directory, the only argument should be
the directory the source files are in.
"""


def Test_SetConnGlobals(conn, setting, value):
    """This is used in connectiontest.py"""
    conn.Globals.set(setting, value)


def print_usage():
    print("Usage: server.py  [path to source files]", __doc__)


if len(sys.argv) > 2:
    print_usage()
    sys.exit(1)

try:
    if len(sys.argv) == 2:
        sys.path.insert(0, sys.argv[1])
    import rdiff_backup.Security
    from rdiff_backup.connection import PipeConnection
except (OSError, ImportError):
    print_usage()
    raise

rdiff_backup.Security._security_level = "override"
sys.exit(PipeConnection(sys.stdin.buffer, sys.stdout.buffer).Server())