Hello community,
here is the log from the commit of package python-easypysmb for
openSUSE:Factory checked in at 2020-08-13 10:17:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-easypysmb (Old)
and /work/SRC/openSUSE:Factory/.python-easypysmb.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-easypysmb"
Thu Aug 13 10:17:31 2020 rev:2 rq:826030 version:1.4.4
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-easypysmb/python-easypysmb.changes
2018-11-15 12:39:20.206323906 +0100
+++
/work/SRC/openSUSE:Factory/.python-easypysmb.new.3399/python-easypysmb.changes
2020-08-13 10:21:43.258844856 +0200
@@ -1,0 +2,6 @@
+Sat Aug 8 17:07:28 UTC 2020 - Atri Bhattacharya <[email protected]>
+
+- Update to version 1.4.4:
+ * No documented changelog.
+
+-------------------------------------------------------------------
Old:
----
easypysmb-1.4.3.tar.gz
New:
----
easypysmb-1.4.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-easypysmb.spec ++++++
--- /var/tmp/diff_new_pack.rWWjkt/_old 2020-08-13 10:21:47.178846466 +0200
+++ /var/tmp/diff_new_pack.rWWjkt/_new 2020-08-13 10:21:47.182846467 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-easypysmb
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,22 +12,23 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-easypysmb
-Version: 1.4.3
+Version: 1.4.4
Release: 0
-License: GPL-3.0-only
Summary: PySMB wrapper library
-Url: https://github.com/pschmitt/easypysmb
+License: GPL-3.0-only
Group: Development/Languages/Python
+URL: https://github.com/pschmitt/easypysmb
Source:
https://files.pythonhosted.org/packages/source/e/easypysmb/easypysmb-%{version}.tar.gz
Source99:
https://raw.githubusercontent.com/pschmitt/easypysmb/master/LICENSE
-BuildRequires: python-rpm-macros
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
+BuildRequires: python-rpm-macros
Requires: python-pysmb
BuildArch: noarch
++++++ easypysmb-1.4.3.tar.gz -> easypysmb-1.4.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/easypysmb-1.4.3/PKG-INFO new/easypysmb-1.4.4/PKG-INFO
--- old/easypysmb-1.4.3/PKG-INFO 2017-07-25 15:53:05.000000000 +0200
+++ new/easypysmb-1.4.4/PKG-INFO 2020-08-06 12:33:57.731262700 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: easypysmb
-Version: 1.4.3
+Version: 1.4.4
Summary: Easy to use PySMB wrapper library
Home-page: https://github.com/pschmitt/easypysmb
Author: Philipp Schmitt
@@ -13,7 +13,7 @@
.. code-block::
- from easypysmb install EasyPySMB
+ from easypysmb import EasyPySMB
# Connect
e = EasyPySMB(
@@ -23,6 +23,9 @@
password='PassW0rd'
)
+ # List files
+ e.ls('share1/')
+
# Store files
e.store_file('/tmp/test.txt', 'share1/test.txt')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/easypysmb-1.4.3/README.rst
new/easypysmb-1.4.4/README.rst
--- old/easypysmb-1.4.3/README.rst 2017-07-25 15:49:51.000000000 +0200
+++ new/easypysmb-1.4.4/README.rst 2020-08-06 12:33:43.000000000 +0200
@@ -5,7 +5,7 @@
.. code-block::
- from easypysmb install EasyPySMB
+ from easypysmb import EasyPySMB
# Connect
e = EasyPySMB(
@@ -15,6 +15,9 @@
password='PassW0rd'
)
+ # List files
+ e.ls('share1/')
+
# Store files
e.store_file('/tmp/test.txt', 'share1/test.txt')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/easypysmb-1.4.3/easypysmb/easypysmb.py
new/easypysmb-1.4.4/easypysmb/easypysmb.py
--- old/easypysmb-1.4.3/easypysmb/easypysmb.py 2017-07-25 15:50:42.000000000
+0200
+++ new/easypysmb-1.4.4/easypysmb/easypysmb.py 2020-08-06 12:33:43.000000000
+0200
@@ -1,4 +1,4 @@
-#/usr/bin/python
+# /usr/bin/python
# coding: utf-8
@@ -13,42 +13,53 @@
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
-logging.getLogger('SMB.SMBConnection').setLevel(logging.WARNING)
+logging.getLogger("SMB.SMBConnection").setLevel(logging.WARNING)
def get_netbios_name(hostname):
- if hostname in ['127.0.0.1', 'localhost']:
- return 'localhost'
+ if hostname in ["127.0.0.1", "localhost"]:
+ return "localhost"
n = NetBIOS()
- resp = n.queryIPForName(hostname)
+ resp = n.queryIPForName(hostname)
if resp:
return resp[0]
else:
# Default to first part of hostname
# eg: smbsrv01.example.com -> smbsrv01
dns_name = socket.gethostbyaddr(hostname)[0] # "nslookup"
- return dns_name.split('.')[0]
+ return dns_name.split(".")[0]
-class EasyPySMB():
-
- def __init__(self, hostname, username='GUEST', password=None, domain=None,
- client_name=None, port=139, share_name=None, file_path=None,
- netbios_name=None):
- if hostname.startswith('smb://'):
- regex = 'smb://(((.+);)?(.+):(.+)@)?([^/]+)(/([^/]+))?(/.*)?'
+class EasyPySMB:
+ def __init__(
+ self,
+ hostname,
+ username="GUEST",
+ password=None,
+ domain=None,
+ client_name=None,
+ port=139,
+ share_name=None,
+ file_path=None,
+ netbios_name=None,
+ nocheck=False,
+ ):
+ if hostname.startswith("smb://"):
+ regex = "smb://(((.+);)?(.+):(.+)@)?([^/]+)(/([^/]+))?(/.*)?"
m = re.match(regex, hostname)
if not m:
- raise ValueError('Could not decompose smb path. The regex
failed.')
- domain = m.group(3) if m.group(3) else ''
- username = m.group(4) if m.group(4) else 'GUEST'
- password = m.group(5) if m.group(5) else ''
+ raise ValueError(
+ "Could not decompose smb path. The regex failed."
+ )
+ domain = m.group(3) if m.group(3) else ""
+ username = m.group(4) if m.group(4) else "GUEST"
+ password = m.group(5) if m.group(5) else ""
hostname = m.group(6)
share_name = m.group(8)
file_path = m.group(9)
logger.debug(
- 'Domain: {} Username: {} Password: {} Server: {} Share: {} ' \
- 'File Path: {}'.format(
+ "Domain: {} Username: {} Password: {} Server: {} Share: {} "
+ "File Path: {}".format(
domain, username, password, hostname, share_name, file_path
)
)
@@ -62,46 +73,53 @@
password=password,
my_name=client_name,
remote_name=netbios_name,
- use_ntlm_v2=True
+ use_ntlm_v2=True,
)
if not self.conn.connect(hostname, port):
logger.error(
- 'Could not connnect to SMB server. Please verify the '\
- 'connection data'
+ "Could not connnect to SMB server. Please verify the "
+ "connection data"
)
# tmpdir is a temp dir that holds the transfered files by default
- self.tmpdir = tempfile.mkdtemp(prefix='easypysmb_')
+ self.tmpdir = tempfile.mkdtemp(prefix="easypysmb_")
self.share_name = share_name
self.file_path = file_path
- if self.share_name:
- available_shares = [x.lower() for x in self.list_shares()]
- if self.share_name.lower() not in available_shares:
- logger.warning(
- 'Share {} does not exist on the
server'.format(self.share_name)
- )
- if self.file_path:
- dir_content = [x.filename for x in
self.ls(os.path.dirname(self.file_path))]
- if os.path.basename(self.file_path) not in dir_content:
- logger.warning(
- 'File {} does not exist on the
server'.format(self.file_path)
- )
+ if not nocheck:
+ if self.share_name:
+ available_shares = [x.lower() for x in self.list_shares()]
+ if self.share_name.lower() not in available_shares:
+ logger.warning(
+ "Share {} does not exist on the server".format(
+ self.share_name
+ )
+ )
+ if self.file_path:
+ dir_content = [
+ x.filename for x in
self.ls(os.path.dirname(self.file_path))
+ ]
+ if os.path.basename(self.file_path) not in dir_content:
+ logger.warning(
+ "File {} does not exist on the server".format(
+ self.file_path
+ )
+ )
def __decompose_smb_path(self, path):
- '''
+ """
Get the share name and filepath
- '''
- split_path = path.split('/')
- return split_path[0], '/'.join(split_path[1:])
+ """
+ split_path = path.split("/")
+ return split_path[0], "/".join(split_path[1:])
def __guess_share_name(self, path, share_name=None):
if share_name:
return share_name, path
available_shares = [x.lower() for x in self.list_shares()]
if not share_name:
- first_dir = path.split('/')[0].lower()
+ first_dir = path.split("/")[0].lower()
if first_dir in available_shares:
logger.info(
- 'Path {} matches share name {}'.format(path, first_dir)
+ "Path {} matches share name {}".format(path, first_dir)
)
share_name, path = self.__decompose_smb_path(path)
elif self.share_name:
@@ -117,25 +135,21 @@
def store_file(self, file_obj, dest_path=None, share_name=None, retries=3):
if not dest_path:
dest_path = self.file_path
- assert dest_path, 'Destination path is unset'
+ assert dest_path, "Destination path is unset"
share_name, dest_path = self.__guess_share_name(dest_path, share_name)
if type(file_obj) is str or type(file_obj) is str:
- file_obj = open(file_obj, 'rb')
+ file_obj = open(file_obj, "rb")
logger.info(
- 'Attempt to store {} on {}:{}'.format(
+ "Attempt to store {} on {}:{}".format(
file_obj.name, share_name, dest_path
)
)
for r in range(1, retries + 1):
try:
- return self.conn.storeFile(
- share_name,
- dest_path,
- file_obj
- )
+ return self.conn.storeFile(share_name, dest_path, file_obj)
except Exception as e:
logger.error(
- 'Attempt {}/{} to store file on SMB share
failed:\n{}'.format(
+ "Attempt {}/{} to store file on SMB share
failed:\n{}".format(
r, retries, e
)
)
@@ -143,12 +157,11 @@
def retrieve_file(self, dest_path=None, file_obj=None, share_name=None):
if not dest_path:
dest_path = self.file_path
- assert dest_path, 'Destination path is unset'
+ assert dest_path, "Destination path is unset"
share_name, dest_path = self.__guess_share_name(dest_path, share_name)
if not file_obj:
file_obj = open(
- os.path.join(self.tmpdir, os.path.basename(dest_path)),
- 'w+b'
+ os.path.join(self.tmpdir, os.path.basename(dest_path)), "w+b"
)
# file_obj = tempfile.NamedTemporaryFile(
# prefix='py_',
@@ -157,24 +170,31 @@
# delete=False
# )
elif type(file_obj) is str or type(file_obj) is str:
- file_obj = open(file_obj, 'wb')
- bytes_transfered = self.conn.retrieveFile(share_name, dest_path,
file_obj)
- logger.info('Transfered {} bytes'.format(bytes_transfered))
- file_obj.close() # write file
+ file_obj = open(file_obj, "wb")
+ bytes_transfered = self.conn.retrieveFile(
+ share_name, dest_path, file_obj
+ )
+ logger.info("Transfered {} bytes".format(bytes_transfered))
+ file_obj.close() # write file
file_obj = open(file_obj.name)
return file_obj
- def backup_file(self, backup_file_path, file_path=None, share_name=None,
- backup_share_name=None):
+ def backup_file(
+ self,
+ backup_file_path,
+ file_path=None,
+ share_name=None,
+ backup_share_name=None,
+ ):
if not file_path:
file_path = self.file_path
- assert file_path, 'Destination path is unset'
+ assert file_path, "Destination path is unset"
share_name, file_path = self.__guess_share_name(file_path, share_name)
backup_share_name, backup_file_path = self.__guess_share_name(
backup_file_path, backup_share_name
)
logger.info(
- 'Back up file {}:{} to {}:{}'.format(
+ "Back up file {}:{} to {}:{}".format(
share_name, file_path, backup_share_name, backup_file_path
)
)
@@ -187,7 +207,7 @@
res = self.store_file(
share_name=backup_share_name,
dest_path=backup_file_path,
- file_obj=tmp_file
+ file_obj=tmp_file,
)
# Clean up
os.remove(tmp_file.name)
@@ -196,14 +216,16 @@
def mkdir(self, dir_path, share_name=None):
share_name, dir_path = self.__guess_share_name(dir_path, share_name)
# Recursively create directories, just like mkdir -p does
- directories = dir_path.split('/')
- tmp_path = ''
+ directories = dir_path.split("/")
+ tmp_path = ""
for d in directories:
dir_content = self.conn.listPath(share_name, tmp_path)
if d not in [x.filename for x in dir_content if x.isDirectory]:
- logger.info('Directory {} is missing. Create it'.format(d))
- self.conn.createDirectory(share_name, '{}/{}'.format(tmp_path,
d))
- tmp_path += '/{}'.format(d)
+ logger.info("Directory {} is missing. Create it".format(d))
+ self.conn.createDirectory(
+ share_name, "{}/{}".format(tmp_path, d)
+ )
+ tmp_path += "/{}".format(d)
def rm(self, file_path, share_name=None):
if not share_name:
@@ -213,11 +235,11 @@
share_name, file_path = self.__decompose_smb_path(file_path)
return self.conn.deleteFiles(share_name, file_path)
- def ls(self, path='', share_name=None):
+ def ls(self, path="", share_name=None):
if not share_name:
if self.share_name:
share_name = self.share_name
else:
share_name, path = self.__decompose_smb_path(path)
- logger.info('List files in {}:{}'.format(share_name, path))
+ logger.info("List files in {}:{}".format(share_name, path))
return self.conn.listPath(share_name, path=path)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/easypysmb-1.4.3/easypysmb.egg-info/PKG-INFO
new/easypysmb-1.4.4/easypysmb.egg-info/PKG-INFO
--- old/easypysmb-1.4.3/easypysmb.egg-info/PKG-INFO 2017-07-25
15:53:05.000000000 +0200
+++ new/easypysmb-1.4.4/easypysmb.egg-info/PKG-INFO 2020-08-06
12:33:57.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: easypysmb
-Version: 1.4.3
+Version: 1.4.4
Summary: Easy to use PySMB wrapper library
Home-page: https://github.com/pschmitt/easypysmb
Author: Philipp Schmitt
@@ -13,7 +13,7 @@
.. code-block::
- from easypysmb install EasyPySMB
+ from easypysmb import EasyPySMB
# Connect
e = EasyPySMB(
@@ -23,6 +23,9 @@
password='PassW0rd'
)
+ # List files
+ e.ls('share1/')
+
# Store files
e.store_file('/tmp/test.txt', 'share1/test.txt')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/easypysmb-1.4.3/easypysmb.egg-info/SOURCES.txt
new/easypysmb-1.4.4/easypysmb.egg-info/SOURCES.txt
--- old/easypysmb-1.4.3/easypysmb.egg-info/SOURCES.txt 2017-07-25
15:53:05.000000000 +0200
+++ new/easypysmb-1.4.4/easypysmb.egg-info/SOURCES.txt 2020-08-06
12:33:57.000000000 +0200
@@ -1,4 +1,5 @@
README.rst
+pyproject.toml
setup.py
easypysmb/__init__.py
easypysmb/easypysmb.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/easypysmb-1.4.3/pyproject.toml
new/easypysmb-1.4.4/pyproject.toml
--- old/easypysmb-1.4.3/pyproject.toml 1970-01-01 01:00:00.000000000 +0100
+++ new/easypysmb-1.4.4/pyproject.toml 2020-08-06 12:33:43.000000000 +0200
@@ -0,0 +1,16 @@
+[tool.poetry]
+name = "easypysmb"
+version = "1.4.4"
+description = "Easy to use PySMB wrapper library"
+authors = ["Philipp Schmitt <[email protected]>"]
+license = "GPL-3.0-only"
+
+[tool.poetry.dependencies]
+python = "^3.8"
+pysmb = "^1.2.1"
+
+[tool.poetry.dev-dependencies]
+
+[build-system]
+requires = ["poetry>=0.12"]
+build-backend = "poetry.masonry.api"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/easypysmb-1.4.3/setup.py new/easypysmb-1.4.4/setup.py
--- old/easypysmb-1.4.3/setup.py 2017-07-25 15:51:16.000000000 +0200
+++ new/easypysmb-1.4.4/setup.py 2020-08-06 12:33:43.000000000 +0200
@@ -2,14 +2,14 @@
setup(
- name='easypysmb',
- version='1.4.3',
- license='GPL3',
- description='Easy to use PySMB wrapper library',
- long_description=open('README.rst').read(),
- author='Philipp Schmitt',
- author_email='[email protected]',
- url='https://github.com/pschmitt/easypysmb',
+ name="easypysmb",
+ version="1.4.4",
+ license="GPL3",
+ description="Easy to use PySMB wrapper library",
+ long_description=open("README.rst").read(),
+ author="Philipp Schmitt",
+ author_email="[email protected]",
+ url="https://github.com/pschmitt/easypysmb",
packages=find_packages(),
- install_requires=['pysmb'],
+ install_requires=["pysmb"],
)