diff --git a/pisi/build.py b/pisi/build.py index aab80d53..d3401cab 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -33,7 +33,7 @@ class PisiBuild: self.sourceArchive.fetch() ui.info("Source archive is stored: %s/%s\n" %(self.ctx.archives_dir(), self.spec.source.archiveName)) - + self.solveBuildDependencies() ui.info("Unpacking archive...") @@ -59,13 +59,13 @@ class PisiBuild: # (from the assumption is evil dept.) os.chdir(self.ctx.pkg_work_dir() + "/" + self.spec.source.name + "-" + self.spec.source.version) locals = globals = {} - + try: exec compile(self.actionScript , "error", "exec") in locals,globals except SyntaxError, e: ui.error ("Error : %s\n" % e) return - + self.configureSource(locals) self.buildSource(locals) self.installSource(locals) @@ -98,7 +98,7 @@ class PisiBuild: if func in locals: ui.info("Installing %s...\n" % self.spec.source.name) locals[func]() - + def genMetaDataXml(self, package): #test metadata = MetaData() diff --git a/pisi/colors.py b/pisi/colors.py index 0584e8f4..3b2abdef 100644 --- a/pisi/colors.py +++ b/pisi/colors.py @@ -1,45 +1,45 @@ colors = {'black' : "\033[30m", - 'red' : "\033[31m", - 'green' : "\033[32m", - 'yellow' : "\033[33m", - 'blue' : "\033[34m", - 'purple' : "\033[35m", - 'cyan' : "\033[36m", - 'white' : "\033[37m", - 'brightblack' : "\033[01;30m", - 'brightred' : "\033[01;31m", - 'brightgreen' : "\033[01;32m", - 'brightyellow' : "\033[01;33m", - 'brightblue' : "\033[01;34m", - 'brightmagenta' : "\033[01;35m", - 'brightcyan' : "\033[01;36m", - 'brightwhite' : "\033[01;37m", - 'underlineblack' : "\033[04;30m", - 'underlinered' : "\033[04;31m", - 'underlinegreen' : "\033[04;32m", - 'underlineyellow' : "\033[04;33m", - 'underlineblue' : "\033[04;34m", - 'underlinemagenta' : "\033[04;35m", - 'underlinecyan' : "\033[04;36m", - 'underlinewhite' : "\033[04;37m", - 'blinkingblack' : "\033[05;30m", - 'blinkingred' : "\033[05;31m", - 'blinkinggreen' : "\033[05;32m", - 'blinkingyellow' : "\033[05;33m", - 'blinkingblue' : "\033[05;34m", - 'blinkingmagenta' : "\033[05;35m", - 'blinkingcyan' : "\033[05;36m", - 'blinkingwhite' : "\033[05;37m", - 'backgroundblack' : "\033[07;30m", - 'backgroundred' : "\033[07;31m", - 'backgroundgreen' : "\033[07;32m", - 'backgroundyellow' : "\033[07;33m", - 'backgroundblue' : "\033[07;34m", - 'backgroundmagenta' : "\033[07;35m", - 'backgroundcyan' : "\033[07;36m", - 'backgroundwhite' : "\033[07;37m", - 'default' : "\033[0m" } + 'red' : "\033[31m", + 'green' : "\033[32m", + 'yellow' : "\033[33m", + 'blue' : "\033[34m", + 'purple' : "\033[35m", + 'cyan' : "\033[36m", + 'white' : "\033[37m", + 'brightblack' : "\033[01;30m", + 'brightred' : "\033[01;31m", + 'brightgreen' : "\033[01;32m", + 'brightyellow' : "\033[01;33m", + 'brightblue' : "\033[01;34m", + 'brightmagenta' : "\033[01;35m", + 'brightcyan' : "\033[01;36m", + 'brightwhite' : "\033[01;37m", + 'underlineblack' : "\033[04;30m", + 'underlinered' : "\033[04;31m", + 'underlinegreen' : "\033[04;32m", + 'underlineyellow' : "\033[04;33m", + 'underlineblue' : "\033[04;34m", + 'underlinemagenta' : "\033[04;35m", + 'underlinecyan' : "\033[04;36m", + 'underlinewhite' : "\033[04;37m", + 'blinkingblack' : "\033[05;30m", + 'blinkingred' : "\033[05;31m", + 'blinkinggreen' : "\033[05;32m", + 'blinkingyellow' : "\033[05;33m", + 'blinkingblue' : "\033[05;34m", + 'blinkingmagenta' : "\033[05;35m", + 'blinkingcyan' : "\033[05;36m", + 'blinkingwhite' : "\033[05;37m", + 'backgroundblack' : "\033[07;30m", + 'backgroundred' : "\033[07;31m", + 'backgroundgreen' : "\033[07;32m", + 'backgroundyellow' : "\033[07;33m", + 'backgroundblue' : "\033[07;34m", + 'backgroundmagenta' : "\033[07;35m", + 'backgroundcyan' : "\033[07;36m", + 'backgroundwhite' : "\033[07;37m", + 'default' : "\033[0m" } def colorize(msg, color): if colors.has_key(color): diff --git a/pisi/context.py b/pisi/context.py index afff6aa2..81948a60 100644 --- a/pisi/context.py +++ b/pisi/context.py @@ -41,17 +41,17 @@ class Context(object): """Config/Context Singleton""" class __impl: def __init__(self): - self.const = Constants() - # self.c.destdir = '' # install default to root by default - self.destdir = './tmp' # only for ALPHA - # the idea is that destdir can be set with --destdir=... + self.const = Constants() + # self.c.destdir = '' # install default to root by default + self.destdir = './tmp' # only for ALPHA + # the idea is that destdir can be set with --destdir=... def setSpecFile(self, pspecfile): - self.pspecfile = pspecfile - spec = SpecFile() - spec.read(pspecfile) - spec.verify() # check pspec integrity - self.spec = spec + self.pspecfile = pspecfile + spec = SpecFile() + spec.read(pspecfile) + spec.verify() # check pspec integrity + self.spec = spec # directory accessor functions # here is how it goes @@ -59,29 +59,29 @@ class Context(object): # pkg_x_dir: per package directory for storing info type x def lib_dir(self): - return self.destdir + self.const.lib_dir_suffix + return self.destdir + self.const.lib_dir_suffix def db_dir(self): - return self.destdir + self.const.db_dir_suffix + return self.destdir + self.const.db_dir_suffix def archives_dir(self): - return self.destdir + self.const.archives_dir_suffix - + return self.destdir + self.const.archives_dir_suffix + def tmp_dir(self): - return self.destdir + self.const.tmp_dir_suffix + return self.destdir + self.const.tmp_dir_suffix def pkg_dir(self): - packageDir = self.spec.source.name + '-' \ - + self.spec.source.version + '-' + self.spec.source.release + packageDir = self.spec.source.name + '-' \ + + self.spec.source.version + '-' + self.spec.source.release return self.destdir + self.const.tmp_dir_suffix \ + '/' + packageDir - + def pkg_work_dir(self): - return self.pkg_dir() + self.const.work_dir_suffix + return self.pkg_dir() + self.const.work_dir_suffix def pkg_install_dir(self): - return self.pkg_dir() + self.const.install_dir_suffix + return self.pkg_dir() + self.const.install_dir_suffix __instance = __impl() diff --git a/pisi/dependency.py b/pisi/dependency.py index 3dff35da..e678be03 100644 --- a/pisi/dependency.py +++ b/pisi/dependency.py @@ -43,4 +43,3 @@ def installable(pkg): return False else: return satisfiesRuntimeDeps(pkg) and satisfiesInstallDeps(pkg) - diff --git a/pisi/fetcher.py b/pisi/fetcher.py index 79651ff6..26c14af7 100644 --- a/pisi/fetcher.py +++ b/pisi/fetcher.py @@ -136,4 +136,3 @@ class Progress: return percent else: return 0 - diff --git a/pisi/install.py b/pisi/install.py index 8fc52c98..d3ede36a 100644 --- a/pisi/install.py +++ b/pisi/install.py @@ -46,7 +46,7 @@ def install(self, package_fn): # unzip package in place package.extract_dir_flat(ctx.destdir) - + # update databases # installdb @@ -54,4 +54,3 @@ def install(self, package_fn): metadata.source.version, metadata.source.release, ctx.install_dir() + '/files.xml') - diff --git a/pisi/installdb.py b/pisi/installdb.py index be777c53..c4272290 100644 --- a/pisi/installdb.py +++ b/pisi/installdb.py @@ -59,6 +59,5 @@ def purge(pkg): (status, version, release) = d[pkg] f = files_name(pkg, version, release) if util.check_file(f): - os.unlink(f) + os.unlink(f) del d[pkg] - diff --git a/pisi/metadata.py b/pisi/metadata.py index 433b81ef..07b26392 100644 --- a/pisi/metadata.py +++ b/pisi/metadata.py @@ -9,11 +9,11 @@ class MetaData(SpecFile): """This is a superset of the source spec definition""" def read(self, filename): - super(MetaData, self).read(filename) - distribution = self.getNodeText("Source/Distribution") - distributionRelease = self.getNodeText("Source/DistributionRelease") - architecture = self.getNodeText("Source/Architecture") - installedSize = int(self.getNodeText("Source/InstalledSize")) + super(MetaData, self).read(filename) + distribution = self.getNodeText("Source/Distribution") + distributionRelease = self.getNodeText("Source/DistributionRelease") + architecture = self.getNodeText("Source/Architecture") + installedSize = int(self.getNodeText("Source/InstalledSize")) def write(self, filename): ui.info("METADATA WRITE NOT IMPLEMENTED\n") diff --git a/pisi/oo.py b/pisi/oo.py index 4cbbd866..94674e18 100644 --- a/pisi/oo.py +++ b/pisi/oo.py @@ -17,4 +17,3 @@ class const: raise self.ConstError, "Can't unbind constant: %s" % name # we don't have an attribute by this name raise NameError, name - diff --git a/pisi/packagedb.py b/pisi/packagedb.py index eccc26b1..77782830 100644 --- a/pisi/packagedb.py +++ b/pisi/packagedb.py @@ -25,4 +25,3 @@ def add_package(name, package_info): def remove_package(name): del d[name] - diff --git a/pisi/sourcearchive.py b/pisi/sourcearchive.py index 4587593e..1347809e 100644 --- a/pisi/sourcearchive.py +++ b/pisi/sourcearchive.py @@ -48,7 +48,7 @@ class SourceArchive: fetch.fetch() - # FIXME: What a ugly hack! We should really find a cleaner way for output. + # FIXME: What a ugly hack! We should really find a cleaner way for output. if percentHook: ui.info('\n') pass diff --git a/pisi/ui.py b/pisi/ui.py index a2d3e857..567b259a 100644 --- a/pisi/ui.py +++ b/pisi/ui.py @@ -48,4 +48,3 @@ class CLI: # default UI is CLI ui = CLI() - diff --git a/pisi/util.py b/pisi/util.py index 5ff1360d..80aa5220 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -170,6 +170,6 @@ def do_patch(patch, p=0): raise UtilError("ERROR: patch (%s) failed: %s" % (patch, strlist (o))) def partition_freespace(directory): - """ returns free space of given directory's partition """ - st = os.statvfs(directory) - return st[statvfs.F_BSIZE] * st[statvfs.F_BFREE] + """ returns free space of given directory's partition """ + st = os.statvfs(directory) + return st[statvfs.F_BSIZE] * st[statvfs.F_BFREE] diff --git a/pisi/xmlfile.py b/pisi/xmlfile.py index 0b2375f2..1b564b28 100644 --- a/pisi/xmlfile.py +++ b/pisi/xmlfile.py @@ -182,7 +182,7 @@ class XmlFile(object): return getNode(self.dom.documentElement, tagPath) def getNodeText(self, tagPath): - """returns the text of *first* matching node for given tag path.""" + """returns the text of *first* matching node for given tag path.""" self.verifyRootTag() return getNodeText(getNode(self.dom.documentElement, tagPath)) diff --git a/tests/actionsapitests.py b/tests/actionsapitests.py index 02273a5c..74ded5a0 100644 --- a/tests/actionsapitests.py +++ b/tests/actionsapitests.py @@ -5,7 +5,7 @@ from pisi.actionsapi import gnuconfig class gnuConfigTestCase(unittest.TestCase): def setUp(self): self.gnuconfig = gnuconfig.gnuconfig_findnewest() - + def testFindNewest(self): self.assertEqual(self.gnuconfig, '/usr/share/automake-1.4') diff --git a/tests/archivetests.py b/tests/archivetests.py index 409cc5fc..78199e8d 100644 --- a/tests/archivetests.py +++ b/tests/archivetests.py @@ -11,7 +11,7 @@ from pisi import context class ArchiveFileTestCase(unittest.TestCase): # def setUp(self): -# pass +# pass def testUnpackTar(self): ctx = context.Context("samples/popt/popt.pspec") @@ -20,22 +20,22 @@ class ArchiveFileTestCase(unittest.TestCase): fileName = os.path.basename(ctx.spec.source.archiveUri) filePath = ctx.archives_dir() + '/' + fileName achv = archive.Archive(filePath, ctx.spec.source.archiveType) - + assert ctx.spec.source.archiveType == "targz" # unpacking is trivial with Archive() achv.unpack(targetDir) - + # but testing is hard # "var/tmp/pisi/popt-1.7-3/work" (targetDir) assert pathexists(targetDir + "/popt-1.7") testfile = targetDir + "/popt-1.7/Makefile.am" assert pathexists(testfile) - + # check file integrity self.assertEqual(util.sha1_file(testfile), - "5af9dd7d754f788cf511c57ce0af3d555fed009d") + "5af9dd7d754f788cf511c57ce0af3d555fed009d") def testUnpackZip(self): ctx = context.Context("tests/sandbox/sandbox.pspec") @@ -55,15 +55,15 @@ class ArchiveFileTestCase(unittest.TestCase): testfile = targetDir + "/sandbox/borek.cs" assert pathexists(testfile) - + # check file integrity self.assertEqual(util.sha1_file(testfile), - "06d0ee5ba49eccae6bc20552d55b3ba5ad52995e") + "06d0ee5ba49eccae6bc20552d55b3ba5ad52995e") # check for symbolic links testfile = targetDir + "/sandbox/deneme/hed" assert islink(testfile) - + def testUnpackZipCond(self): ctx = context.Context("tests/sandbox/sandbox.pspec") fetch = fetcher.Fetcher(ctx) diff --git a/tests/contexttests.py b/tests/contexttests.py index aeb41690..5c6b6c7d 100644 --- a/tests/contexttests.py +++ b/tests/contexttests.py @@ -6,7 +6,7 @@ from pisi import context class ContextTestCase(unittest.TestCase): def setUp(self): self.ctx = context.Context("samples/popt/popt.pspec") - + def testConstness(self): # test if we can get a const attribute? try: @@ -17,7 +17,7 @@ class ContextTestCase(unittest.TestCase): # test binding a new constant self.ctx.const.test = "test binding" - + # test re-binding (which is illegal) try: self.ctx.const.test = "test rebinding" diff --git a/tests/fetchertests.py b/tests/fetchertests.py index e5fb6dd8..17691777 100644 --- a/tests/fetchertests.py +++ b/tests/fetchertests.py @@ -10,12 +10,12 @@ class FetcherTestCase(unittest.TestCase): def setUp(self): self.ctx = context.Context("samples/popt/popt.pspec") self.fetch = fetcher.Fetcher(self.ctx) - + def testFetch(self): self.fetch.fetch() destpath = self.fetch.filedest + "/" + self.fetch.filename if os.access(destpath, os.R_OK): self.assertEqual(util.sha1_file(destpath), - self.ctx.spec.source.archiveSHA1) + self.ctx.spec.source.archiveSHA1) suite = unittest.makeSuite(FetcherTestCase) diff --git a/tests/run.py b/tests/run.py index c4fa4f45..09a1f7a6 100755 --- a/tests/run.py +++ b/tests/run.py @@ -18,16 +18,16 @@ def run_all(): import actionsapitests alltests = unittest.TestSuite(( - specfiletests.suite, - specfiletests.suite, - metadatatests.suite, - contexttests.suite, - fetchertests.suite, - archivetests.suite, - installdbtests.suite, - packagedbtests.suite, - actionsapitests.suite - )) + specfiletests.suite, + specfiletests.suite, + metadatatests.suite, + contexttests.suite, + fetchertests.suite, + archivetests.suite, + installdbtests.suite, + packagedbtests.suite, + actionsapitests.suite + )) runTestSuite(alltests) diff --git a/tests/specfiletests.py b/tests/specfiletests.py index be7e07b8..9044450f 100644 --- a/tests/specfiletests.py +++ b/tests/specfiletests.py @@ -9,28 +9,28 @@ class SpecFileTestCase(unittest.TestCase): def setUp(self): self.spec = specfile.SpecFile() self.spec.read("samples/popt/popt.pspec") - + def testSourceName(self): self.assertEqual(self.spec.source.name, - "popt") + "popt") def testSourceVersion(self): self.assertEqual(self.spec.source.version, - "1.7") + "1.7") def testSourceLastRelease(self): self.assertEqual(self.spec.source.release, - "3") + "3") def testSHA1Sum(self): self.assertEqual(self.spec.source.archiveSHA1, - "66f3c77b87a160951b180447f4a6dce68ad2f71b") + "66f3c77b87a160951b180447f4a6dce68ad2f71b") def testLenPackages(self): self.assertEqual(len(self.spec.packages), 1) def testCopy(self): - self.spec.read("samples/popt/popt.pspec") - self.spec.write(os.path.join(ctx.tmp_dir(), 'popt-copy.pspec')) + self.spec.read("samples/popt/popt.pspec") + self.spec.write(os.path.join(ctx.tmp_dir(), 'popt-copy.pspec')) suite = unittest.makeSuite(SpecFileTestCase)