[packages/python-keyrings.alt] - new; added fs patch (try to port to pyfilesystem2)
qboosh
qboosh at pld-linux.org
Sun Apr 23 10:49:23 CEST 2017
commit 45b5085ee8872dd9590502352b7a7582c307f615
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sun Apr 23 10:49:32 2017 +0200
- new; added fs patch (try to port to pyfilesystem2)
python-keyrings.alt-fs.patch | 93 ++++++++++++++++++++++++++++
python-keyrings.alt.spec | 143 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 236 insertions(+)
---
diff --git a/python-keyrings.alt.spec b/python-keyrings.alt.spec
new file mode 100644
index 0000000..849527f
--- /dev/null
+++ b/python-keyrings.alt.spec
@@ -0,0 +1,143 @@
+#
+# Conditional build:
+%bcond_without doc # Sphinx documentation
+%bcond_without tests # py.test tests
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
+
+Summary: Alternate keyring backend implementations for use with the keyring module
+Summary(pl.UTF-8): Alternatywne implementacje backendów dla modułu keyring
+Name: python-keyrings.alt
+Version: 2.2
+Release: 1
+License: MIT
+Group: Libraries/Python
+#Source0Download: https://pypi.python.org/simple/keyrings.alt
+Source0: https://files.pythonhosted.org/packages/source/k/keyrings.alt/keyrings.alt-%{version}.tar.gz
+# Source0-md5: f7354b203095cf557fce94b4b818366b
+Patch0: %{name}-fs.patch
+URL: https://pypi.python.org/pypi/keyrings.alt
+%if %{with python2}
+BuildRequires: python-modules >= 1:2.7
+BuildRequires: python-setuptools >= 1:28.2
+BuildRequires: python-setuptools_scm >= 1.15.0
+%if %{with tests}
+BuildRequires: python-Crypto
+BuildRequires: python-backports.unittest_mock
+BuildRequires: python-fs >= 2.0
+BuildRequires: python-gdata
+BuildRequires: python-keyczar
+BuildRequires: python-keyring >= 10.3.1
+BuildRequires: python-pytest >= 2.8
+%endif
+%endif
+%if %{with python3}
+BuildRequires: python3-modules >= 1:3.3
+BuildRequires: python3-setuptools >= 1:28.2
+BuildRequires: python3-setuptools_scm >= 1.15.0
+%if %{with tests}
+BuildRequires: python3-Crypto
+BuildRequires: python3-fs >= 2.0
+BuildRequires: python3-keyring >= 10.3.1
+BuildRequires: python3-pytest >= 2.8
+%endif
+%endif
+%if %{with doc}
+BuildRequires: python3-Sphinx
+BuildRequires: python3-rst.linker
+%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+Requires: python-modules >= 1:2.7
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Alternate keyring backend implementations for use with the keyring
+module.
+
+%description -l pl.UTF-8
+Alternatywne implementacje backendów dla modułu keyring.
+
+%package -n python3-keyrings.alt
+Summary: Alternate keyring backend implementations for use with the keyring module
+Summary(pl.UTF-8): Alternatywne implementacje backendów dla modułu keyring
+Group: Libraries/Python
+Requires: python3-modules >= 1:3.3
+
+%description -n python3-keyrings.alt
+Alternate keyring backend implementations for use with the keyring
+module.
+
+%description -n python3-keyrings.alt -l pl.UTF-8
+Alternatywne implementacje backendów dla modułu keyring.
+
+%package apidocs
+Summary: API documentation for Python keyrings.alt library
+Summary(pl.UTF-8): Dokumentacja API biblioteki Pythona keyrings.alt
+Group: Documentation
+
+%description apidocs
+API documentation for Python keyrings.alt library.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API biblioteki Pythona keyrings.alt.
+
+%prep
+%setup -q -n keyrings.alt-%{version}
+%patch0 -p1
+
+%build
+%if %{with python2}
+%py_build
+
+%{?with_tests:PYTHONDIR=$(pwd) %{__python} -m pytest tests}
+%endif
+
+%if %{with python3}
+%py3_build %{?with_doc:build_sphinx}
+
+%{?with_tests:PYTHONDIR=$(pwd) %{__python3} -m pytest tests}
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python3}
+%py3_install
+%endif
+
+%if %{with python2}
+%py_install
+
+%py_postclean
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files
+%defattr(644,root,root,755)
+%doc CHANGES.rst LICENSE README.rst
+%dir %{py_sitescriptdir}/keyrings
+%{py_sitescriptdir}/keyrings/alt
+%{py_sitescriptdir}/keyrings.alt-%{version}-py*-nspkg.pth
+%{py_sitescriptdir}/keyrings.alt-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-keyrings.alt
+%defattr(644,root,root,755)
+%doc CHANGES.rst LICENSE README.rst
+%dir %{py3_sitescriptdir}/keyrings
+%{py3_sitescriptdir}/keyrings/alt
+%{py3_sitescriptdir}/keyrings.alt-%{version}-py*-nspkg.pth
+%{py3_sitescriptdir}/keyrings.alt-%{version}-py*.egg-info
+%endif
+
+%if %{with python3} && %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc build-3/sphinx/html/{_static,*.html,*.js}
+%endif
diff --git a/python-keyrings.alt-fs.patch b/python-keyrings.alt-fs.patch
new file mode 100644
index 0000000..85afaf7
--- /dev/null
+++ b/python-keyrings.alt-fs.patch
@@ -0,0 +1,93 @@
+--- keyrings.alt-2.2/keyrings/alt/pyfs.py.orig 2017-03-25 21:20:01.000000000 +0100
++++ keyrings.alt-2.2/keyrings/alt/pyfs.py 2017-04-23 10:35:42.342374226 +0200
+@@ -91,24 +91,33 @@
+ # so we add a dummy name and open it separately
+ if (self.filename.startswith('mem://') or
+ self.filename.startswith('ram://')):
+- open_file = fs.opener.fsopendir(self.filename).open('kr.cfg',
++ open_file = fs.opener.open_fs(self.filename).open(u'kr.cfg',
+ mode)
+ else:
+ if not hasattr(self, '_pyfs'):
+ # reuse the pyfilesystem and path
+- self._pyfs, self._path = fs.opener.opener.parse(self.filename,
+- writeable=writeable)
+- # cache if permitted
+- if self._cache_timeout is not None:
+- self._pyfs = fs.remote.CacheFS(
+- self._pyfs, cache_timeout=self._cache_timeout)
++ if '://' not in self.filename:
++ fspath, self._path = os.path.split(self.filename)
++ self._pyfs = fs.opener.open_fs(fspath,
++ writeable=writeable,
++ create=writeable and self._can_create)
++ elif self.filename.startswith('temp://'):
++ self._path = self.filename[7:]
++ self._pyfs = fs.opener.open_fs('temp://',
++ writeable=writeable,
++ create=writeable and self._can_create)
++ else:
++ self._pyfs, self._path = fs.opener.open(self.filename,
++ writeable=writeable,
++ create=writeable and self._can_create)
+ open_file = self._pyfs.open(self._path, mode)
+- except fs.errors.ResourceNotFoundError:
++ except fs.errors.ResourceNotFound:
+ if self._can_create:
+- segments = fs.opener.opener.split_segments(self.filename)
+- if segments:
++ try:
++ segments = fs.opener.parse(self.filename)
+ # this seems broken, but pyfilesystem uses it, so we must
+- fs_name, credentials, url1, url2, path = segments.groups()
++ fs_name = segments.protocol
++ url2 = segments.resource
+ assert fs_name, 'Should be a remote filesystem'
+ host = ''
+ # allow for domain:port
+@@ -119,18 +128,14 @@
+ else:
+ url2 = ''
+ host = split_url2[0]
+- pyfs = fs.opener.opener.opendir('%s://%s' %(fs_name, host))
+- # cache if permitted
+- if self._cache_timeout is not None:
+- pyfs = fs.remote.CacheFS(
+- pyfs, cache_timeout=self._cache_timeout)
++ pyfs = fs.opener.open_fs('%s://%s' %(fs_name, host))
+ # NOTE: fs.path.split does not function in the same way os os.path.split... at least under windows
+ url2_path, url2_filename = os.path.split(url2)
+ if url2_path and not pyfs.exists(url2_path):
+- pyfs.makedir(url2_path, recursive=True)
+- else:
++ pyfs.makedirs(url2_path)
++ except fs.opener.ParseError:
+ # assume local filesystem
+- full_url = fs.opener._expand_syspath(self.filename)
++ full_url = os.path.realpath(self.filename)
+ # NOTE: fs.path.split does not function in the same way os os.path.split... at least under windows
+ url2_path, url2 = os.path.split(full_url)
+ pyfs = fs.osfs.OSFS(url2_path)
+@@ -140,7 +145,7 @@
+ self._pyfs = pyfs
+ self._path = url2
+ return pyfs.open(url2, mode)
+- except fs.errors.ResourceNotFoundError:
++ except fs.errors.ResourceNotFound:
+ if writeable:
+ raise
+ else:
+--- keyrings.alt-2.2/tests/test_pyfs.py.orig 2017-03-25 21:20:01.000000000 +0100
++++ keyrings.alt-2.2/tests/test_pyfs.py 2017-04-23 08:57:03.112441813 +0200
+@@ -72,8 +72,9 @@
+ filename=self.keyring_filename)
+
+ def test_handles_preexisting_keyring(self):
+- from fs.opener import opener
+- fs, path = opener.parse(self.keyring_filename, writeable=True)
++ import fs.opener
++ fspath, path = os.path.split(self.keyring_filename)
++ fs = fs.opener.open_fs(fspath, writeable=True)
+ keyring_file = fs.open(path, 'w')
+ file_data = textwrap.dedent("""
+ [svc1]
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-keyrings.alt.git/commitdiff/45b5085ee8872dd9590502352b7a7582c307f615
More information about the pld-cvs-commit
mailing list