summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian May <brian@linuxpenguins.xyz>2020-05-21 07:26:45 +1000
committerBrian May <brian@linuxpenguins.xyz>2020-05-21 08:12:26 +1000
commitb63e58f49440fe98b4f17427b1d455c5f229da2e (patch)
treee01865f25104f2a0294456d7906ca261749ad7f3
parent88ce5c0bca950729105a9814679c7acf92a76123 (diff)
Create github workflow
-rw-r--r--.github/workflows/pythonpackage.yml35
-rw-r--r--sshuttle/client.py6
-rw-r--r--sshuttle/server.py2
-rw-r--r--sshuttle/ssh.py1
4 files changed, 39 insertions, 5 deletions
diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml
new file mode 100644
index 0000000..5aca725
--- /dev/null
+++ b/.github/workflows/pythonpackage.yml
@@ -0,0 +1,35 @@
+# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
+
+name: Python package
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: [3.5, 3.6, 3.7, 3.8]
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install -r requirements-tests.txt
+ - name: Lint with flake8
+ run: |
+ flake8 sshuttle tests --count --show-source --statistics
+ - name: Test with pytest
+ run: |
+ PYTHONPATH=$PWD pytest
diff --git a/sshuttle/client.py b/sshuttle/client.py
index 1f930ae..eebc0d8 100644
--- a/sshuttle/client.py
+++ b/sshuttle/client.py
@@ -224,7 +224,7 @@ class FirewallClient:
# No env: Talking to `FirewallClient.start`, which has no i18n.
e = None
break
- except OSError as e:
+ except OSError:
pass
self.argv = argv
s1.close()
@@ -304,8 +304,8 @@ class FirewallClient:
raise Fatal('%r expected STARTED, got %r' % (self.argv, line))
def sethostip(self, hostname, ip):
- assert(not re.search(b'[^-\w\.]', hostname))
- assert(not re.search(b'[^0-9.]', ip))
+ assert(not re.search(rb'[^-\w\.]', hostname))
+ assert(not re.search(rb'[^0-9.]', ip))
self.pfile.write(b'HOST %s,%s\n' % (hostname, ip))
self.pfile.flush()
diff --git a/sshuttle/server.py b/sshuttle/server.py
index d353a5d..b6f6604 100644
--- a/sshuttle/server.py
+++ b/sshuttle/server.py
@@ -25,7 +25,7 @@ def _ipmatch(ipstr):
# FIXME: IPv4 only
if ipstr == 'default':
ipstr = '0.0.0.0/0'
- m = re.match('^(\d+(\.\d+(\.\d+(\.\d+)?)?)?)(?:/(\d+))?$', ipstr)
+ m = re.match(r'^(\d+(\.\d+(\.\d+(\.\d+)?)?)?)(?:/(\d+))?$', ipstr)
if m:
g = m.groups()
ips = g[0]
diff --git a/sshuttle/ssh.py b/sshuttle/ssh.py
index 72951f6..464e92c 100644
--- a/sshuttle/ssh.py
+++ b/sshuttle/ssh.py
@@ -114,7 +114,6 @@ def parse_hostport(rhostport):
host = parsed.hostname
port = parsed.port
-
if password is None or len(password) == 0:
password = None