Skip to content

Commit

Permalink
Merge pull request #64 from ploxiln/legacy_cleanup_2021_12
Browse files Browse the repository at this point in the history
cleanup some more legacy support bits
  • Loading branch information
ploxiln authored Dec 31, 2021
2 parents f8dd573 + 3bc6e21 commit 8cff965
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 41 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
- 3.9-bullseye
- 3.10-bullseye
paramiko_ver:
- 2.5.0
- 2.7.8
- 2.8.4
- 2.6.4
- 2.7.10
- 2.8.8
container: "python:${{matrix.imgtag}}"
steps:
- uses: actions/checkout@v2
Expand Down
16 changes: 2 additions & 14 deletions fabric/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,12 @@
import socket
import sys

import paramiko as ssh

from fabric.auth import get_password, set_password
from fabric.utils import handle_prompt_abort, warn
from fabric.exceptions import NetworkError

try:
import warnings
warnings.simplefilter('ignore', DeprecationWarning)
import paramiko as ssh
except ImportError:
import traceback
traceback.print_exc()
msg = """
There was a problem importing our SSH library (see traceback above).
Please make sure all dependencies are installed and importable.
""".rstrip()
sys.stderr.write(msg + '\n')
sys.exit(1)


ipv6_regex = re.compile(
r'^\[?(?P<host>[0-9A-Fa-f:]+(?:%[a-z]+\d+)?)\]?(:(?P<port>\d+))?$')
Expand Down
4 changes: 3 additions & 1 deletion fabric/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import sys
from optparse import make_option

from fabric.network import HostConnectionCache, ssh
import paramiko as ssh

from fabric.network import HostConnectionCache
from fabric.version import get_version
from fabric.utils import _AliasDict, _AttributeDict

Expand Down
25 changes: 2 additions & 23 deletions fabric/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,6 @@
from fabric.task_utils import crawl, merge, parse_kwargs
from fabric.exceptions import NetworkError

if sys.version_info[:2] == (2, 5):
# Python 2.5 inspect.getargspec returns a tuple
# instead of ArgSpec namedtuple.
class ArgSpec(object):
def __init__(self, args, varargs, keywords, defaults):
self.args = args
self.varargs = varargs
self.keywords = keywords
self.defaults = defaults
self._tuple = (args, varargs, keywords, defaults)

def __getitem__(self, idx):
return self._tuple[idx]

def patched_get_argspec(func):
return ArgSpec(*inspect._getargspec(func))

inspect._getargspec = inspect.getargspec
inspect.getargspec = patched_get_argspec


def get_task_details(task):
details = [
Expand All @@ -39,7 +19,7 @@ def get_task_details(task):
else 'No docstring provided']
argspec = inspect.getargspec(task)

default_args = [] if not argspec.defaults else argspec.defaults
default_args = argspec.defaults or ()
num_default_args = len(default_args)
args_without_defaults = argspec.args[:len(argspec.args) - num_default_args]
args_with_defaults = argspec.args[-1 * num_default_args:]
Expand Down Expand Up @@ -78,8 +58,7 @@ class Task(object):
is_default = False

# TODO: make it so that this wraps other decorators as expected
def __init__(self, alias=None, aliases=None, default=False, name=None,
*args, **kwargs):
def __init__(self, alias=None, aliases=None, default=False, name=None, *args, **kwargs):
if alias is not None:
self.aliases = [alias, ]
if aliases is not None:
Expand Down

0 comments on commit 8cff965

Please sign in to comment.