| 1 |
#!/usr/bin/env python3 |
| 2 |
# |
| 3 |
# This program is distributed in the hope that it will be useful, |
| 4 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 6 |
# GNU General Public License for more details. |
| 7 |
# |
| 8 |
# You should have received a copy of the GNU General Public License |
| 9 |
# along with this program; if not, write to the Free Software |
| 10 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 11 |
|
| 12 |
# Copyright (C) 2008 Tim Lauridsen <[email protected]> |
| 13 |
# Copyright (C) 2008 Richard Hughes <[email protected]> |
| 14 |
|
| 15 |
# Dispacher script to run pk commands from stdin |
| 16 |
|
| 17 |
import sys |
| 18 |
import time |
| 19 |
import os |
| 20 |
|
| 21 |
sys.path.insert(0,os.path.join(os.getcwd(), 'lib', 'python')) |
| 22 |
|
| 23 |
from packagekit.backend import * |
| 24 |
|
| 25 |
class PackageKitYumBackend(PackageKitBaseBackend): |
| 26 |
def __init__(self, args, lock=True): |
| 27 |
PackageKitBaseBackend.__init__(self, args) |
| 28 |
PackageKitBaseBackend.doLock(self) |
| 29 |
# simulate doing something |
| 30 |
time.sleep(2) |
| 31 |
|
| 32 |
def unLock(self): |
| 33 |
PackageKitBaseBackend.unLock(self) |
| 34 |
# simulate doing something |
| 35 |
time.sleep(0.5) |
| 36 |
|
| 37 |
def search_name(self, filters, key): |
| 38 |
# check we escape spaces properly |
| 39 |
if key == ['power manager']: |
| 40 |
self.package("polkit;0.0.1;i386;data", INFO_AVAILABLE, "PolicyKit daemon") |
| 41 |
|
| 42 |
def main(): |
| 43 |
backend = PackageKitYumBackend('', lock=True) |
| 44 |
backend.dispatcher(sys.argv[1:]) |
| 45 |
|
| 46 |
if __name__ == "__main__": |
| 47 |
main() |