SVN-like CLI
Desteklenen komutlar (şimdilik son derece basit). pisi help pisi install pisi build pisi updateindex
This commit is contained in:
@@ -5,7 +5,7 @@ import sys
|
||||
from optparse import OptionParser
|
||||
|
||||
import pisi
|
||||
from pisi.cli import buildhelper, installhelper
|
||||
from pisi.cli import buildhelper, installhelper, indexhelper
|
||||
|
||||
usage = """
|
||||
Detaylı help içeriği. Komutların teker teker açıklamaları vs...
|
||||
@@ -35,7 +35,13 @@ def build(options, args):
|
||||
buildhelper.build(arg)
|
||||
|
||||
def updateindex(options, args):
|
||||
pass
|
||||
"""Update the repos db with the given index file (pisi-index.xml)"""
|
||||
if len(args) != 1:
|
||||
help(options, "updateindex")
|
||||
|
||||
indexfile = args[0]
|
||||
indexhelper.updateindex(indexfile)
|
||||
|
||||
|
||||
def main():
|
||||
parser = OptionParser(usage=usage,version="%prog " + pisi.__version__)
|
||||
|
||||
@@ -1,42 +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
|
||||
from pisi.ui import ui
|
||||
|
||||
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()
|
||||
|
||||
for package_fn in args:
|
||||
try:
|
||||
ui.info('* Installing ' + package_fn + '\n')
|
||||
pisi.install.install(package_fn)
|
||||
except pisi.install.InstallError, estr:
|
||||
print '*** An installation error has occured:'
|
||||
print ' ', estr
|
||||
sys.exit(1)
|
||||
ui.info("Package(s) installed successfully as intended.\n")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,45 +0,0 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# sys modules
|
||||
import sys
|
||||
from optparse import OptionParser
|
||||
|
||||
#sys.path.append("./lib")
|
||||
from pisi.index import Index
|
||||
import pisi.util
|
||||
from pisi.ui import ui
|
||||
|
||||
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()
|
||||
|
||||
if len(args) != 1:
|
||||
print usage
|
||||
raise ArgError, "pisi-build expects a PISI index file"
|
||||
else:
|
||||
index_file = args[0]
|
||||
|
||||
ui.info('* Updating index from index file: ' + index_file + '\n')
|
||||
|
||||
index = Index()
|
||||
index.read(index_file)
|
||||
index.update_db()
|
||||
ui.info('* Package db updated.\n')
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from pisi.index import Index
|
||||
from pisi.ui import ui
|
||||
|
||||
def updateindex(indexfile):
|
||||
ui.info('* Updating index from index file: ' + indexfile + '\n')
|
||||
|
||||
index = Index()
|
||||
index.read(indexfile)
|
||||
index.update_db()
|
||||
|
||||
ui.info('* Package db updated.\n')
|
||||
@@ -0,0 +1,13 @@
|
||||
import sys
|
||||
|
||||
import pisi.install
|
||||
from pisi.ui import ui
|
||||
|
||||
def install(packagefile):
|
||||
try:
|
||||
ui.info('* Installing ' + packagefile + '\n')
|
||||
pisi.install.install(packagefile)
|
||||
except pisi.install.InstallError, e:
|
||||
print '*** An installation error has occured:'
|
||||
print '\t', e
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user