| 1 |
#!/usr/bin/python
|
| 2 |
|
| 3 |
# This script is mainly used to demo the updateFile function.
|
| 4 |
import os
|
| 5 |
import os.path
|
| 6 |
import string
|
| 7 |
import sys
|
| 8 |
|
| 9 |
def setup_paths():
|
| 10 |
check_file = 'lib/python/debian_support.py'
|
| 11 |
path = os.getcwd()
|
| 12 |
while 1:
|
| 13 |
if os.path.exists("%s/%s" % (path, check_file)):
|
| 14 |
sys.path = [path + '/lib/python'] + sys.path
|
| 15 |
return path
|
| 16 |
idx = string.rfind(path, '/')
|
| 17 |
if idx == -1:
|
| 18 |
raise ImportError, "could not setup paths"
|
| 19 |
path = path[0:idx]
|
| 20 |
root_path = setup_paths()
|
| 21 |
|
| 22 |
import debian_support
|
| 23 |
|
| 24 |
if len(sys.argv) <> 3:
|
| 25 |
sys.stderr.write("usage: apt-update-file REMOTE LOCAL\n")
|
| 26 |
sys.exit(1)
|
| 27 |
|
| 28 |
try:
|
| 29 |
debian_support.updateFile(sys.argv[1], sys.argv[2])
|
| 30 |
except:
|
| 31 |
print >>sys.stderr, \
|
| 32 |
"error: in download of %s to %s:" % (repr(sys.argv[1]),
|
| 33 |
repr(sys.argv[2]))
|
| 34 |
raise
|