summaryrefslogtreecommitdiffstats
path: root/bin/apt-update-file
blob: 244ae4436def33cc8bd3ac516264e0cebe72e7d7 (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
#!/usr/bin/python

# This script is mainly used to demo the updateFile function.
from __future__ import print_function
import os
import os.path
import string
import sys

def setup_paths():
    check_file = 'lib/python/debian_support.py'
    path = os.getcwd()
    while 1:
        if os.path.exists("%s/%s" % (path, check_file)):
            sys.path = [path + '/lib/python'] + sys.path
            return path
        idx = string.rfind(path, '/')
        if idx == -1:
            raise ImportError("could not setup paths")
        path = path[0:idx]
root_path = setup_paths()

import debian_support

if len(sys.argv) != 3:
    sys.stderr.write("usage: apt-update-file REMOTE LOCAL\n")
    sys.exit(1)

try:
    debian_support.updateFile(sys.argv[1], sys.argv[2])
except:
    print("error: in download of %s to %s:" % (repr(sys.argv[1]),
                                             repr(sys.argv[2])),
          file=sys.stderr)
    raise

© 2014-2024 Faster IT GmbH | imprint | privacy policy