#!/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