Browse Source

Fix Python library; remove redundant dependencies.

Stefano Cossu 2 years ago
parent
commit
01b3950720
9 changed files with 10 additions and 12 deletions
  1. 3 2
      cpython/py_graph.h
  2. 1 1
      cpython/py_namespace.h
  3. BIN
      docs/dev/deps.pdf
  4. 1 1
      ext/hashmap
  5. 2 0
      include/namespace.h
  6. 0 2
      include/term.h
  7. 3 2
      setup.py
  8. 0 2
      src/environment.c
  9. 0 2
      src/namespace.c

+ 3 - 2
cpython/py_graph.h

@@ -192,9 +192,10 @@ Graph_set_uri (GraphObject *self, PyObject *value, void *closure)
         PyErr_SetString (PyExc_TypeError, "URI is not a Term type.");
         return -1;
     }
+    LSUP_Term *gr_uri = ((TermObject*)value)->ob_struct;
+    log_debug ("New graph URI: %s", (gr_uri->data));
 
-    LSUP_rc rc = LSUP_graph_set_uri (
-            self->ob_struct, ((TermObject*)value)->ob_struct);
+    LSUP_rc rc = LSUP_graph_set_uri (self->ob_struct, LSUP_term_copy (gr_uri));
 
     return rc == LSUP_OK ? 0 : -1;
 }

+ 1 - 1
cpython/py_namespace.h

@@ -72,7 +72,7 @@ NSMap_get (PyObject *self, PyObject *pfx_obj)
     if (PyUnicode_READY (pfx_obj) < 0) return NULL;
     const char *pfx = PyUnicode_AsUTF8 (pfx_obj);
 
-    const char *ns = LSUP_nsmap_get (((NSMapObject *)self)->ob_struct, pfx);
+    const char *ns = LSUP_nsmap_get_ns (((NSMapObject *)self)->ob_struct, pfx);
     if (!ns) Py_RETURN_NONE;
 
     PyObject *ns_obj = PyUnicode_FromString (ns);

BIN
docs/dev/deps.pdf


+ 1 - 1
ext/hashmap

@@ -1 +1 @@
-Subproject commit 774694ec6dd36f1bb8e5fd3a55a2c47e48295e21
+Subproject commit d9b23a5a4df7e572ec897357292cf377eca9b229

+ 2 - 0
include/namespace.h

@@ -1,6 +1,8 @@
 #ifndef _LSUP_NAMESPACE_H
 #define _LSUP_NAMESPACE_H
 
+#include "hashmap.h"
+
 #include "core.h"
 
 /** @brief Namespace prefix length, including terminator.

+ 0 - 2
include/term.h

@@ -4,8 +4,6 @@
 #include <assert.h>
 #include <regex.h>
 
-#include "hashmap.h"
-
 #include "buffer.h"
 #include "namespace.h"
 

+ 3 - 2
setup.py

@@ -25,6 +25,7 @@ sources = (
         path.join(EXT_DIR, 'openldap', 'libraries', 'liblmdb', 'mdb.c'),
         path.join(EXT_DIR, 'openldap', 'libraries', 'liblmdb', 'midl.c'),
         path.join(EXT_DIR, 'xxHash', 'xxhash.c'),
+        path.join(EXT_DIR, 'hashmap', 'hashmap.c'),
         path.join(EXT_DIR, 'tpl', 'src', 'tpl.c'),
         path.join(EXT_DIR, 'log', 'src', 'log.c'),
     ]
@@ -81,7 +82,7 @@ class LSUPInstallCmd(install):
 
 setup(
     name="lsup_rdf",
-    version="1.0a1",
+    version="1.0a2",
     description='Ultra-compact RDF library.',
     author='Stefano Cossu <https://notabug.org/scossu>',
     url='https://notabug.org/scossu/lsup_rdf',
@@ -96,7 +97,7 @@ setup(
             include_dirs=[
                 ROOT_DIR,
                 INCL_DIR,
-                path.join(EXT_DIR, 'uthash', 'src'),
+                path.join(EXT_DIR, 'hashmap'),
                 path.join(EXT_DIR, 'tpl', 'src'),
                 path.join(EXT_DIR, 'log', 'src'),
             ],

+ 0 - 2
src/environment.c

@@ -1,7 +1,5 @@
 #include <unistd.h>
 
-#include "hashmap.c"
-
 #include "term.h"
 #include "environment.h"
 

+ 0 - 2
src/namespace.c

@@ -1,5 +1,3 @@
-#include "hashmap.h"
-
 #include "core.h"
 #include "namespace.h"