* pisi thing doesn't work so put the new opt parsing stuff in pisi-install instead
This commit is contained in:
@@ -13,9 +13,6 @@ import pisi.install
|
|||||||
import pisi.util
|
import pisi.util
|
||||||
from pisi.build import PisiBuild, PisiBuildError
|
from pisi.build import PisiBuild, PisiBuildError
|
||||||
|
|
||||||
class ArgError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
# common options
|
# common options
|
||||||
|
|||||||
Regular → Executable
+20
-23
@@ -4,36 +4,33 @@
|
|||||||
# python standard library
|
# python standard library
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
import sys
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
# pisi modules
|
||||||
sys.path.append("./lib")
|
sys.path.append("./lib")
|
||||||
import pisi.context
|
import pisi.context
|
||||||
import pisi.util
|
import pisi.util
|
||||||
from pisi.build import PisiBuild, PisiBuildError
|
from pisi.build import PisiBuild, PisiBuildError
|
||||||
|
|
||||||
def usage(progname = "pisi-build"):
|
|
||||||
print """
|
|
||||||
Usage:
|
|
||||||
%s [options] package-name.pspec
|
|
||||||
""" %(progname)
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
import sys
|
|
||||||
import getopt
|
# common options
|
||||||
|
|
||||||
# wrapper for usage(progname) function
|
usage = "usage: %prog [options] package-name.pspec"
|
||||||
help = lambda: usage(sys.argv[0])
|
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")
|
||||||
|
|
||||||
# getopt magic
|
(options, args) = parser.parse_args()
|
||||||
try:
|
|
||||||
opts, args = getopt.getopt(sys.argv[1:],"h",["help"])
|
|
||||||
except getopt.GetoptError:
|
|
||||||
help()
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
for opt, arg in opts:
|
print 'options = ', options
|
||||||
if opt == "-h":
|
print 'args = ', args
|
||||||
help()
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# pspec(PISI Spec) to be used for package
|
# pspec(PISI Spec) to be used for package
|
||||||
pspec = ""
|
pspec = ""
|
||||||
@@ -42,8 +39,9 @@ def main():
|
|||||||
# 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()
|
print "pisi-build expects one (and only one) pspec file currently"
|
||||||
raise PisiBuildError, "pisi-build expects one (and only one) pspec file currently"
|
print usage
|
||||||
|
sys.exit(2)
|
||||||
else:
|
else:
|
||||||
pspec = args[0]
|
pspec = args[0]
|
||||||
|
|
||||||
@@ -53,7 +51,6 @@ def main():
|
|||||||
# don't do the real job here. this is just a CLI!
|
# don't do the real job here. this is just a CLI!
|
||||||
pb = PisiBuild(ctx)
|
pb = PisiBuild(ctx)
|
||||||
pb.build()
|
pb.build()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Regular → Executable
Reference in New Issue
Block a user