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()
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()
+40 -40
View File
@@ -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):
+19 -19
View File
@@ -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()
-1
View File
@@ -43,4 +43,3 @@ def installable(pkg):
return False
else:
return satisfiesRuntimeDeps(pkg) and satisfiesInstallDeps(pkg)
-1
View File
@@ -136,4 +136,3 @@ class Progress:
return percent
else:
return 0
+1 -2
View File
@@ -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')
+1 -2
View File
@@ -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]
+5 -5
View File
@@ -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")
-1
View File
@@ -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
-1
View File
@@ -25,4 +25,3 @@ def add_package(name, package_info):
def remove_package(name):
del d[name]
+1 -1
View File
@@ -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
-1
View File
@@ -48,4 +48,3 @@ class CLI:
# default UI is 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)))
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]
+1 -1
View File
@@ -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))
+1 -1
View File
@@ -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')
+8 -8
View File
@@ -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)
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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)
+10 -10
View File
@@ -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)
+7 -7
View File
@@ -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)