* simpler still
This commit is contained in:
@@ -1,99 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# This is the CLI for PISI client
|
|
||||||
# It uses an interface similar to cvs/svn
|
|
||||||
# TODO: I don't know how to make this run with optparse yet -- exa
|
|
||||||
|
|
||||||
# system modules
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
|
|
||||||
# pisi modules
|
|
||||||
sys.path.append("./lib")
|
|
||||||
import pisi.install
|
|
||||||
import pisi.util
|
|
||||||
from pisi.build import PisiBuild, PisiBuildError
|
|
||||||
|
|
||||||
def main():
|
|
||||||
|
|
||||||
# common options
|
|
||||||
|
|
||||||
usage = "usage: %prog [options] cmd [args]"
|
|
||||||
parser = OptionParser(usage=usage,version="%prog " + pisi.__version__)
|
|
||||||
parser.add_option("-D", "--destdir", action="store")
|
|
||||||
parser.add_option("-v", "--verbose", action="store_true",
|
|
||||||
dest="verbose", default=False,
|
|
||||||
help="detailed output")
|
|
||||||
parser.add_option("-d", "--debug", action="store_true", default=True)
|
|
||||||
parser.add_option("-n", "--dry-run", action="store_true", default=False,
|
|
||||||
help = "do not perform any action, just show what\
|
|
||||||
would be done")
|
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
|
||||||
|
|
||||||
print 'options = ', options
|
|
||||||
print 'args = ', args
|
|
||||||
|
|
||||||
if len(args)==0:
|
|
||||||
print "command expected"
|
|
||||||
print usage
|
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
cmd = args.pop(0)
|
|
||||||
|
|
||||||
if cmd=="build":
|
|
||||||
|
|
||||||
usage = "usage: %prog build <pspecfile>"
|
|
||||||
cparser = OptionParser(usage=usage,version="%prog " + pisi.__version__)
|
|
||||||
(coptions, cargs) = parser.parse_args(args)
|
|
||||||
|
|
||||||
print '*', cargs
|
|
||||||
|
|
||||||
# pspec(PISI Spec) to be used for package
|
|
||||||
pspec = ""
|
|
||||||
|
|
||||||
# TODO: We accept only one pspec file (at a time) currently,
|
|
||||||
# but pisi-build may build many packages (pspecs given in order)
|
|
||||||
# sequentially.
|
|
||||||
if len(cargs) != 1:
|
|
||||||
print "build expects one (and only one) pspec file currently"
|
|
||||||
print usage
|
|
||||||
sys.exit(2)
|
|
||||||
else:
|
|
||||||
pspec = cargs[0]
|
|
||||||
|
|
||||||
# What we need to do first is create a context with our specfile
|
|
||||||
ctx = pisi.context.Context(pspec)
|
|
||||||
|
|
||||||
# don't do the real job here. this is just a CLI!
|
|
||||||
pb = PisiBuild(ctx)
|
|
||||||
pb.build()
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
if cmd=="install":
|
|
||||||
|
|
||||||
usage = "usage: %prog install <package>"
|
|
||||||
parser = OptionParser(usage=usage,version="%prog " + pisi.__version__)
|
|
||||||
(options, args) = parser.parse_args()
|
|
||||||
|
|
||||||
# package filename
|
|
||||||
package_fn = ""
|
|
||||||
|
|
||||||
# TODO: We accept only one package file arg ATM
|
|
||||||
if len(args) != 1:
|
|
||||||
print "install cmd expects one (and only one) package file currently"
|
|
||||||
print usage
|
|
||||||
sys.exit(2)
|
|
||||||
else:
|
|
||||||
package_fn = args[0]
|
|
||||||
|
|
||||||
pisi.install.install_package_file(package_fn)
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
print "command expected"
|
|
||||||
print usage
|
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# python standard library
|
|
||||||
from os.path import basename
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
|
|
||||||
# pisi modules
|
|
||||||
sys.path.append("./lib")
|
|
||||||
import pisi.context
|
|
||||||
import pisi.util
|
|
||||||
from pisi.build import PisiBuild, PisiBuildError
|
|
||||||
|
|
||||||
def main():
|
|
||||||
|
|
||||||
# common options
|
|
||||||
|
|
||||||
usage = "usage: %prog [options] package-name.pspec"
|
|
||||||
parser = OptionParser(usage=usage,version="%prog " + pisi.__version__)
|
|
||||||
parser.add_option("-D", "--destdir", action="store")
|
|
||||||
parser.add_option("-v", "--verbose", action="store_true",
|
|
||||||
dest="verbose", default=False,
|
|
||||||
help="detailed output")
|
|
||||||
parser.add_option("-d", "--debug", action="store_true", default=True)
|
|
||||||
parser.add_option("-n", "--dry-run", action="store_true", default=False,
|
|
||||||
help = "do not perform any action, just show what\
|
|
||||||
would be done")
|
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
|
||||||
|
|
||||||
print 'options = ', options
|
|
||||||
print 'args = ', args
|
|
||||||
|
|
||||||
# pspec(PISI Spec) to be used for package
|
|
||||||
pspec = ""
|
|
||||||
|
|
||||||
# TODO: We accept only one pspec file (at a time) currently,
|
|
||||||
# but pisi-build may build many packages (pspecs given in order)
|
|
||||||
# sequentially.
|
|
||||||
if len(args) != 1:
|
|
||||||
print "pisi-build expects one (and only one) pspec file currently"
|
|
||||||
print usage
|
|
||||||
sys.exit(2)
|
|
||||||
else:
|
|
||||||
pspec = args[0]
|
|
||||||
|
|
||||||
# What we need to do first is create a context with our specfile
|
|
||||||
ctx = pisi.context.Context(pspec)
|
|
||||||
|
|
||||||
# don't do the real job here. this is just a CLI!
|
|
||||||
pb = PisiBuild(ctx)
|
|
||||||
pb.build()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
#! /usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# sys modules
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
|
|
||||||
sys.path.append("./lib")
|
|
||||||
import pisi.install
|
|
||||||
import pisi.util
|
|
||||||
|
|
||||||
class ArgError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def main():
|
|
||||||
|
|
||||||
usage = "usage: %prog [options] <package>"
|
|
||||||
parser = OptionParser(usage=usage,version="%prog " + pisi.__version__)
|
|
||||||
parser.add_option("-D", "--destdir", action="store")
|
|
||||||
parser.add_option("-v", "--verbose", action="store_true",
|
|
||||||
dest="verbose", default=False,
|
|
||||||
help="detailed output")
|
|
||||||
parser.add_option("-d", "--debug", action="store_true", default=True)
|
|
||||||
parser.add_option("-n", "--dry-run", action="store_true",
|
|
||||||
default = "do not perform any action, just show what\
|
|
||||||
would be done")
|
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
|
||||||
|
|
||||||
# package filename
|
|
||||||
package_fn = ""
|
|
||||||
|
|
||||||
# TODO: We accept only one package file arg ATM
|
|
||||||
if len(args) != 1:
|
|
||||||
print usage
|
|
||||||
raise ArgError, "pisi-install expects one (and only one) package file currently"
|
|
||||||
else:
|
|
||||||
package_fn = args[0]
|
|
||||||
|
|
||||||
pisi.install.install_package_file(package_fn)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
Reference in New Issue
Block a user