Changing aur-shell.py name to pyshell.py
[AurShell.git] / plugin / package_management.py
blob86e84e1d61d7bf4bb843d8a6c19321424bacb559
1 #!/usr/bin/python
2 # -*- coding: utf-8-*-
4 import os
5 import conf
8 #--------------------------------------------#
9 # R E A D M E
11 # This plugin is not ready to use it.
12 # It's written only to test aurShell
13 #--------------------------------------------#
18 class pacman(object):
19 """Pacman wrapper\n\nFor more info, read man pacman"""
20 def __call__(self, *args):
21 """Default pacman commands wrapper. You can use it like normal pacman:
22 # pacman -S <arg1> <arg2>
23 # pacman -Qi <arg>
24 etc...
25 """
26 if args:
27 os.system("pacman %s" % " ".join(args))
28 else:
29 return self.__doc__
31 def search(self, *args):
32 return os.popen("pacman -Ss %s" % " ".join(*args)).read()
34 def install(sefl, *args):
35 os.system("pacman -S %s" % " ".join(*args))
37 def remove(self, *args):
38 os.system("pacman -R %s" % " ".join(*args))
42 class install(object):
43 """This should install some apps, but now, it's only testing module"""
44 def __call__(self, *args):
45 if args:
46 return self.pacman(*args)
47 else:
48 return self.__doc__
50 def pacman(sefl, *args):
51 os.system("pacman -S %s" % " ".join(*args))
53 class uninstall(object):
54 """Remove packages"""
55 def __call__(self, *args):
56 if args:
57 return self.pacman(*args)
58 else:
59 return self.__doc__
61 def pacman(self, *args):
62 os.system("pacman -R %s" % " ".join(*args))
64 class remove(uninstall):
65 pass
67 class search(object):
68 """Search for package"""
69 def __call__(self, *args):
70 if args:
71 return self.pacman(*args)
72 else:
73 return self.__doc__
75 def help(self, *ignore):
76 return "blah!\nno help for this class"
78 def pacman(self, *args):
79 try:
80 return os.popen("pacman -Ss %s" % " ".join(args)).read()
81 except TypeError:
82 return "Bad usage. Try:\n$ search pacman <arg1> [<arg2> ...]"
84 def info(self, *args):
85 return os.popen("pacman -Si %s" % " ".join(args)).read()