1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-13 21:05:05 -05:00

pactest: pylint changes for pmpkg

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2010-10-26 21:35:07 -05:00
parent 946f4af7f3
commit d94346ede2

View File

@ -22,8 +22,7 @@ import stat
import shutil import shutil
import tarfile import tarfile
from util import * import util
class pmpkg: class pmpkg:
"""Package object. """Package object.
@ -96,14 +95,14 @@ class pmpkg:
Returns a string formatted as follows: "pkgname-pkgver.PKG_EXT_PKG". Returns a string formatted as follows: "pkgname-pkgver.PKG_EXT_PKG".
""" """
return "%s%s" % (self.fullname(), PM_EXT_PKG) return "%s%s" % (self.fullname(), util.PM_EXT_PKG)
def install_files(self, root): def install_files(self, root):
"""Install files in the filesystem located under "root". """Install files in the filesystem located under "root".
Files are created with content generated automatically. Files are created with content generated automatically.
""" """
[mkfile(os.path.join(root, f), f) for f in self.files] [util.mkfile(os.path.join(root, f), f) for f in self.files]
def makepkg(self, path): def makepkg(self, path):
"""Creates an ArchLinux package archive. """Creates an ArchLinux package archive.
@ -119,8 +118,8 @@ class pmpkg:
# Generate package file system # Generate package file system
for f in self.files: for f in self.files:
mkfile(f, f) util.mkfile(f, f)
self.size += os.stat(getfilename(f))[stat.ST_SIZE] self.size += os.stat(util.getfilename(f))[stat.ST_SIZE]
# .PKGINFO # .PKGINFO
data = ["pkgname = %s" % self.name] data = ["pkgname = %s" % self.name]
@ -148,14 +147,14 @@ class pmpkg:
data.append("provides = %s" % i) data.append("provides = %s" % i)
for i in self.backup: for i in self.backup:
data.append("backup = %s" % i) data.append("backup = %s" % i)
mkfile(".PKGINFO", "\n".join(data)) util.mkfile(".PKGINFO", "\n".join(data))
# .INSTALL # .INSTALL
if len(self.install.values()) > 0: if len(self.install.values()) > 0:
mkinstallfile(".INSTALL", self.install) util.mkinstallfile(".INSTALL", self.install)
# safely create the dir # safely create the dir
mkdir(os.path.dirname(self.path)) util.mkdir(os.path.dirname(self.path))
# Generate package archive # Generate package archive
tar = tarfile.open(self.path, "w:gz") tar = tarfile.open(self.path, "w:gz")
@ -166,8 +165,4 @@ class pmpkg:
os.chdir(curdir) os.chdir(curdir)
shutil.rmtree(tmpdir) shutil.rmtree(tmpdir)
if __name__ == "__main__":
pkg = pmpkg("dummy")
print pkg
# vim: set ts=4 sw=4 et: # vim: set ts=4 sw=4 et: