From d01698a5ba460310930234a9eff984d524970cb0 Mon Sep 17 00:00:00 2001 From: "A. Murat Eren" Date: Wed, 5 Oct 2005 10:49:44 +0000 Subject: [PATCH] =?UTF-8?q?=20archive=20tam=20olarak=20indirilmedi=C4=9Fi?= =?UTF-8?q?=20s=C3=BCrece=20ad=20dosya=5Fadi.part=20olsun..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pisitools içerisindeki gereksiz fonksiyonu cikart.. --- pisi/actionsapi/pisitools.py | 4 ---- pisi/fetcher.py | 22 +++++++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pisi/actionsapi/pisitools.py b/pisi/actionsapi/pisitools.py index 46b83e03..e28c4c68 100644 --- a/pisi/actionsapi/pisitools.py +++ b/pisi/actionsapi/pisitools.py @@ -168,10 +168,6 @@ def rename(sourceFile, destinationFile): except OSError: ctx.ui.error(_('\n!!! ActionsAPI [rename]: No such file or directory: %s') % (sourceFile)) -def dopython(): - '''FIXME: What the hell is this?''' - pass - def dosed(sourceFile, findPattern, replacePattern = ''): '''replaces patterns in sourceFile''' diff --git a/pisi/fetcher.py b/pisi/fetcher.py index a321d742..e69c7135 100644 --- a/pisi/fetcher.py +++ b/pisi/fetcher.py @@ -19,6 +19,7 @@ import urllib2 import os from base64 import encodestring +from shutil import move import gettext __trans = gettext.translation('pisi', fallback=True) @@ -68,12 +69,15 @@ class Fetcher: if not os.access(self.filedest, os.W_OK): self.err(_("Access denied to write to dest dir")) - if self.url.is_local_file(): - self.fetchLocalFile() - else: - self.fetchRemoteFile() + archiveFile = os.path.join(self.filedest, self.url.filename()) - return os.path.join(self.filedest, self.url.filename()) + if self.url.is_local_file(): + self.fetchLocalFile(archiveFile + ".part") + else: + self.fetchRemoteFile(archiveFile + ".part") + + move(archiveFile + ".part", archiveFile) + return archiveFile def _do_grab(self, fileURI, dest, totalsize): symbols = [' B/s', 'KB/s', 'MB/s', 'GB/s'] @@ -110,18 +114,18 @@ class Fetcher: dest.close() - def fetchLocalFile (self): + def fetchLocalFile (self, archiveFile): url = self.url if not os.access(url.path(), os.F_OK): self.err(_("No such file or no permission to read")) - dest = open(os.path.join(self.filedest, url.filename()) , "w") + dest = open(archiveFile, "w") totalsize = os.path.getsize(url.path()) fileObj = open(url.path()) self._do_grab(fileObj, dest, totalsize) - def fetchRemoteFile (self): + def fetchRemoteFile (self, archiveFile): from httplib import HTTPException try: @@ -143,7 +147,7 @@ class Fetcher: except: totalsize = 0 - dest = open(os.path.join(self.filedest, self.url.filename()) , "w") + dest = open(archiveFile, "w") self._do_grab(fileObj, dest, totalsize) def formatRequest(self, request):