summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-11-17 08:23:04 +0000
committerNick Mathewson <nickm@torproject.org>2008-11-17 08:23:04 +0000
commite5ec1b2ce20f7578fea683229aadc95431fdb451 (patch)
treea681a6e8df59f07925b1edceb5375ed099e5821b /lib
parent8315047663e745608ae5b9526f694977825b6aa7 (diff)
misc docs
git-svn-id: file:///home/or/svnrepo/updater/trunk@17315 55e972cd-5a19-0410-ae62-a4d7a52db4cd
Diffstat (limited to 'lib')
-rw-r--r--lib/thandy/ClientCLI.py2
-rw-r--r--lib/thandy/download.py12
-rw-r--r--lib/thandy/util.py3
3 files changed, 12 insertions, 5 deletions
diff --git a/lib/thandy/ClientCLI.py b/lib/thandy/ClientCLI.py
index 178c887..55d52c6 100644
--- a/lib/thandy/ClientCLI.py
+++ b/lib/thandy/ClientCLI.py
@@ -145,7 +145,7 @@ def usage():
print "Known commands:"
print " update [--repo=repository] [--no-download] [--loop]"
print " [--no-packagesys] [--install] [--socks-port=port]"
- print " [--debug|--info|--warn]"
+ print " [--debug|--info|--warn] [--force-check]"
sys.exit(1)
def main():
diff --git a/lib/thandy/download.py b/lib/thandy/download.py
index 2f98b30..d7fa19a 100644
--- a/lib/thandy/download.py
+++ b/lib/thandy/download.py
@@ -142,8 +142,9 @@ class DownloadJob:
store it in targetPath. Store partial results in tmpPath;
if there is already a file in tmpPath, assume that it is an
incomplete download. If wantHash, reject the file unless
- the hash is as given. If useTor, use a socks connection."""
- #DOCDODC repofile
+ the hash is as given. If useTor, use a socks connection.
+ If repoFile, use that RepositoryFile to validate the downloaded
+ data."""
self._destPath = targetPath
self._tmpPath = tmpPath
self._wantHash = wantHash
@@ -196,7 +197,8 @@ class DownloadJob:
return False
def _checkTmpFile(self):
- """DOCDOC"""
+ """Helper: check whether the downloaded temporary file matches
+ the hash and/or format we need."""
if self._wantHash and not self._repoFile:
gotHash = thandy.formats.getFileDigest(self._tmpPath)
if gotHash != self._wantHash:
@@ -204,6 +206,7 @@ class DownloadJob:
elif self._repoFile:
self._repoFile.checkFile(self._tmpPath, self._wantHash)
+
def _download(self):
# Implementation function. Unlike download(), can throw exceptions.
f_in = f_out = None
@@ -215,7 +218,8 @@ class DownloadJob:
except thandy.Exception:
pass
else:
- # What luck! This file was what we wanted.
+ # What luck! This stalled file was what we wanted.
+ # (This happens mostly with )
thandy.util.ensureParentDir(self._destPath)
thandy.util.moveFile(self._tmpPath, self._destPath)
return
diff --git a/lib/thandy/util.py b/lib/thandy/util.py
index 00efb59..f2bac17 100644
--- a/lib/thandy/util.py
+++ b/lib/thandy/util.py
@@ -20,6 +20,9 @@ import thandy.keys
import thandy.master_keys
def moveFile(fromLocation, toLocation):
+ """Move the file from fromLocation to toLocation, removing any file
+ in toLocation.
+ """
if sys.platform in ('cygwin', 'win32'):
# Win32 doesn't let rename replace an existing file.
try: