Bu space/tab işi beni delirtti sanırım. Bu commit eclipse ile düzeltilmiş hallerini içeriyor. Eğer gene salak indentation problemleri olursa revert ederiz

This commit is contained in:
S.Çağlar Onur
2005-06-21 18:45:19 +00:00
parent 5ba0f7ecb8
commit 680fd1625d
20 changed files with 105 additions and 112 deletions
+4 -4
View File
@@ -33,7 +33,7 @@ class PisiBuild:
self.sourceArchive.fetch() self.sourceArchive.fetch()
ui.info("Source archive is stored: %s/%s\n" ui.info("Source archive is stored: %s/%s\n"
%(self.ctx.archives_dir(), self.spec.source.archiveName)) %(self.ctx.archives_dir(), self.spec.source.archiveName))
self.solveBuildDependencies() self.solveBuildDependencies()
ui.info("Unpacking archive...") ui.info("Unpacking archive...")
@@ -59,13 +59,13 @@ class PisiBuild:
# (from the assumption is evil dept.) # (from the assumption is evil dept.)
os.chdir(self.ctx.pkg_work_dir() + "/" + self.spec.source.name + "-" + self.spec.source.version) os.chdir(self.ctx.pkg_work_dir() + "/" + self.spec.source.name + "-" + self.spec.source.version)
locals = globals = {} locals = globals = {}
try: try:
exec compile(self.actionScript , "error", "exec") in locals,globals exec compile(self.actionScript , "error", "exec") in locals,globals
except SyntaxError, e: except SyntaxError, e:
ui.error ("Error : %s\n" % e) ui.error ("Error : %s\n" % e)
return return
self.configureSource(locals) self.configureSource(locals)
self.buildSource(locals) self.buildSource(locals)
self.installSource(locals) self.installSource(locals)
@@ -98,7 +98,7 @@ class PisiBuild:
if func in locals: if func in locals:
ui.info("Installing %s...\n" % self.spec.source.name) ui.info("Installing %s...\n" % self.spec.source.name)
locals[func]() locals[func]()
def genMetaDataXml(self, package): def genMetaDataXml(self, package):
#test #test
metadata = MetaData() metadata = MetaData()
+40 -40
View File
@@ -1,45 +1,45 @@
colors = {'black' : "\033[30m", colors = {'black' : "\033[30m",
'red' : "\033[31m", 'red' : "\033[31m",
'green' : "\033[32m", 'green' : "\033[32m",
'yellow' : "\033[33m", 'yellow' : "\033[33m",
'blue' : "\033[34m", 'blue' : "\033[34m",
'purple' : "\033[35m", 'purple' : "\033[35m",
'cyan' : "\033[36m", 'cyan' : "\033[36m",
'white' : "\033[37m", 'white' : "\033[37m",
'brightblack' : "\033[01;30m", 'brightblack' : "\033[01;30m",
'brightred' : "\033[01;31m", 'brightred' : "\033[01;31m",
'brightgreen' : "\033[01;32m", 'brightgreen' : "\033[01;32m",
'brightyellow' : "\033[01;33m", 'brightyellow' : "\033[01;33m",
'brightblue' : "\033[01;34m", 'brightblue' : "\033[01;34m",
'brightmagenta' : "\033[01;35m", 'brightmagenta' : "\033[01;35m",
'brightcyan' : "\033[01;36m", 'brightcyan' : "\033[01;36m",
'brightwhite' : "\033[01;37m", 'brightwhite' : "\033[01;37m",
'underlineblack' : "\033[04;30m", 'underlineblack' : "\033[04;30m",
'underlinered' : "\033[04;31m", 'underlinered' : "\033[04;31m",
'underlinegreen' : "\033[04;32m", 'underlinegreen' : "\033[04;32m",
'underlineyellow' : "\033[04;33m", 'underlineyellow' : "\033[04;33m",
'underlineblue' : "\033[04;34m", 'underlineblue' : "\033[04;34m",
'underlinemagenta' : "\033[04;35m", 'underlinemagenta' : "\033[04;35m",
'underlinecyan' : "\033[04;36m", 'underlinecyan' : "\033[04;36m",
'underlinewhite' : "\033[04;37m", 'underlinewhite' : "\033[04;37m",
'blinkingblack' : "\033[05;30m", 'blinkingblack' : "\033[05;30m",
'blinkingred' : "\033[05;31m", 'blinkingred' : "\033[05;31m",
'blinkinggreen' : "\033[05;32m", 'blinkinggreen' : "\033[05;32m",
'blinkingyellow' : "\033[05;33m", 'blinkingyellow' : "\033[05;33m",
'blinkingblue' : "\033[05;34m", 'blinkingblue' : "\033[05;34m",
'blinkingmagenta' : "\033[05;35m", 'blinkingmagenta' : "\033[05;35m",
'blinkingcyan' : "\033[05;36m", 'blinkingcyan' : "\033[05;36m",
'blinkingwhite' : "\033[05;37m", 'blinkingwhite' : "\033[05;37m",
'backgroundblack' : "\033[07;30m", 'backgroundblack' : "\033[07;30m",
'backgroundred' : "\033[07;31m", 'backgroundred' : "\033[07;31m",
'backgroundgreen' : "\033[07;32m", 'backgroundgreen' : "\033[07;32m",
'backgroundyellow' : "\033[07;33m", 'backgroundyellow' : "\033[07;33m",
'backgroundblue' : "\033[07;34m", 'backgroundblue' : "\033[07;34m",
'backgroundmagenta' : "\033[07;35m", 'backgroundmagenta' : "\033[07;35m",
'backgroundcyan' : "\033[07;36m", 'backgroundcyan' : "\033[07;36m",
'backgroundwhite' : "\033[07;37m", 'backgroundwhite' : "\033[07;37m",
'default' : "\033[0m" } 'default' : "\033[0m" }
def colorize(msg, color): def colorize(msg, color):
if colors.has_key(color): if colors.has_key(color):
+19 -19
View File
@@ -41,17 +41,17 @@ class Context(object):
"""Config/Context Singleton""" """Config/Context Singleton"""
class __impl: class __impl:
def __init__(self): def __init__(self):
self.const = Constants() self.const = Constants()
# self.c.destdir = '' # install default to root by default # self.c.destdir = '' # install default to root by default
self.destdir = './tmp' # only for ALPHA self.destdir = './tmp' # only for ALPHA
# the idea is that destdir can be set with --destdir=... # the idea is that destdir can be set with --destdir=...
def setSpecFile(self, pspecfile): def setSpecFile(self, pspecfile):
self.pspecfile = pspecfile self.pspecfile = pspecfile
spec = SpecFile() spec = SpecFile()
spec.read(pspecfile) spec.read(pspecfile)
spec.verify() # check pspec integrity spec.verify() # check pspec integrity
self.spec = spec self.spec = spec
# directory accessor functions # directory accessor functions
# here is how it goes # here is how it goes
@@ -59,29 +59,29 @@ class Context(object):
# pkg_x_dir: per package directory for storing info type x # pkg_x_dir: per package directory for storing info type x
def lib_dir(self): def lib_dir(self):
return self.destdir + self.const.lib_dir_suffix return self.destdir + self.const.lib_dir_suffix
def db_dir(self): def db_dir(self):
return self.destdir + self.const.db_dir_suffix return self.destdir + self.const.db_dir_suffix
def archives_dir(self): def archives_dir(self):
return self.destdir + self.const.archives_dir_suffix return self.destdir + self.const.archives_dir_suffix
def tmp_dir(self): def tmp_dir(self):
return self.destdir + self.const.tmp_dir_suffix return self.destdir + self.const.tmp_dir_suffix
def pkg_dir(self): def pkg_dir(self):
packageDir = self.spec.source.name + '-' \ packageDir = self.spec.source.name + '-' \
+ self.spec.source.version + '-' + self.spec.source.release + self.spec.source.version + '-' + self.spec.source.release
return self.destdir + self.const.tmp_dir_suffix \ return self.destdir + self.const.tmp_dir_suffix \
+ '/' + packageDir + '/' + packageDir
def pkg_work_dir(self): 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): 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() __instance = __impl()
-1
View File
@@ -43,4 +43,3 @@ def installable(pkg):
return False return False
else: else:
return satisfiesRuntimeDeps(pkg) and satisfiesInstallDeps(pkg) return satisfiesRuntimeDeps(pkg) and satisfiesInstallDeps(pkg)
-1
View File
@@ -136,4 +136,3 @@ class Progress:
return percent return percent
else: else:
return 0 return 0
+1 -2
View File
@@ -46,7 +46,7 @@ def install(self, package_fn):
# unzip package in place # unzip package in place
package.extract_dir_flat(ctx.destdir) package.extract_dir_flat(ctx.destdir)
# update databases # update databases
# installdb # installdb
@@ -54,4 +54,3 @@ def install(self, package_fn):
metadata.source.version, metadata.source.version,
metadata.source.release, metadata.source.release,
ctx.install_dir() + '/files.xml') ctx.install_dir() + '/files.xml')
+1 -2
View File
@@ -59,6 +59,5 @@ def purge(pkg):
(status, version, release) = d[pkg] (status, version, release) = d[pkg]
f = files_name(pkg, version, release) f = files_name(pkg, version, release)
if util.check_file(f): if util.check_file(f):
os.unlink(f) os.unlink(f)
del d[pkg] del d[pkg]
+5 -5
View File
@@ -9,11 +9,11 @@ class MetaData(SpecFile):
"""This is a superset of the source spec definition""" """This is a superset of the source spec definition"""
def read(self, filename): def read(self, filename):
super(MetaData, self).read(filename) super(MetaData, self).read(filename)
distribution = self.getNodeText("Source/Distribution") distribution = self.getNodeText("Source/Distribution")
distributionRelease = self.getNodeText("Source/DistributionRelease") distributionRelease = self.getNodeText("Source/DistributionRelease")
architecture = self.getNodeText("Source/Architecture") architecture = self.getNodeText("Source/Architecture")
installedSize = int(self.getNodeText("Source/InstalledSize")) installedSize = int(self.getNodeText("Source/InstalledSize"))
def write(self, filename): def write(self, filename):
ui.info("METADATA WRITE NOT IMPLEMENTED\n") ui.info("METADATA WRITE NOT IMPLEMENTED\n")
-1
View File
@@ -17,4 +17,3 @@ class const:
raise self.ConstError, "Can't unbind constant: %s" % name raise self.ConstError, "Can't unbind constant: %s" % name
# we don't have an attribute by this name # we don't have an attribute by this name
raise NameError, name raise NameError, name
-1
View File
@@ -25,4 +25,3 @@ def add_package(name, package_info):
def remove_package(name): def remove_package(name):
del d[name] del d[name]
+1 -1
View File
@@ -48,7 +48,7 @@ class SourceArchive:
fetch.fetch() 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: if percentHook:
ui.info('\n') ui.info('\n')
pass pass
-1
View File
@@ -48,4 +48,3 @@ class CLI:
# default UI is CLI # default UI is CLI
ui = CLI() ui = CLI()
+3 -3
View File
@@ -170,6 +170,6 @@ def do_patch(patch, p=0):
raise UtilError("ERROR: patch (%s) failed: %s" % (patch, strlist (o))) raise UtilError("ERROR: patch (%s) failed: %s" % (patch, strlist (o)))
def partition_freespace(directory): def partition_freespace(directory):
""" returns free space of given directory's partition """ """ returns free space of given directory's partition """
st = os.statvfs(directory) st = os.statvfs(directory)
return st[statvfs.F_BSIZE] * st[statvfs.F_BFREE] return st[statvfs.F_BSIZE] * st[statvfs.F_BFREE]
+1 -1
View File
@@ -182,7 +182,7 @@ class XmlFile(object):
return getNode(self.dom.documentElement, tagPath) return getNode(self.dom.documentElement, tagPath)
def getNodeText(self, 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() self.verifyRootTag()
return getNodeText(getNode(self.dom.documentElement, tagPath)) return getNodeText(getNode(self.dom.documentElement, tagPath))
+1 -1
View File
@@ -5,7 +5,7 @@ from pisi.actionsapi import gnuconfig
class gnuConfigTestCase(unittest.TestCase): class gnuConfigTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
self.gnuconfig = gnuconfig.gnuconfig_findnewest() self.gnuconfig = gnuconfig.gnuconfig_findnewest()
def testFindNewest(self): def testFindNewest(self):
self.assertEqual(self.gnuconfig, '/usr/share/automake-1.4') self.assertEqual(self.gnuconfig, '/usr/share/automake-1.4')
+8 -8
View File
@@ -11,7 +11,7 @@ from pisi import context
class ArchiveFileTestCase(unittest.TestCase): class ArchiveFileTestCase(unittest.TestCase):
# def setUp(self): # def setUp(self):
# pass # pass
def testUnpackTar(self): def testUnpackTar(self):
ctx = context.Context("samples/popt/popt.pspec") ctx = context.Context("samples/popt/popt.pspec")
@@ -20,22 +20,22 @@ class ArchiveFileTestCase(unittest.TestCase):
fileName = os.path.basename(ctx.spec.source.archiveUri) fileName = os.path.basename(ctx.spec.source.archiveUri)
filePath = ctx.archives_dir() + '/' + fileName filePath = ctx.archives_dir() + '/' + fileName
achv = archive.Archive(filePath, ctx.spec.source.archiveType) achv = archive.Archive(filePath, ctx.spec.source.archiveType)
assert ctx.spec.source.archiveType == "targz" assert ctx.spec.source.archiveType == "targz"
# unpacking is trivial with Archive() # unpacking is trivial with Archive()
achv.unpack(targetDir) achv.unpack(targetDir)
# but testing is hard # but testing is hard
# "var/tmp/pisi/popt-1.7-3/work" (targetDir) # "var/tmp/pisi/popt-1.7-3/work" (targetDir)
assert pathexists(targetDir + "/popt-1.7") assert pathexists(targetDir + "/popt-1.7")
testfile = targetDir + "/popt-1.7/Makefile.am" testfile = targetDir + "/popt-1.7/Makefile.am"
assert pathexists(testfile) assert pathexists(testfile)
# check file integrity # check file integrity
self.assertEqual(util.sha1_file(testfile), self.assertEqual(util.sha1_file(testfile),
"5af9dd7d754f788cf511c57ce0af3d555fed009d") "5af9dd7d754f788cf511c57ce0af3d555fed009d")
def testUnpackZip(self): def testUnpackZip(self):
ctx = context.Context("tests/sandbox/sandbox.pspec") ctx = context.Context("tests/sandbox/sandbox.pspec")
@@ -55,15 +55,15 @@ class ArchiveFileTestCase(unittest.TestCase):
testfile = targetDir + "/sandbox/borek.cs" testfile = targetDir + "/sandbox/borek.cs"
assert pathexists(testfile) assert pathexists(testfile)
# check file integrity # check file integrity
self.assertEqual(util.sha1_file(testfile), self.assertEqual(util.sha1_file(testfile),
"06d0ee5ba49eccae6bc20552d55b3ba5ad52995e") "06d0ee5ba49eccae6bc20552d55b3ba5ad52995e")
# check for symbolic links # check for symbolic links
testfile = targetDir + "/sandbox/deneme/hed" testfile = targetDir + "/sandbox/deneme/hed"
assert islink(testfile) assert islink(testfile)
def testUnpackZipCond(self): def testUnpackZipCond(self):
ctx = context.Context("tests/sandbox/sandbox.pspec") ctx = context.Context("tests/sandbox/sandbox.pspec")
fetch = fetcher.Fetcher(ctx) fetch = fetcher.Fetcher(ctx)
+2 -2
View File
@@ -6,7 +6,7 @@ from pisi import context
class ContextTestCase(unittest.TestCase): class ContextTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
self.ctx = context.Context("samples/popt/popt.pspec") self.ctx = context.Context("samples/popt/popt.pspec")
def testConstness(self): def testConstness(self):
# test if we can get a const attribute? # test if we can get a const attribute?
try: try:
@@ -17,7 +17,7 @@ class ContextTestCase(unittest.TestCase):
# test binding a new constant # test binding a new constant
self.ctx.const.test = "test binding" self.ctx.const.test = "test binding"
# test re-binding (which is illegal) # test re-binding (which is illegal)
try: try:
self.ctx.const.test = "test rebinding" self.ctx.const.test = "test rebinding"
+2 -2
View File
@@ -10,12 +10,12 @@ class FetcherTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
self.ctx = context.Context("samples/popt/popt.pspec") self.ctx = context.Context("samples/popt/popt.pspec")
self.fetch = fetcher.Fetcher(self.ctx) self.fetch = fetcher.Fetcher(self.ctx)
def testFetch(self): def testFetch(self):
self.fetch.fetch() self.fetch.fetch()
destpath = self.fetch.filedest + "/" + self.fetch.filename destpath = self.fetch.filedest + "/" + self.fetch.filename
if os.access(destpath, os.R_OK): if os.access(destpath, os.R_OK):
self.assertEqual(util.sha1_file(destpath), self.assertEqual(util.sha1_file(destpath),
self.ctx.spec.source.archiveSHA1) self.ctx.spec.source.archiveSHA1)
suite = unittest.makeSuite(FetcherTestCase) suite = unittest.makeSuite(FetcherTestCase)
+10 -10
View File
@@ -18,16 +18,16 @@ def run_all():
import actionsapitests import actionsapitests
alltests = unittest.TestSuite(( alltests = unittest.TestSuite((
specfiletests.suite, specfiletests.suite,
specfiletests.suite, specfiletests.suite,
metadatatests.suite, metadatatests.suite,
contexttests.suite, contexttests.suite,
fetchertests.suite, fetchertests.suite,
archivetests.suite, archivetests.suite,
installdbtests.suite, installdbtests.suite,
packagedbtests.suite, packagedbtests.suite,
actionsapitests.suite actionsapitests.suite
)) ))
runTestSuite(alltests) runTestSuite(alltests)
+7 -7
View File
@@ -9,28 +9,28 @@ class SpecFileTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
self.spec = specfile.SpecFile() self.spec = specfile.SpecFile()
self.spec.read("samples/popt/popt.pspec") self.spec.read("samples/popt/popt.pspec")
def testSourceName(self): def testSourceName(self):
self.assertEqual(self.spec.source.name, self.assertEqual(self.spec.source.name,
"popt") "popt")
def testSourceVersion(self): def testSourceVersion(self):
self.assertEqual(self.spec.source.version, self.assertEqual(self.spec.source.version,
"1.7") "1.7")
def testSourceLastRelease(self): def testSourceLastRelease(self):
self.assertEqual(self.spec.source.release, self.assertEqual(self.spec.source.release,
"3") "3")
def testSHA1Sum(self): def testSHA1Sum(self):
self.assertEqual(self.spec.source.archiveSHA1, self.assertEqual(self.spec.source.archiveSHA1,
"66f3c77b87a160951b180447f4a6dce68ad2f71b") "66f3c77b87a160951b180447f4a6dce68ad2f71b")
def testLenPackages(self): def testLenPackages(self):
self.assertEqual(len(self.spec.packages), 1) self.assertEqual(len(self.spec.packages), 1)
def testCopy(self): def testCopy(self):
self.spec.read("samples/popt/popt.pspec") self.spec.read("samples/popt/popt.pspec")
self.spec.write(os.path.join(ctx.tmp_dir(), 'popt-copy.pspec')) self.spec.write(os.path.join(ctx.tmp_dir(), 'popt-copy.pspec'))
suite = unittest.makeSuite(SpecFileTestCase) suite = unittest.makeSuite(SpecFileTestCase)