示例#1
0
 def setUp(self):
     """Must start a server for this"""
     pipe_cmd = "%s testing/server.py %s" \
         % (sys.executable, SourceDir)
     self.p = subprocess.Popen(pipe_cmd,
                               shell=True,
                               stdin=subprocess.PIPE,
                               stdout=subprocess.PIPE,
                               close_fds=True)
     (stdin, stdout) = (self.p.stdin, self.p.stdout)
     self.conn = PipeConnection(stdout, stdin)
     Security._security_level = "override"
示例#2
0
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.Globals
    import rdiff_backup.Security
    from rdiff_backup.connection import PipeConnection
except (OSError, IOError, ImportError):
    print_usage()
    raise

rdiff_backup.Globals.security_level = "override"
sys.exit(PipeConnection(sys.stdin.buffer, sys.stdout.buffer).Server())