From 4bbc54a3f078c40c2a8b490d7b9cb4b29fba5767 Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Jun 10 2021 01:09:50 +0000 Subject: Initial import (#1967774) --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..327018d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/fabric-2.6.0.tar.gz diff --git a/python-fabric-Finish-wrapping-invoke.vendor.-imports-so-standalone.patch b/python-fabric-Finish-wrapping-invoke.vendor.-imports-so-standalone.patch new file mode 100644 index 0000000..7687a14 --- /dev/null +++ b/python-fabric-Finish-wrapping-invoke.vendor.-imports-so-standalone.patch @@ -0,0 +1,89 @@ +From ced931db84ca5a1d3833c6c6fc9f8c11815e462a Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Fri, 4 Jun 2021 12:46:06 -0400 +Subject: [PATCH 3/3] Finish wrapping invoke.vendor.* imports so standalone + packages can be used + +--- + integration/concurrency.py | 8 ++++++-- + tests/_util.py | 5 ++++- + tests/config.py | 5 ++++- + tests/connection.py | 3 ++- + 4 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/integration/concurrency.py b/integration/concurrency.py +index 99c80092..990f9e87 100644 +--- a/integration/concurrency.py ++++ b/integration/concurrency.py +@@ -1,7 +1,11 @@ + import codecs + +-from invoke.vendor.six.moves.queue import Queue +-from invoke.vendor.six.moves import zip_longest ++try: ++ from invoke.vendor.six.moves.queue import Queue ++ from invoke.vendor.six.moves import zip_longest ++except ImportError: ++ from six.moves.queue import Queue ++ from six.moves import zip_longest + + from invoke.util import ExceptionHandlingThread + from pytest import skip +diff --git a/tests/_util.py b/tests/_util.py +index 3a008745..1ffbc849 100644 +--- a/tests/_util.py ++++ b/tests/_util.py +@@ -3,7 +3,10 @@ import os + import re + import sys + +-from invoke.vendor.lexicon import Lexicon ++try: ++ from invoke.vendor.lexicon import Lexicon ++except ImportError: ++ from lexicon import Lexicon + from pytest_relaxed import trap + + from fabric.main import make_program +diff --git a/tests/config.py b/tests/config.py +index 4173f7a2..abbbb4b5 100644 +--- a/tests/config.py ++++ b/tests/config.py +@@ -2,7 +2,10 @@ import errno + from os.path import join, expanduser + + from paramiko.config import SSHConfig +-from invoke.vendor.lexicon import Lexicon ++try: ++ from invoke.vendor.lexicon import Lexicon ++except ImportError: ++ from lexicon import Lexicon + + from fabric import Config + from fabric.util import get_local_user +diff --git a/tests/connection.py b/tests/connection.py +index f41958d3..5ae2671b 100644 +--- a/tests/connection.py ++++ b/tests/connection.py +@@ -2,8 +2,10 @@ from itertools import chain, repeat + + try: + from invoke.vendor.six import b ++ from invoke.vendor.lexicon import Lexicon + except ImportError: + from six import b ++ from lexicon import Lexicon + import errno + from os.path import join + import socket +@@ -15,7 +17,6 @@ from paramiko import SSHConfig + import pytest # for mark + from pytest import skip, param + from pytest_relaxed import raises +-from invoke.vendor.lexicon import Lexicon + + from invoke.config import Config as InvokeConfig + from invoke.exceptions import ThreadException +-- +2.31.1 + diff --git a/python-fabric-Put-conditional-unittest.mock-imports-last-to-placat.patch b/python-fabric-Put-conditional-unittest.mock-imports-last-to-placat.patch new file mode 100644 index 0000000..9e75e6f --- /dev/null +++ b/python-fabric-Put-conditional-unittest.mock-imports-last-to-placat.patch @@ -0,0 +1,35 @@ +From a28e7f759e6f4101a7acf72e7c5b1abbaf946ce7 Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Thu, 3 Jun 2021 22:09:34 -0400 +Subject: [PATCH 2/3] Put conditional unittest.mock imports last to placate + flake8 + +--- + tests/util.py | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/tests/util.py b/tests/util.py +index 580c2615..39dc6de4 100644 +--- a/tests/util.py ++++ b/tests/util.py +@@ -2,10 +2,15 @@ + Tests testing the fabric.util module, not utils for the tests! + """ + +-from mock import patch +- + from fabric.util import get_local_user + ++from sys import version_info ++ ++if version_info >= (3, 6): ++ from unittest.mock import patch ++else: ++ from mock import patch ++ + + # Basically implementation tests, because it's not feasible to do a "real" test + # on random platforms (where we have no idea what the actual invoking user is) +-- +2.31.1 + diff --git a/python-fabric-Use-standard-library-unittest.mock-on-Python-3.6-and.patch b/python-fabric-Use-standard-library-unittest.mock-on-Python-3.6-and.patch new file mode 100644 index 0000000..51e05f3 --- /dev/null +++ b/python-fabric-Use-standard-library-unittest.mock-on-Python-3.6-and.patch @@ -0,0 +1,30 @@ +From ff0ab88e88e950bbec9facbc8453238f14e84dcd Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Thu, 3 Jun 2021 19:28:59 -0400 +Subject: [PATCH 1/3] Use standard library unittest.mock on Python 3.6 and + later + +--- + setup.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index a8126b5a..7ae2e27b 100644 +--- a/setup.py ++++ b/setup.py +@@ -67,7 +67,11 @@ setuptools.setup( + author="Jeff Forcier", + author_email="jeff@bitprophet.org", + url="http://fabfile.org", +- install_requires=["invoke>=1.3,<2.0", "paramiko>=2.4", "pathlib2"], ++ install_requires=[ ++ "invoke>=1.3,<2.0", ++ "paramiko>=2.4", ++ 'pathlib2; python_version < "3.4"', ++ ], + extras_require={ + "testing": testing_deps, + "pytest": testing_deps + pytest_deps, +-- +2.31.1 + diff --git a/python-fabric.spec b/python-fabric.spec new file mode 100644 index 0000000..e45cd4a --- /dev/null +++ b/python-fabric.spec @@ -0,0 +1,134 @@ +%global srcname fabric +%global forgeurl https://github.com/fabric/%{srcname} +%global tag %{version} +Version: 2.6.0 +%global distprefix %{nil} +%forgemeta + + +# Tests are disabled by default. 😞 +# Enable if https://bugzilla.redhat.com/show_bug.cgi?id=1949502 / +# https://github.com/bitprophet/pytest-relaxed/issues/12 is resolved: +%bcond_with tests + +Name: python-%{srcname} +Release: 1%{?dist} +Summary: High level SSH command execution +License: BSD +URL: %forgeurl +Source0: %forgesource +# Use built-in unittest.mock in python 3. +# https://github.com/fabric/fabric/pull/2168 +Patch0: python-fabric-Use-standard-library-unittest.mock-on-Python-3.6-and.patch +# Use built-in pathlib in python 3. +# https://github.com/fabric/fabric/pull/2167 +Patch1: python-fabric-Put-conditional-unittest.mock-imports-last-to-placat.patch +# Fall back to system modules if vendorized ones do not exist. +# https://github.com/fabric/fabric/pull/2169 +Patch2: python-fabric-Finish-wrapping-invoke.vendor.-imports-so-standalone.patch + +BuildArch: noarch + +BuildRequires: python3-devel +BuildRequires: python3-setuptools + +# Runtime dependencies, needed for testing +BuildRequires: python3-invoke +BuildRequires: python3-paramiko +# Runtime dependencies upstream assumed would be vendored with invoke, but +# which we must use standalone +BuildRequires: python3-decorator +BuildRequires: python3-lexicon +BuildRequires: python3-six + + +%if %{with tests} +# Extra pytest (a superset of extra testing) +BuildRequires: python3-pytest +# Missing from setup.py (only in requirements-dev.txt), but still needed for +# testing: +BuildRequires: python3-pytest-relaxed +%endif + +BuildRequires: help2man + +%global _description %{expand: +Fabric is a high level Python (2.7, 3.4+) library designed to execute shell +commands remotely over SSH, yielding useful Python objects in return. It builds +on top of Invoke (subprocess command execution and command-line features) and +Paramiko (SSH protocol implementation), extending their APIs to complement one +another and provide additional functionality.} + +%description %{_description} + + +%package -n python3-%{srcname} +Summary: %{summary} +# Runtime dependencies upstream assumed would be vendored with invoke, but +# which we must use standalone +Requires: python3-decorator +Requires: python3-lexicon +Requires: python3-six + +%description -n python3-%{srcname} %{_description} + +%package -n python-%{srcname}-doc +Summary: Documentation for %{name} + +BuildRequires: python3-sphinx +BuildRequires: python3-sphinx_rtd_theme + +%description -n python-%{srcname}-doc +Documentation for %{srcname}. + + +%prep +%autosetup -p1 -n %{srcname}-%{version} + + +%build +%py3_build + +PYTHONPATH=${PWD} sphinx-build-3 sites/docs html +rm -rf html/.{doctrees,buildinfo} + +# Entry point script that allows us to use help2man before installing +cat > fab <<'EOF' +#!%{__python3} +from fabric.main import program +program.run() +EOF +chmod +x fab +PYTHONPATH="${PWD}" help2man --no-info --output fab.1 ./fab + + +%install +%py3_install + +install -d %{buildroot}%{_mandir}/man1 +install -t %{buildroot}%{_mandir}/man1 -m 0644 -p fab.1 + + +%check +%if %{with tests} +%pytest +%endif + + +%files -n python3-%{srcname} +%license LICENSE +%doc README.rst +%{_bindir}/fab +%{_mandir}/man1/fab.1* +%{python3_sitelib}/%{srcname} +%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info + + +%files -n python-%{srcname}-doc +%doc html +%license LICENSE + + +%changelog +* Tue Jun 01 2021 Major Hayden - 2.6.0-1 +- First package. diff --git a/sources b/sources new file mode 100644 index 0000000..1cef402 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (fabric-2.6.0.tar.gz) = 22c430bff6c4d93fec5231999949cb1959c11ec06754e62a88776a9d62db1b30788214dd0b873252559fdf41441389585170c0b53a4d7af7fe4f5a36dc85fb4d