Skip to content

Commit da8f6c2

Browse files
authored
Merge pull request #236 from FoamyGuy/wwshell_fixes
wwshell fixes
2 parents a03d504 + f028b18 commit da8f6c2

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

circup/backends.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ def install_file_http(self, source, location=None):
329329
file_name = source.split(os.path.sep)
330330
file_name = file_name[-2] if file_name[-1] == "" else file_name[-1]
331331

332-
print(f"inside install_file_http location: '{location}'")
333332
if location is None:
334333
target = self.device_location + "/" + self.LIB_DIR_PATH + file_name
335334
else:
@@ -338,10 +337,7 @@ def install_file_http(self, source, location=None):
338337
auth = HTTPBasicAuth("", self.password)
339338

340339
with open(source, "rb") as fp:
341-
print(f"upload file PUT URL: {target}")
342340
r = self.session.put(target, fp.read(), auth=auth, timeout=self.timeout)
343-
print(f"install_file_http response status: {r.status_code}")
344-
print(r.content)
345341
if r.status_code == 409:
346342
_writeable_error()
347343
r.raise_for_status()
@@ -584,7 +580,6 @@ def upload_file(self, target_file, location_to_paste):
584580
:param location_to_paste: Location on the microcontroller to paste it.
585581
:return:
586582
"""
587-
print(f"inside upload_file location_to_paste: '{location_to_paste}'")
588583
if os.path.isdir(target_file):
589584
create_directory_url = urljoin(
590585
self.device_location,
@@ -698,7 +693,6 @@ def file_exists(self, filepath):
698693
return True if the file exists, otherwise False.
699694
"""
700695
auth = HTTPBasicAuth("", self.password)
701-
print(f"URL: {self.get_file_path(filepath)}")
702696
resp = requests.get(
703697
self.get_file_path(filepath), auth=auth, timeout=self.timeout
704698
)
@@ -809,7 +803,6 @@ def list_dir(self, dirpath):
809803
headers={"Accept": "application/json"},
810804
timeout=self.timeout,
811805
) as r:
812-
print(r.content)
813806
return r.json()["files"]
814807

815808

circup/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def main( # pylint: disable=too-many-locals
9494
"""
9595
A tool to manage and update libraries on a CircuitPython device.
9696
"""
97-
# pylint: disable=too-many-arguments,too-many-branches,too-many-statements,too-many-locals
97+
# pylint: disable=too-many-arguments,too-many-branches,too-many-statements,too-many-locals, R0801
9898
ctx.ensure_object(dict)
9999
ctx.obj["TIMEOUT"] = timeout
100100

circup/wwshell/commands.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
help="Hostname or IP address of a device. Overrides automatic path detection.",
4545
default="circuitpython.local",
4646
)
47+
@click.option(
48+
"--port",
49+
help="HTTP port that the web workflow is listening on.",
50+
default=80,
51+
)
4752
@click.option(
4853
"--password",
4954
help="Password to use for authentication when --host is used."
@@ -65,24 +70,23 @@ def main( # pylint: disable=too-many-locals
6570
verbose,
6671
path,
6772
host,
73+
port,
6874
password,
6975
timeout,
7076
): # pragma: no cover
7177
"""
7278
A tool to manage files CircuitPython device over web workflow.
7379
"""
74-
# pylint: disable=too-many-arguments,too-many-branches,too-many-statements,too-many-locals
80+
# pylint: disable=too-many-arguments,too-many-branches,too-many-statements,too-many-locals, R0801
7581
ctx.ensure_object(dict)
7682
ctx.obj["TIMEOUT"] = timeout
7783

7884
if password is None:
7985
password = os.getenv("CIRCUP_WEBWORKFLOW_PASSWORD")
8086

81-
device_path = get_device_path(host, password, path)
87+
device_path = get_device_path(host, port, password, path)
8288

8389
using_webworkflow = "host" in ctx.params.keys() and ctx.params["host"] is not None
84-
print(f"host: {ctx.params['host']}")
85-
print(f"using webworkflow: {using_webworkflow}")
8690
if using_webworkflow:
8791
if host == "circuitpython.local":
8892
click.echo("Checking versions.json on circuitpython.local to find hostname")
@@ -94,7 +98,7 @@ def main( # pylint: disable=too-many-locals
9498
device_path = device_path.replace("circuitpython.local", host)
9599
try:
96100
ctx.obj["backend"] = WebBackend(
97-
host=host, password=password, logger=logger, timeout=timeout
101+
host=host, port=port, password=password, logger=logger, timeout=timeout
98102
)
99103
except ValueError as e:
100104
click.secho(e, fg="red")

0 commit comments

Comments
 (0)