[packages/python-pyu2f] - new

qboosh qboosh at pld-linux.org
Sun May 20 10:55:31 CEST 2018


commit 5606cf0357fba1b85964e57b5cbf6f8d969a7fba
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun May 20 10:56:14 2018 +0200

    - new

 python-pyu2f-deps.patch |  11 ++++
 python-pyu2f-mock.patch | 151 ++++++++++++++++++++++++++++++++++++++++++++++++
 python-pyu2f.spec       | 121 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 283 insertions(+)
---
diff --git a/python-pyu2f.spec b/python-pyu2f.spec
new file mode 100644
index 0000000..fd4a6f7
--- /dev/null
+++ b/python-pyu2f.spec
@@ -0,0 +1,121 @@
+#
+# Conditional build:
+%bcond_without	tests	# unit tests
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
+
+Summary:	U2F host library for interacting with a U2F device over USB
+Summary(pl.UTF-8):	Biblioteka hosta U2F do współpracy z urządzeniami U2F po USB
+Name:		python-pyu2f
+Version:	0.1.4
+Release:	1
+License:	Apache v2.0
+Group:		Libraries/Python
+#Source0Download: https://github.com/google/pyu2f/releases
+Source0:	https://github.com/google/pyu2f/archive/%{version}/pyu2f-%{version}.tar.gz
+# Source0-md5:	5b10b5a1619466504b31f81b3945519c
+Patch0:		%{name}-deps.patch
+Patch1:		%{name}-mock.patch
+URL:		https://github.com/google/pyu2f
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+%if %{with python2}
+BuildRequires:	python-modules >= 1:2.7
+BuildRequires:	python-setuptools
+%if %{with tests}
+BuildRequires:	python-mock >= 1.0.1
+BuildRequires:	python-pyfakefs >= 2.4
+BuildRequires:	python-pytest
+BuildRequires:	python-six
+%endif
+%endif
+%if %{with python3}
+BuildRequires:	python3-modules >= 1:3.6
+BuildRequires:	python3-setuptools
+%if %{with tests}
+BuildRequires:	python3-pyfakefs >= 2.4
+BuildRequires:	python3-pytest
+BuildRequires:	python3-six
+%endif
+%endif
+Requires:	python-modules
+Requires:	python-six
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+pyu2f is a Python based U2F host library for Linux, Windows, and
+MacOS. It provides functionality for interacting with a U2F device
+over USB.
+
+%description -l pl.UTF-8
+pyu2f to pythonowa biblioteka hosta U2F dla Linuksa, Windows i
+MacOS-a. Zapewnia funkcjonalność potrzebną do współpracy z
+urządzeniami U2F po USB.
+
+%package -n python3-pyu2f
+Summary:	U2F host library for interacting with a U2F device over USB
+Summary(pl.UTF-8):	Biblioteka hosta U2F do współpracy z urządzeniami U2F po USB
+Group:		Libraries/Python
+Requires:	python3-modules
+Requires:	python3-six
+
+%description -n python3-pyu2f
+pyu2f is a Python based U2F host library for Linux, Windows, and
+MacOS. It provides functionality for interacting with a U2F device
+over USB.
+
+%description -n python3-pyu2f -l pl.UTF-8
+pyu2f to pythonowa biblioteka hosta U2F dla Linuksa, Windows i
+MacOS-a. Zapewnia funkcjonalność potrzebną do współpracy z
+urządzeniami U2F po USB.
+
+%prep
+%setup -q -n pyu2f-%{version}
+%patch0 -p1
+%patch1 -p1
+
+%build
+%if %{with python2}
+%py_build
+
+%{?with_tests:py.test-2 pyu2f/tests}
+%endif
+
+%if %{with python3}
+%py3_build
+
+%{?with_tests:py.test-3 pyu2f/tests}
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%py_install
+
+%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files
+%defattr(644,root,root,755)
+%doc README.md
+%{py_sitescriptdir}/pyu2f
+%{py_sitescriptdir}/pyu2f-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-pyu2f
+%defattr(644,root,root,755)
+%doc README.md
+%{py3_sitescriptdir}/pyu2f
+%{py3_sitescriptdir}/pyu2f-%{version}-py*.egg-info
+%endif
diff --git a/python-pyu2f-deps.patch b/python-pyu2f-deps.patch
new file mode 100644
index 0000000..9eddc62
--- /dev/null
+++ b/python-pyu2f-deps.patch
@@ -0,0 +1,11 @@
+Python 2.7+ already contains unittest2 as unittest.
+--- pyu2f-0.1.4/setup.py.orig	2018-04-27 05:35:42.000000000 +0200
++++ pyu2f-0.1.4/setup.py	2018-05-20 08:27:49.984071709 +0200
+@@ -40,7 +40,6 @@
+         'six',
+     ],
+     tests_require=[
+-        'unittest2>=0.5.1',
+         'pyfakefs>=2.4',
+         'mock>=1.0.1',
+     ],
diff --git a/python-pyu2f-mock.patch b/python-pyu2f-mock.patch
new file mode 100644
index 0000000..b56a724
--- /dev/null
+++ b/python-pyu2f-mock.patch
@@ -0,0 +1,151 @@
+--- pyu2f-0.1.4/pyu2f/tests/customauthenticator_test.py.orig	2018-04-27 05:35:42.000000000 +0200
++++ pyu2f-0.1.4/pyu2f/tests/customauthenticator_test.py	2018-05-20 10:39:46.960647979 +0200
+@@ -19,7 +19,6 @@
+ import struct
+ import sys
+ 
+-import mock
+ from pyu2f import errors
+ from pyu2f import model
+ from pyu2f.convenience import customauthenticator
+@@ -29,6 +28,10 @@
+   import unittest2 as unittest  # pylint: disable=g-import-not-at-top
+ else:
+   import unittest  # pylint: disable=g-import-not-at-top
++try:
++  import mock
++except:
++  from unittest import mock
+ 
+ 
+ # Input/ouput values recorded from a successful signing flow
+--- pyu2f-0.1.4/pyu2f/tests/hardware_test.py.orig	2018-04-27 05:35:42.000000000 +0200
++++ pyu2f-0.1.4/pyu2f/tests/hardware_test.py	2018-05-20 10:40:18.273980865 +0200
+@@ -16,8 +16,6 @@
+ 
+ import sys
+ 
+-import mock
+-
+ from pyu2f import errors
+ from pyu2f import hardware
+ 
+@@ -25,6 +23,10 @@
+   import unittest2 as unittest  # pylint: disable=g-import-not-at-top
+ else:
+   import unittest  # pylint: disable=g-import-not-at-top
++try:
++  import mock
++except:
++  from unittest import mock
+ 
+ 
+ class HardwareTest(unittest.TestCase):
+--- pyu2f-0.1.4/pyu2f/tests/hidtransport_test.py.orig	2018-04-27 05:35:42.000000000 +0200
++++ pyu2f-0.1.4/pyu2f/tests/hidtransport_test.py	2018-05-20 10:40:46.907313957 +0200
+@@ -17,8 +17,6 @@
+ from six.moves import range
+ import sys
+ 
+-import mock
+-
+ from pyu2f import errors
+ from pyu2f import hidtransport
+ from pyu2f.tests.lib import util
+@@ -27,6 +25,10 @@
+   import unittest2 as unittest  # pylint: disable=g-import-not-at-top
+ else:
+   import unittest  # pylint: disable=g-import-not-at-top
++try:
++  import mock
++except:
++  from unittest import mock
+ 
+ 
+ def MakeKeyboard(path, usage):
+--- pyu2f-0.1.4/pyu2f/tests/localauthenticator_test.py.orig	2018-04-27 05:35:42.000000000 +0200
++++ pyu2f-0.1.4/pyu2f/tests/localauthenticator_test.py	2018-05-20 10:41:30.623980178 +0200
+@@ -17,7 +17,6 @@
+ import base64
+ import sys
+ 
+-import mock
+ from pyu2f import errors
+ from pyu2f import model
+ from pyu2f.convenience import localauthenticator
+@@ -27,6 +26,10 @@
+   import unittest2 as unittest  # pylint: disable=g-import-not-at-top
+ else:
+   import unittest  # pylint: disable=g-import-not-at-top
++try:
++  import mock
++except:
++  from unittest import mock
+ 
+ 
+ # Input/ouput values recorded from a successful signing flow
+--- pyu2f-0.1.4/pyu2f/tests/u2f_test.py.orig	2018-04-27 05:35:42.000000000 +0200
++++ pyu2f-0.1.4/pyu2f/tests/u2f_test.py	2018-05-20 10:41:58.807313141 +0200
+@@ -16,8 +16,6 @@
+ 
+ import sys
+ 
+-import mock
+-
+ from pyu2f import errors
+ from pyu2f import model
+ from pyu2f import u2f
+@@ -26,6 +24,10 @@
+   import unittest2 as unittest  # pylint: disable=g-import-not-at-top
+ else:
+   import unittest  # pylint: disable=g-import-not-at-top
++try:
++  import mock
++except:
++  from unittest import mock
+ 
+ 
+ class U2fTest(unittest.TestCase):
+--- pyu2f-0.1.4/pyu2f/tests/hid/linux_test.py.orig	2018-04-27 05:35:42.000000000 +0200
++++ pyu2f-0.1.4/pyu2f/tests/hid/linux_test.py	2018-05-20 10:42:24.517312813 +0200
+@@ -18,8 +18,6 @@
+ import os
+ import sys
+ 
+-import mock
+-
+ from pyu2f.hid import linux
+ 
+ # Since the builtins name changed between Python 2 and Python 3, we have to
+@@ -38,6 +36,10 @@
+   import unittest2 as unittest  # pylint: disable=g-import-not-at-top
+ else:
+   import unittest  # pylint: disable=g-import-not-at-top
++try:
++  import mock
++except:
++  from unittest import mock
+ 
+ 
+ # These are base64 encoded report descriptors of a Yubico token
+--- pyu2f-0.1.4/pyu2f/tests/hid/macos_test.py.orig	2018-04-27 05:35:42.000000000 +0200
++++ pyu2f-0.1.4/pyu2f/tests/hid/macos_test.py	2018-05-20 10:43:08.303979016 +0200
+@@ -16,7 +16,6 @@
+ 
+ import ctypes
+ import sys
+-import mock
+ 
+ from pyu2f import errors
+ from pyu2f.hid import macos
+@@ -26,6 +25,10 @@
+   import unittest2 as unittest  # pylint: disable=g-import-not-at-top
+ else:
+   import unittest  # pylint: disable=g-import-not-at-top
++try:
++  import mock
++except:
++  from unittest import mock
+ 
+ 
+ def init_mock_iokit(mock_iokit):
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-pyu2f.git/commitdiff/5606cf0357fba1b85964e57b5cbf6f8d969a7fba



More information about the pld-cvs-commit mailing list