* minor changes, add an argerror exception class to util

This commit is contained in:
Eray Özkural
2005-06-10 12:09:06 +00:00
parent 7aa13abe54
commit a3df1da59b
3 changed files with 22 additions and 5 deletions
+7 -2
View File
@@ -7,6 +7,8 @@ import util
#import dependency #import dependency
#import conflicts #import conflicts
class PisiInstallError(Exception):
pass
def install_package_file(package_fn): def install_package_file(package_fn):
@@ -16,9 +18,12 @@ def install_package_file(package_fn):
package.extract_files(install_dir) package.extract_files(install_dir)
# verify package # verify package
# check if we have all required files
specfile = SpecFile()
specfile.read(install_dir + "pspec.xml")
# check pspec semantics # check pspec semantics
specfile.verify()
# check file system requirements # check file system requirements
# check conflicts # check conflicts
# check dependencies # check dependencies
+12 -3
View File
@@ -1,6 +1,9 @@
#! /usr/bin/python #! /usr/bin/python
# -*- python -*- # -*- python -*-
import install
import util
def usage(progname = "pisi-install"): def usage(progname = "pisi-install"):
print """ print """
Usage: Usage:
@@ -27,13 +30,19 @@ def main():
sys.exit(1) sys.exit(1)
# package filename # package filename
packagefn = "" package_fn = ""
# TODO: We accept only one pspec file (at a time) currently, # TODO: We accept only one pspec file (at a time) currently,
# but pisi-build may build many packages (pspecs given in order) # but pisi-build may build many packages (pspecs given in order)
# sequentially. # sequentially.
if len(args) != 1: if len(args) != 1:
help() help()
raise PisiBuildError, "pisi-install excepts one (and only one) pspec file currently" raise util.ArgError, "pisi-install excepts one (and only one) package file currently"
else: else:
packagefn = args[0] package_fn = args[0]
install.install_package_file(package_fn)
if __name__ == "__main__":
main()
+3
View File
@@ -22,3 +22,6 @@ def run_batch(cmd):
# print a list # print a list
def strlist(l): def strlist(l):
return string.join(map(lambda x: str(x) + ' ', l)) return string.join(map(lambda x: str(x) + ' ', l))
class ArgError(Exception):
pass