Hello community, here is the log from the commit of package python-pysmbc for openSUSE:Factory checked in at 2020-03-27 00:28:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pysmbc (Old) and /work/SRC/openSUSE:Factory/.python-pysmbc.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pysmbc" Fri Mar 27 00:28:24 2020 rev:4 rq:787474 version:1.0.19 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pysmbc/python-pysmbc.changes 2020-01-08 19:32:15.784594356 +0100 +++ /work/SRC/openSUSE:Factory/.python-pysmbc.new.3160/python-pysmbc.changes 2020-03-27 00:28:26.856352547 +0100 @@ -1,0 +2,6 @@ +Mon Mar 23 12:56:53 UTC 2020 - pgaj...@suse.com + +- version update to 1.0.19 + * no upstream changelog found (NEWS not updated) + +------------------------------------------------------------------- Old: ---- pysmbc-1.0.18.tar.bz2 New: ---- pysmbc-1.0.19.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pysmbc.spec ++++++ --- /var/tmp/diff_new_pack.qnJ3cU/_old 2020-03-27 00:28:28.012353132 +0100 +++ /var/tmp/diff_new_pack.qnJ3cU/_new 2020-03-27 00:28:28.016353134 +0100 @@ -21,7 +21,7 @@ # Tests don't work in rpmbuild sandbox %bcond_with test Name: python-pysmbc -Version: 1.0.18 +Version: 1.0.19 Release: 0 Summary: Python bindings for samba clients (libsmbclient) License: GPL-2.0-or-later ++++++ pysmbc-1.0.18.tar.bz2 -> pysmbc-1.0.19.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysmbc-1.0.18/PKG-INFO new/pysmbc-1.0.19/PKG-INFO --- old/pysmbc-1.0.18/PKG-INFO 2019-09-27 10:38:36.000000000 +0200 +++ new/pysmbc-1.0.19/PKG-INFO 2020-03-18 15:01:26.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pysmbc -Version: 1.0.18 +Version: 1.0.19 Summary: Python bindings for libsmbclient Home-page: https://github.com/hamano/pysmbc Author: ['Tim Waugh <twa...@redhat.com>', 'Tsukasa Hamano <ham...@osstech.co.jp>', 'Roberto Polli <rpo...@babel.it>'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysmbc-1.0.18/README.md new/pysmbc-1.0.19/README.md --- old/pysmbc-1.0.18/README.md 2019-09-27 10:36:50.000000000 +0200 +++ new/pysmbc-1.0.19/README.md 2020-03-18 15:00:57.000000000 +0100 @@ -13,9 +13,11 @@ Currently libsmbclient 3.2.x or later is required. Ubuntu Example: ~~~ -# sudo apt install pkg-config libopencv-dev smbclient libsmbclient libsmbclient-dev +# sudo apt install build-essential pkg-config smbclient libsmbclient libsmbclient-dev python-dev ~~~ +Or `python3-dev` instead of `python-dev` depending on your needs. + Build ------ ~~~ @@ -49,8 +51,59 @@ NOTE: to run your tests, you need - * a running samba server - * one shared folder with + * a running samba server + * one shared folder with * rw permissions * guest ok = no +Examples +------ + +Directory listing + +~~~ +>>> import smbc +>>> ctx = smbc.Context (auth_fn=my_auth_callback_fn) +>>> entries = ctx.opendir ("smb://SERVER").getdents () +>>> for entry in entries: +... print entry +<smbc.Dirent object "music" (File share) at 0x7fbd7c42b3a0> +<smbc.Dirent object "IPC$" (IPC share) at 0x7fbd7c42b148> +<smbc.Dirent object "Charlie" (Printer share) at 0x7fbd7c42b3c8> +>>> d = ctx.open ("smb://SERVER/music") +~~~ + +Shared Printer Listing + +~~~ +>>> import smbc +>>> ctx = smbc.Context() +>>> ctx.optionNoAutoAnonymousLogin = True +>>> ctx.functionAuthData = lambda se, sh, w, u, p: (domain_name, domain_username, domain_password) +>>> uri = 'smb://' + smb_server +>>> shared_printers = [] +>>> entries = ctx.opendir(uri).getdents() +>>> for entry in entries: +>>> if entry.smbc_type == 4: +>>> shared_printers.append(entry.name) +~~~ + +Write file + +~~~ +>>> import smbc +>>> import os +>>> ctx = smbc.Context (auth_fn=my_auth_callback_fn) +>>> file = ctx.open ("smb://SERVER/music/file.txt", os.O_CREAT | os.O_WRONLY) +>>> file.write ("hello") +~~~ + +Read file + +~~~ +>>> import smbc +>>> ctx = smbc.Context (auth_fn=my_auth_callback_fn) +>>> file = ctx.open ("smb://SERVER/music/file.txt") +>>> print file.read() +hello +~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysmbc-1.0.18/pysmbc.egg-info/PKG-INFO new/pysmbc-1.0.19/pysmbc.egg-info/PKG-INFO --- old/pysmbc-1.0.18/pysmbc.egg-info/PKG-INFO 2019-09-27 10:38:36.000000000 +0200 +++ new/pysmbc-1.0.19/pysmbc.egg-info/PKG-INFO 2020-03-18 15:01:26.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pysmbc -Version: 1.0.18 +Version: 1.0.19 Summary: Python bindings for libsmbclient Home-page: https://github.com/hamano/pysmbc Author: ['Tim Waugh <twa...@redhat.com>', 'Tsukasa Hamano <ham...@osstech.co.jp>', 'Roberto Polli <rpo...@babel.it>'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysmbc-1.0.18/setup.py new/pysmbc-1.0.19/setup.py --- old/pysmbc-1.0.18/setup.py 2019-09-27 10:37:31.000000000 +0200 +++ new/pysmbc-1.0.19/setup.py 2020-03-18 15:00:57.000000000 +0100 @@ -74,7 +74,7 @@ setup( name="pysmbc", - version="1.0.18", + version="1.0.19", description="Python bindings for libsmbclient", long_description=__doc__, author=[ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysmbc-1.0.18/smbc/context.c new/pysmbc-1.0.19/smbc/context.c --- old/pysmbc-1.0.18/smbc/context.c 2019-09-27 10:36:50.000000000 +0200 +++ new/pysmbc-1.0.19/smbc/context.c 2020-03-18 15:00:57.000000000 +0100 @@ -116,15 +116,17 @@ PyObject *auth = NULL; int debug = 0; SMBCCTX *ctx; + char *proto = NULL; static char *kwlist[] = { "auth_fn", "debug", + "proto", NULL }; - if (!PyArg_ParseTupleAndKeywords (args, kwds, "|Oi", kwlist, - &auth, &debug)) + if (!PyArg_ParseTupleAndKeywords (args, kwds, "|Oi|s", kwlist, + &auth, &debug, &proto)) { return -1; } @@ -140,9 +142,18 @@ Py_INCREF (auth); self->auth_fn = auth; } - - debugprintf ("-> Setting client max protocol to SMB3()\n"); - lp_set_cmdline("client max protocol", "SMB3"); + + debugprintf("-> wanted proto ver %s\n", proto); + if(proto) + { + debugprintf ("-> Setting client max protocol to %s()\n", proto); + lp_set_cmdline("client max protocol", proto); + debugprintf ("-> Setting client min protocol to %s()\n", proto); + lp_set_cmdline("client min protocol", proto); + } else { + debugprintf ("-> Setting client max protocol to SMB3()\n"); + lp_set_cmdline("client max protocol", "SMB3"); + } debugprintf ("-> Context_init ()\n"); @@ -882,6 +893,34 @@ return 0; } +static PyObject * +Context_getPort (Context *self, void *closure) +{ + int port = smbc_getPort (self->context); + return PyLong_FromLong (port); +} + +static int +Context_setPort (Context *self, PyObject *value, void *closure) +{ +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check (value)) +#else + if (!PyLong_Check (value)) +#endif + { + PyErr_SetString (PyExc_TypeError, "must be long"); + return -1; + } + +#if PY_MAJOR_VERSION < 3 + smbc_setPort (self->context, PyInt_AsLong (value)); +#else + smbc_setPort (self->context, PyLong_AsLong (value)); +#endif + return 0; +} + static int Context_setFunctionAuthData (Context *self, PyObject *value, void *closure) { @@ -1034,6 +1073,12 @@ "Get the timeout used for waiting on connections and response data(in milliseconds)", NULL }, + { "port", + (getter) Context_getPort, + (setter) Context_setPort, + "Set the TCP port used to connect (0 means default).", + NULL }, + { "functionAuthData", (getter) NULL, (setter) Context_setFunctionAuthData, @@ -1186,7 +1231,7 @@ " to names. Without the plus sign, SIDs are not mapped;\n" " rather they are simply converted to a string format.\n" "@return: a string representing the actual extended attributes of the uri" }, - + { "setxattr", (PyCFunction) Context_setxattr, METH_VARARGS, "setxattr(uri, the_acl) -> int\n\n"