poldek: poldek/python/poldekmod.i, poldek/python/test.py - 'no sou...

mis mis at pld-linux.org
Wed Jun 27 23:49:34 CEST 2007


Author: mis                          Date: Wed Jun 27 21:49:34 2007 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- 'no sources loaded' case

---- Files affected:
poldek/poldek/python:
   poldekmod.i (1.12 -> 1.13) , test.py (1.16 -> 1.17) 

---- Diffs:

================================================================
Index: poldek/poldek/python/poldekmod.i
diff -u poldek/poldek/python/poldekmod.i:1.12 poldek/poldek/python/poldekmod.i:1.13
--- poldek/poldek/python/poldekmod.i:1.12	Wed Jun 27 18:20:46 2007
+++ poldek/poldek/python/poldekmod.i	Wed Jun 27 23:49:29 2007
@@ -82,9 +82,9 @@
 */
 
 %extend poclidek_rcmd {
-    /*poclidek_rcmd(struct poclidek_ctx *cctx, struct poldek_ts *ts) {
+    poclidek_rcmd(struct poclidek_ctx *cctx, struct poldek_ts *ts) {
         return poclidek_rcmd_new(cctx, ts);
-    }*/
+    }
 
     poclidek_rcmd(struct poclidek_ctx *cctx) {
         return poclidek_rcmd_new(cctx, NULL);
@@ -108,9 +108,6 @@
     poclidek_ctx(struct poldek_ctx *ctx) {
         return poclidek_new(ctx);
     }
-
-    struct poclidek_rcmd *rcmd_new(struct poldek_ts *ts) {
-        return poclidek_rcmd_new(self, ts); }
 
     ~poclidek_ctx() { poclidek_free(self); }
 };

================================================================
Index: poldek/poldek/python/test.py
diff -u poldek/poldek/python/test.py:1.16 poldek/poldek/python/test.py:1.17
--- poldek/poldek/python/test.py:1.16	Wed Jun 27 18:20:46 2007
+++ poldek/poldek/python/test.py	Wed Jun 27 23:49:29 2007
@@ -1,9 +1,4 @@
 #!/usr/bin/python
-import os
-import re
-import sys
-import string
-from types import *
 import poldek
 
 def package_inspect(pkg):
@@ -46,9 +41,9 @@
                 type = 'dir'
                 
             if len(type) > 0:
-                print "  - requirement(%s): %s" % (type, r)
+                print "  - req(%s): %s" % (type, r)
             else:
-                print "  - requirement: %s" % r
+                print "  - req: %s" % r
 
 
     print "Files: "
@@ -98,14 +93,18 @@
             s.set_enabled(False)
         print " -", s
 
-    if src is None:
+    if src is None and ctx.sources:
         src = ctx.sources[0]
         src.set_enabled(True)    # load first source
 
+    if src is None:
+        raise "No sources loaded"
+    
     print "Loading %s..." % src
     if ctx.load_sources():
         print "  loaded %d packages" % ctx.packages.length()
-        package_inspect(ctx.packages[0])
+        if ctx.packages:
+            package_inspect(ctx.packages[0])
         
 
 def demo_poclideklib(source_name = None):
@@ -116,10 +115,14 @@
             s.set_enabled(False)
         print " -", s
 
-    if src is None:
+    if src is None and ctx.sources:
         src = ctx.sources[0]
         src.set_enabled(True)    # load first source
 
+    if src is None:
+        raise "No sources loaded"
+    
+    print "Loading %s..." % src
     cctx = poldek.poclidek_ctx(ctx);
     cctx.load_packages(cctx.LOAD_ALL)   # see poclidek.h
     cli_command(cctx, "ls poldek*");
@@ -129,5 +132,5 @@
 poldek.lib_init()
 
 demo_poclideklib()
-
+#demo_poldeklib()
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/poldek/poldek/python/poldekmod.i?r1=1.12&r2=1.13&f=u
    http://cvs.pld-linux.org/poldek/poldek/python/test.py?r1=1.16&r2=1.17&f=u



More information about the pld-cvs-commit mailing list