]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- removed python bindings (not packaged for two years) 136/head
authorArvin Schnell <aschnell@suse.de>
Thu, 11 Dec 2014 17:08:51 +0000 (18:08 +0100)
committerArvin Schnell <aschnell@suse.de>
Thu, 11 Dec 2014 17:08:51 +0000 (18:08 +0100)
bindings/Makefile.am [deleted file]
bindings/README [deleted file]
bindings/python/.gitignore [deleted file]
bindings/python/Makefile.am [deleted file]
bindings/python/examples/create.py [deleted file]
bindings/python/examples/test.py [deleted file]
bindings/python/libsnapper.i [deleted file]

diff --git a/bindings/Makefile.am b/bindings/Makefile.am
deleted file mode 100644 (file)
index 25b6729..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Makefile.am for libsnapper/bindings
-#
-
-SUBDIRS = python
diff --git a/bindings/README b/bindings/README
deleted file mode 100644 (file)
index 3f9add6..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-
-The language bindings here should not be used anymore. The now preferred
-method to use snapper is via DBus. You can find examples for various languages
-in the examples directory.
-
diff --git a/bindings/python/.gitignore b/bindings/python/.gitignore
deleted file mode 100644 (file)
index 67a5132..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-libsnapper.py
-libsnapper_wrap.*
-_libsnapper*
diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am
deleted file mode 100644 (file)
index 22ef8ec..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Makefile.am for libsnapper/bindings/python
-#
-
-EXTRA_DIST = libsnapper.i
-
-AM_CXXFLAGS = -fPIC -DPIC
-
-PYLIBVER ?= python$(PYTHON_VERSION)
-
-AM_CPPFLAGS = -I. -I${top_srcdir} -I/usr/include/$(PYLIBVER)
-
-DEPENDENCIES =                                         \
-       ${top_srcdir}/snapper/Factory.h                 \
-       ${top_srcdir}/snapper/Snapper.h                 \
-       ${top_srcdir}/snapper/Snapshot.h                \
-       ${top_srcdir}/snapper/File.h                    \
-       ${top_srcdir}/snapper/Comparison.h              \
-       ${top_srcdir}/snapper/Exception.h
-
-LIBS = $(top_builddir)/snapper/libsnapper.la
-
-python_PYTHON = libsnapper.py
-
-pyexec_LTLIBRARIES = _libsnapper.la
-
-_libsnapper_la_LDFLAGS = -module -avoid-version
-_libsnapper_la_HEADERS: $(top_builddir)/config.h
-
-_libsnapper_la_DEPENDENCIES =                          \
-       $(DEPENDENCIES)                                 \
-       ${top_builddir}/snapper/libsnapper.la
-
-nodist__libsnapper_la_SOURCES = libsnapper_wrap.cxx
-
-libsnapper.py libsnapper_wrap.cxx: libsnapper.i $(DEPENDENCIES)
-       swig -o libsnapper_wrap.cxx -c++ -python ${AM_CPPFLAGS} libsnapper.i
-
-CLEANFILES = libsnapper.py libsnapper_wrap.cxx
diff --git a/bindings/python/examples/create.py b/bindings/python/examples/create.py
deleted file mode 100755 (executable)
index 2cabdcd..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/python
-
-import libsnapper
-
-
-sh = libsnapper.createSnapper("root", False)
-
-sh.createSingleSnapshot("python test")
-
-libsnapper.deleteSnapper(sh)
-
diff --git a/bindings/python/examples/test.py b/bindings/python/examples/test.py
deleted file mode 100755 (executable)
index caedb82..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/python
-
-import libsnapper
-
-def print_snap_info( s ):
-  if isinstance( s, libsnapper.SwigPyIterator ): 
-    try:
-      s = s.value()
-    except StopIteration:
-      print "end iterator"
-      return
-  print s.getNum(), s.getType(), s.getDescription()
-
-sh = libsnapper.createSnapper("root", False)
-
-# testing getConfigs
-cl = libsnapper.Snapper.getConfigs()
-print cl.size()
-for i in cl: print i.config_name, i.subvolume
-
-# testing getIgnorePatterns
-pl = sh.getIgnorePatterns()
-print pl.size()
-for i in pl: print i
-
-# testing iterators over container
-sl = sh.getSnapshots()
-for i in sl: print_snap_info( i )
-print sl.size()
-i = sl.begin()
-while i!=sl.end():
-  print_snap_info( i )
-  i.incr()
-
-# testing find functions
-i = sl.find(3)
-print_snap_info( i )
-i = sl.getSnapshotCurrent()
-print_snap_info( i )
-i = sl.find(11)
-print_snap_info( i )
-j = sl.findPre(i)
-print_snap_info( j )
-i = sl.find(10)
-print_snap_info( i )
-
-# testing handling description
-j = sl.findPost(i)
-print_snap_info( j )
-s=j.value().getDescription()
-j.value().setDescription(s+" 1")
-j = sl.findPost(i)
-print_snap_info( j )
-s=j.value().getDescription()
-j.value().setDescription(s[:-2])
-
-# testing handling userdata
-j = sl.findPost(i)
-print_snap_info( j )
-s=j.value().getUserdata()
-print s.items()
-s["key1"] = "value1"
-s["key2"] = "value2"
-s["key3"] = "value3"
-j.value().setUserdata(s)
-j = sl.findPost(i)
-print_snap_info( j )
-t=j.value().getUserdata()
-print t.items()
-t.clear()
-j.value().setUserdata(t)
-j = sl.findPost(i)
-print_snap_info( j )
-print j.value().getUserdata().items()
-
-# testing compare functionality
-j=sl.find(11);
-i=sl.findPre(j);
-cmp=libsnapper.Comparison(sh,i,j)
-i1=cmp.getSnapshot1()
-i2=cmp.getSnapshot2()
-print_snap_info( i1 )
-print_snap_info( i2 )
-flist=cmp.getFiles()
-print flist.size()
-for f in flist:
-    print f.getAbsolutePath(libsnapper.LOC_SYSTEM), f.getAbsolutePath(libsnapper.LOC_PRE), f.getAbsolutePath(libsnapper.LOC_POST)
-    sl = f.getDiff("-u")
-    for s in sl: print s
-
-# testing set/getUndo
-f=flist.begin()
-if f != flist.end():
-  print f.value().getUndo()
-  f.value().setUndo(True)
-  print f.value().getUndo()
-  f.value().setUndo(False)
-  print f.value().getUndo()
-  f.value().setUndo(True)
-  print f.value().getUndo()
-
-# testing doUndo
-if f != flist.end():
-  print cmp.doUndo()
diff --git a/bindings/python/libsnapper.i b/bindings/python/libsnapper.i
deleted file mode 100644 (file)
index 3db2b15..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-//
-// Python interface definition for libsnapper
-//
-
-%module libsnapper
-
-%{
-using namespace std;
-
-#include <snapper/Factory.h>
-#include <snapper/Exception.h>
-#include <snapper/Snapshot.h>
-#include <snapper/Snapper.h>
-#include <snapper/File.h>
-#include <snapper/Comparison.h>
-%}
-
-using namespace std;
-
-%include "std_string.i"
-%include "std_vector.i"
-%include "std_list.i"
-%include "std_map.i"
-
-%typemap(out) std::string* {
-    $result = PyString_FromString($1->c_str());
-}
-
-%ignore snapper::Snapshots::begin();
-%ignore snapper::Snapshots::begin() const;
-%ignore snapper::Snapshots::end();
-%ignore snapper::Snapshots::end() const;
-%ignore snapper::Snapshots::find(unsigned int);
-%ignore snapper::Snapshots::find(unsigned int) const;
-%ignore snapper::Snapshots::findPre(snapper::Snapshots::const_iterator);
-%ignore snapper::Snapshots::findPre(snapper::Snapshots::const_iterator) const;
-%ignore snapper::Snapshots::findPost(snapper::Snapshots::const_iterator);
-%ignore snapper::Snapshots::findPost(snapper::Snapshots::const_iterator) const;
-%ignore snapper::Snapshots::getSnapshotCurrent() const;
-%ignore snapper::Comparison::getSnapshot1() const;
-%ignore snapper::Comparison::getSnapshot2() const;
-%ignore snapper::Files::begin();
-%ignore snapper::Files::begin() const;
-%ignore snapper::Files::end();
-%ignore snapper::Files::end() const;
-%ignore snapper::Files::find();
-%ignore snapper::Files::find() const;
-%ignore snapper::Files::findAbsolutePath();
-%ignore snapper::Files::findAbsolutePath() const;
-
-%include "../../snapper/Factory.h"
-%include "../../snapper/Exception.h"
-%include "../../snapper/Snapshot.h"
-%include "../../snapper/Snapper.h"
-%include "../../snapper/File.h"
-%include "../../snapper/Comparison.h"
-
-using namespace snapper;
-
-
-%template(vectorstring) std::vector<string>;
-%std_nodefconst_type(File);
-%template(vectorFile) std::vector<File, allocator< File > >;
-%template(mapstringstring) std::map<string,string>;
-%template(pairstringstring) std::pair<string,string>;
-%template(paircstringstring) std::pair<const string,string>;
-%std_nodefconst_type(ConfigInfo);
-%template(listConfigInfo) std::list<ConfigInfo>;
-%std_nodefconst_type(Snapshot);
-%template(listSnapshot) std::list<Snapshot, allocator< Snapshot > >;
-
-%extend snapper::Snapshots {
-%fragment("SwigPyIterator_T");
-
-%{
-template<class It>
-class MySwigPyIteratorTmpl : public swig::SwigPyIteratorClosed_T<It>
-{
-public:
-    typedef swig::SwigPyIteratorClosed_T<It> base;
-    typedef typename It::value_type value_type;
-
-    MySwigPyIteratorTmpl(It curr, It first, It last, PyObject *seq)
-        : swig::SwigPyIteratorClosed_T<It>(curr,first,last,seq), nend(last)
-       {}
-    PyObject *value() const {
-      if (base::current == nend) {
-       throw swig::stop_iteration();
-      } else {
-       value_type* p = const_cast<value_type *>(&(*base::current));
-       return swig::from_ptr(p,0);
-      }
-    return NULL;
-    }
-protected:
-    It nend;
-};
-
-typedef MySwigPyIteratorTmpl<snapper::Snapshots::iterator> MySnapshotIt;
-typedef MySwigPyIteratorTmpl<snapper::Snapshots::const_iterator> MyCSnapshotIt;
-typedef MySwigPyIteratorTmpl<snapper::Files::iterator> MyFileIt;
-typedef MySwigPyIteratorTmpl<snapper::Files::const_iterator> MyCFileIt;
-%}
-
-swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF)
-    {
-    return new MySnapshotIt(self->begin(), self->begin(),
-                            self->end(), *PYTHON_SELF);
-    }
-swig::SwigPyIterator* begin(PyObject **PYTHON_SELF)
-    {
-    return new MySnapshotIt(self->begin(), self->begin(),
-                           self->end(), *PYTHON_SELF);
-    }
-swig::SwigPyIterator* end(PyObject **PYTHON_SELF)
-    {
-    return new MySnapshotIt(self->end(), self->begin(),
-                           self->end(), *PYTHON_SELF);
-    }
-swig::SwigPyIterator* find(PyObject **PYTHON_SELF,unsigned int num)
-    {
-    return new MySnapshotIt(self->find(num), self->begin(),
-                           self->end(), *PYTHON_SELF);
-    }
-swig::SwigPyIterator* findPre(PyObject **PYTHON_SELF, PyObject *pobj )
-    {
-    swig::SwigPyIteratorClosed_T<snapper::Snapshots::iterator> *it = NULL;
-    void *argp = 0;
-    int ret = SWIG_ConvertPtr(pobj, &argp, SWIGTYPE_p_swig__SwigPyIterator, 0 );
-    if( SWIG_IsOK(ret))
-       {
-       swig::SwigPyIterator *pi = reinterpret_cast<swig::SwigPyIterator*>(argp);
-       it = dynamic_cast<swig::SwigPyIteratorClosed_T<snapper::Snapshots::iterator> *>(pi);
-       }
-    else
-       SWIG_exception_fail(SWIG_ArgError(ret), "in method '" "swig::SwigPyIterator* findPre" "', argument not of type swig::SwigPyIterator");
-
-    if( it )
-       return new MySnapshotIt(self->findPre(it->get_current()),
-                               self->begin(), self->end(), *PYTHON_SELF);
-    else
-
-       SWIG_exception_fail( SWIG_ArgError(ret),"argument of wrong swig::SwigPyIterator derived class in method '" "swig::SwigPyIterator* findPre" "'" );
-fail:
-    return NULL;
-    }
-
-swig::SwigPyIterator* findPost(PyObject **PYTHON_SELF, PyObject *pobj )
-    {
-    swig::SwigPyIteratorClosed_T<snapper::Snapshots::iterator> *it = NULL;
-    void *argp = 0;
-    int ret = SWIG_ConvertPtr(pobj, &argp, SWIGTYPE_p_swig__SwigPyIterator, 0 );
-    if( SWIG_IsOK(ret))
-       {
-       swig::SwigPyIterator *pi = reinterpret_cast<swig::SwigPyIterator*>(argp);
-       it = dynamic_cast<swig::SwigPyIteratorClosed_T<snapper::Snapshots::iterator> *>(pi);
-       }
-    else
-       SWIG_exception_fail(SWIG_ArgError(ret), "in method '" "swig::SwigPyIterator* findPre" "', argument not of type swig::SwigPyIterator");
-
-    if( it )
-       return new MySnapshotIt(self->findPost(it->get_current()),
-                               self->begin(), self->end(), *PYTHON_SELF);
-    else
-
-       SWIG_exception_fail( SWIG_ArgError(ret),"argument of wrong swig::SwigPyIterator derived class in method '" "swig::SwigPyIterator* findPre" "'" );
-fail:
-    return NULL;
-    }
-
-swig::SwigPyIterator* getSnapshotCurrent(PyObject **PYTHON_SELF)
-    {
-    return new MySnapshotIt(self->begin(), self->begin(),
-                           self->end(), *PYTHON_SELF);
-    }
-}
-
-%extend snapper::Comparison {
-
-Comparison( const snapper::Snapper* sn, PyObject *pobj1, PyObject *pobj2 )
-    {
-    swig::SwigPyIteratorClosed_T<snapper::Snapshots::iterator> *it1 = NULL;
-    swig::SwigPyIteratorClosed_T<snapper::Snapshots::iterator> *it2 = NULL;
-    void *argp = 0;
-    int ret = SWIG_ConvertPtr(pobj1, &argp, SWIGTYPE_p_swig__SwigPyIterator, 0 );
-    if( SWIG_IsOK(ret))
-       {
-       swig::SwigPyIterator *pi = reinterpret_cast<swig::SwigPyIterator*>(argp);
-       it1 = dynamic_cast<swig::SwigPyIteratorClosed_T<snapper::Snapshots::iterator> *>(pi);
-       }
-    else
-       SWIG_exception_fail(SWIG_ArgError(ret), "in method '" "swig::SwigPyIterator* findPre" "', argument 2 not of type swig::SwigPyIterator");
-
-    ret = SWIG_ConvertPtr(pobj2, &argp, SWIGTYPE_p_swig__SwigPyIterator, 0 );
-    if( SWIG_IsOK(ret))
-       {
-       swig::SwigPyIterator *pi = reinterpret_cast<swig::SwigPyIterator*>(argp);
-       it2 = dynamic_cast<swig::SwigPyIteratorClosed_T<snapper::Snapshots::iterator> *>(pi);
-       }
-    else
-       SWIG_exception_fail(SWIG_ArgError(ret), "in method '" "swig::SwigPyIterator* findPre" "', argument 3 not of type swig::SwigPyIterator");
-
-    if( it1 && it2 )
-       return new snapper::Comparison( sn, it1->get_current(), it2->get_current() );
-    else if( it1 )
-
-       SWIG_exception_fail( SWIG_ArgError(ret),"argument 3 of wrong swig::SwigPyIterator derived class in method '" "swig::SwigPyIterator* findPre" "'" );
-    else
-       SWIG_exception_fail( SWIG_ArgError(ret),"argument 2 of wrong swig::SwigPyIterator derived class in method '" "swig::SwigPyIterator* findPre" "'" );
-fail:
-    return NULL;
-    }
-
-swig::SwigPyIterator* getSnapshot1(PyObject **PYTHON_SELF)
-    {
-    snapper::Snapshots::const_iterator c = self->getSnapshot1();
-    snapper::Snapshots::const_iterator b = self->getSnapper()->getSnapshots().begin();
-    snapper::Snapshots::const_iterator e = self->getSnapper()->getSnapshots().end();
-
-    return new MyCSnapshotIt(c, b, e, *PYTHON_SELF);
-    }
-
-swig::SwigPyIterator* getSnapshot2(PyObject **PYTHON_SELF)
-    {
-    snapper::Snapshots::const_iterator c = self->getSnapshot2();
-    snapper::Snapshots::const_iterator b = self->getSnapper()->getSnapshots().begin();
-    snapper::Snapshots::const_iterator e = self->getSnapper()->getSnapshots().end();
-
-    return new MyCSnapshotIt(c, b, e, *PYTHON_SELF);
-    }
-}
-
-%extend snapper::Files {
-
-swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF)
-    {
-    return new MyFileIt(self->begin(), self->begin(),
-                        self->end(), *PYTHON_SELF);
-    }
-swig::SwigPyIterator* begin(PyObject **PYTHON_SELF)
-    {
-    return new MyFileIt(self->begin(), self->begin(),
-                       self->end(), *PYTHON_SELF);
-    }
-swig::SwigPyIterator* end(PyObject **PYTHON_SELF)
-    {
-    return new MyFileIt(self->end(), self->begin(),
-                       self->end(), *PYTHON_SELF);
-    }
-}
-