Skip to content

fix: Updating to fabric 3.2.2 (WIP) #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Require a newer fabric than our public API does, since it includes the now
# public test helpers. Bleh.
fabric>=2.1.3,<3
fabric>=3.2,<4
Sphinx>=1.4,<1.7
releases>=1.6,<2.0
alabaster==0.7.12
wheel==0.24
twine==1.11.0
invocations>=1.3.0,<2.0
pytest-relaxed==1.1.4
twine==5.1.1
invocations>=3.0,<4.0
pytest-relaxed==2.0.2
coverage==4.4.2
pytest-cov==2.4.0
mock==1.0.1
Expand Down
4 changes: 1 addition & 3 deletions patchwork/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import re

from invoke.vendor import six

from .util import set_runner


Expand Down Expand Up @@ -116,7 +114,7 @@ def append(c, runner, filename, text, partial=False, escape=True):
Whether to perform regex-oriented escaping on ``text``.
"""
# Normalize non-list input to be a list
if isinstance(text, six.string_types):
if isinstance(text, str):
text = [text]
for line in text:
regex = "^" + _escape_for_regex(line) + ("" if partial else "$")
Expand Down
6 changes: 2 additions & 4 deletions patchwork/transfers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
File transfer functionality above and beyond basic ``put``/``get``.
"""

from invoke.vendor import six


def rsync(
c,
Expand Down Expand Up @@ -79,7 +77,7 @@ def rsync(
(rsync's ``--rsh`` flag.)
"""
# Turn single-string exclude into a one-item list for consistency
if isinstance(exclude, six.string_types):
if isinstance(exclude, str):
exclude = [exclude]
# Create --exclude options from exclude list
exclude_opts = ' --exclude "{}"' * len(exclude)
Expand All @@ -97,7 +95,7 @@ def rsync(
# always-a-list, always-up-to-date-from-all-sources attribute to save us
# from having to do this sort of thing. (may want to wait for Paramiko auth
# overhaul tho!)
if isinstance(keys, six.string_types):
if isinstance(keys, str):
keys = [keys]
if keys:
key_string = "-i " + " -i ".join(keys)
Expand Down
25 changes: 14 additions & 11 deletions patchwork/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import textwrap

from functools import wraps
from inspect import getargspec, formatargspec
from inspect import signature, Parameter


# TODO: calling all functions as eg directory(c, '/foo/bar/') (with initial c)
Expand Down Expand Up @@ -126,18 +126,21 @@ def munge_docstring(f, inner):
# Terrible, awful hacks to ensure Sphinx autodoc sees the intended
# (modified) signature; leverages the fact that autodoc_docstring_signature
# is True by default.
args, varargs, keywords, defaults = getargspec(f)
sig = signature(f)
params = sig.parameters
# Nix positional version of runner arg, which is always 2nd
del args[1]
# Add new args to end in desired order
args.extend(["sudo", "runner_method", "runner"])
# Add default values (remembering that this tuple matches the _end_ of the
# signature...)
defaults = tuple(list(defaults or []) + [False, "run", None])
# Get signature first line for Sphinx autodoc_docstring_signature
sigtext = "{}{}".format(
f.__name__, formatargspec(args, varargs, keywords, defaults)
params = [p for i, p in enumerate(params.values()) if i != 1]
# Add new args to end in desired order with desired default values
params.extend(
[
Parameter("sudo", Parameter.POSITIONAL_OR_KEYWORD, default=False),
Parameter("runner_method", Parameter.POSITIONAL_OR_KEYWORD, default="run"),
Parameter("runner", Parameter.POSITIONAL_OR_KEYWORD, default=None),
]
)
sig = sig.replace(parameters=params)
# Get signature first line for Sphinx autodoc_docstring_signature
sigtext = "{}{}".format(f.__name__, str(sig))
docstring = textwrap.dedent(inner.__doc__ or "").strip()
# Construct :param: list
params = """:param bool sudo:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
author="Jeff Forcier",
author_email="jeff@bitprophet.org",
url="https://fabric-patchwork.readthedocs.io",
install_requires=["fabric>=2.0,<3.0"],
install_requires=["fabric>=3.0,<4.0"],
packages=find_packages(),
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down