From b62213d9084cfc3ebf52b469b8ab7aaad1546b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Fri, 1 Jul 2005 13:18:12 +0000 Subject: [PATCH] =?UTF-8?q?Kod=20=C3=BCzerinden=20h=C4=B1zl=C4=B1ca=20bir?= =?UTF-8?q?=20ge=C3=A7tim,=20bir=20iki=20kozmetik=20d=C3=BCzenleme=20var.?= =?UTF-8?q?=20Path=20i=C5=9Fleri=20os.path.join'e=20=C3=A7evrildi.=20G?= =?UTF-8?q?=C3=B6z=C3=BCmden=20ka=C3=A7an=20ba=C5=9Fka=20yerler=20olabilir?= =?UTF-8?q?...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pisi/archive.py | 16 ++++++++-------- pisi/build.py | 3 +-- pisi/fetcher.py | 6 +++--- pisi/files.py | 2 +- pisi/install.py | 4 ++-- pisi/metadata.py | 2 +- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/pisi/archive.py b/pisi/archive.py index 4269e1bf..6a51f8da 100644 --- a/pisi/archive.py +++ b/pisi/archive.py @@ -21,7 +21,7 @@ class ArchiveBase(object): self.filePath = filepath self.type = atype - def unpack(self, targetDir, cleanDir=False): + def unpack(self, targetDir, cleanDir = False): self.targetDir = targetDir # first we check if we need to clean-up our working env. if os.path.exists(self.targetDir): @@ -35,10 +35,10 @@ class ArchiveTar(ArchiveBase): type. Provides access to tar, tar.gz and tar.bz2 files. This class provides the unpack magic for tar archives.""" - def __init__(self, filepath, type="tar"): + def __init__(self, filepath, type = "tar"): super(ArchiveTar, self).__init__(filepath, type) - def unpack(self, targetDir, cleanDir=False): + def unpack(self, targetDir, cleanDir = False): """Unpack tar archive to a given target directory(targetDir).""" super(ArchiveTar, self).unpack(targetDir, cleanDir) @@ -69,7 +69,7 @@ class ArchiveZip(ArchiveBase): symmagic = 2716663808 #long of hex val '0xA1ED0000L' - def __init__(self, filepath, type="zip", mode='r'): + def __init__(self, filepath, type = "zip", mode = 'r'): super(ArchiveZip, self).__init__(filepath, type) self.zip = zipfile.ZipFile(self.filePath, mode) @@ -83,9 +83,9 @@ class ArchiveZip(ArchiveBase): # It's a pity that zipfile can't handle unicode strings. Grrr! fileName = str(fileName) if os.path.isdir(fileName) and not os.path.islink(fileName): - self.zip.writestr(fileName + '/', '') + self.zip.writestr(os.path.join(fileName, '')) for f in os.listdir(fileName): - self.add_to_archive(fileName + '/' + f) + self.add_to_archive(os.path.join(fileName, f)) else: if os.path.islink(fileName): dest = os.readlink(fileName) @@ -110,7 +110,7 @@ class ArchiveZip(ArchiveBase): self.add_file(fileName) os.chdir(cwd) - def unpack_file_cond(self, pred, targetDir, archiveRoot=''): + def unpack_file_cond(self, pred, targetDir, archiveRoot = ''): """Unpack/Extract a file according to predicate function filename -> bool""" zip = self.zip @@ -186,7 +186,7 @@ class Archive: self.archive = handlers.get(type)(filepath, type) - def unpack(self, targetDir, cleanDir=False): + def unpack(self, targetDir, cleanDir = False): self.archive.unpack(targetDir, cleanDir) def unpack_files(self, files, targetDir): diff --git a/pisi/build.py b/pisi/build.py index 71c9fd11..b5b4bf72 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -260,8 +260,7 @@ class PisiBuild: files = Files() files.read(const.files_xml) for finfo in files.list: - p = "install/" + finfo.path - pkg.add_to_package(p) + pkg.add_to_package("install/" + finfo.path) pkg.close() os.chdir(c) diff --git a/pisi/fetcher.py b/pisi/fetcher.py index b4ce3d64..dfaad20f 100644 --- a/pisi/fetcher.py +++ b/pisi/fetcher.py @@ -62,7 +62,7 @@ class Fetcher: else: self.fetchRemoteFile() - return self.filedest + "/" + self.url.filename() + return os.path.join(self.filedest, self.url.filename()) def doGrab(self, file, dest, totalsize): symbols = [' B/s', 'KB/s', 'MB/s', 'GB/s'] @@ -106,7 +106,7 @@ class Fetcher: if os.access(url.path(), os.F_OK) == False: self.err("no such file or no perm to read") - dest = open(self.filedest + "/" + url.filename() , "w") + dest = open(os.path.join(self.filedest, url.filename()) , "w") totalsize = os.path.getsize(url.path()) file = open(url.path()) self.doGrab(file, dest, totalsize) @@ -132,7 +132,7 @@ class Fetcher: totalsize = 0 # could not get the totalsize of file else: totalsize = int(headers['Content-Length']) - dest = open(self.filedest + "/" + self.url.filename() , "w") + dest = open(os.path.join(self.filedest, self.url.filename()) , "w") self.doGrab(file, dest, totalsize) diff --git a/pisi/files.py b/pisi/files.py index 05c087c8..995a9a5a 100644 --- a/pisi/files.py +++ b/pisi/files.py @@ -7,7 +7,7 @@ from xmlfile import XmlFile class FileInfo: """FileInfo holds the information for a File node/tag in files.xml""" - def __init__(self, _path = "", _type = "", _size="", _hash = ""): + def __init__(self, _path = "", _type = "", _size = "", _hash = ""): self.path = _path self.type = _type self.size = _size diff --git a/pisi/install.py b/pisi/install.py index 950e3606..e2712aed 100644 --- a/pisi/install.py +++ b/pisi/install.py @@ -34,7 +34,7 @@ def install(package_fn): # check if we have all required files metadata = MetaData() - metadata.read(config.install_dir() + '/metadata.xml') + metadata.read(os.path.join(config.install_dir(), 'metadata.xml')) # check package semantics if not metadata.verify(): raise InstallError("MetaData format wrong") @@ -57,4 +57,4 @@ def install(package_fn): installdb.install(metadata.package.name, metadata.package.version, metadata.package.release, - config.install_dir() + '/files.xml') + os.path.join(config.install_dir(), 'files.xml')) diff --git a/pisi/metadata.py b/pisi/metadata.py index 2ca2b56e..315b5256 100644 --- a/pisi/metadata.py +++ b/pisi/metadata.py @@ -57,7 +57,7 @@ class MetaData(XmlFile): other information. A metadata has two parts, Source and Package.""" def __init__(self): - XmlFile.__init__(self,"PISI") + XmlFile.__init__(self, "PISI") def fromSpec(self, src, pkg): self.source = SourceInfo()