Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tchavetdeuse committed Sep 1, 2022
1 parent b7b1cf6 commit 6f01830
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
v0.2.1
- CLI: Exclude unnecessary directories when sending code
- CLI: Bug fixes
v0.2.0
- CLI: Added choice picker for some options when no value was provided
- Documentation: Improved and finished a first version of the tutorial
Expand Down
12 changes: 7 additions & 5 deletions src/appollo/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,7 @@ def start(build_type, flutter, minimal_ios_version, app_version, build_number, n
if status in ["config", "succeeded"]:
console.print(Text.from_markup(f"Your build has succeeded"))
if status == "config":
console.print("You can access your Appollo-Remote by running the following command.")
console.print(code)
connect({build_instance['key']})
return
elif status in ["failed", "stopped"]:
console.print(Text.from_markup(f"Your build has failed, to access logs run : [code]appollo build logs {build_instance['key']}[/code]"))
Expand Down Expand Up @@ -394,7 +393,9 @@ def download(key, output="source.zip"):
if key is None:
return

console.print("Downloading modified sources...")
response = api.get(f"/builds/{key}/result/", json_decode=False)
console.print("The modified sources have been downloaded and are in source.zip")

if response:
with open(output, "wb") as f:
Expand Down Expand Up @@ -478,7 +479,7 @@ def connect(key, yes):
)
), title="Connexion settings and credentials", expand=False)
console.print(auth_info)
console.print("Most Remote Desktop applications link the Mac Command key to Windows key on your keyboard.")
console.print("Most Remote Desktop applications link the Mac Command key to the Windows key on your keyboard.")
open_info = Text.from_markup(
textwrap.dedent(
"""
Expand Down Expand Up @@ -554,10 +555,10 @@ def stop(key):
from appollo.helpers import terminal_menu

if key is None:
key = terminal_menu("/builds/", "Builds", name=build_name, api_params={"all": 1},
key = terminal_menu("/builds/", "Builds", name=build_name,
does_not_exist_msg=Text.from_markup(textwrap.dedent(
f"""
You have not run any builds yet.
You do not have any running builds.
"""
)))
if key is None:
Expand Down Expand Up @@ -605,6 +606,7 @@ def build_name(build_instance):
""" Based on a build instance returns a user friendly name for the build. """
from datetime import datetime

build_instance['start_time'] = build_instance['start_time'][:-3]+build_instance['start_time'][-2:] # Remove timezone ':' otherwise it can't parse
start_time = datetime.strptime(build_instance['start_time'], "%Y-%m-%dT%H:%M:%S.%f%z")
start_time_str = start_time.strftime('%Y-%m-%d %H:%M')
# TODO check if timezones are respected.
Expand Down
11 changes: 6 additions & 5 deletions src/appollo/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def zip_directory(directory_path):
""" Archives a directory in a zip file and returns his name."""
if os.path.exists(os.path.join(os.getcwd(), '.app.zip')):
os.remove(os.path.join(os.getcwd(), '.app.zip'))
return make_zip(os.path.join(os.getcwd(), '.app'), directory_path, ["build", ".dart_tool", ".pub-cache", ".pub", ".git"])
return make_zip(os.path.join(os.getcwd(), '.app'), directory_path, ["build", ".dart_tool", ".pub-cache", ".pub", ".git"], ["source.zip"])



Expand Down Expand Up @@ -81,7 +81,6 @@ def terminal_menu(api_route, prompt_text, api_params=None, key_fieldname="key",
choices=terminal_ready_list,
qmark="",
).ask()
print("menu_entry_index: "+str(menu_entry_index))
if menu_entry_index is None: # When ctrl-C, exit
exit()

Expand All @@ -91,7 +90,7 @@ def terminal_menu(api_route, prompt_text, api_params=None, key_fieldname="key",


### Copied from shutil to add directory exlusion
def _make_zipfile(base_name, base_dir, exclude_dir=None, verbose=0, dry_run=0, logger=None):
def _make_zipfile(base_name, base_dir, exclude_dir=None, exclude_files=None, verbose=0, dry_run=0, logger=None):
"""Create a zip file from all the files under 'base_dir'.
The output zip file will be named 'base_name' + ".zip". Returns the
Expand Down Expand Up @@ -129,6 +128,8 @@ def _make_zipfile(base_name, base_dir, exclude_dir=None, verbose=0, dry_run=0, l
if logger is not None:
logger.info("adding '%s'", path)
for name in filenames:
if exclude_files is not None and name in exclude_files:
continue
path = os.path.normpath(os.path.join(dirpath, name))
if os.path.isfile(path):
zf.write(path, path)
Expand All @@ -138,7 +139,7 @@ def _make_zipfile(base_name, base_dir, exclude_dir=None, verbose=0, dry_run=0, l
return zip_filename


def make_zip(base_name, root_dir=None, exclude_dir=None, base_dir=None, verbose=0,
def make_zip(base_name, root_dir=None, exclude_dir=None, exclude_files=None, base_dir=None, verbose=0,
dry_run=0, logger=None):
"""Create a zip archive file
Expand Down Expand Up @@ -166,7 +167,7 @@ def make_zip(base_name, root_dir=None, exclude_dir=None, base_dir=None, verbose=
kwargs = {'dry_run': dry_run, 'logger': logger}

try:
filename = _make_zipfile(base_name, base_dir, exclude_dir, **kwargs)
filename = _make_zipfile(base_name, base_dir, exclude_dir, exclude_files, **kwargs)
finally:
if root_dir is not None:
if logger is not None:
Expand Down

0 comments on commit 6f01830

Please sign in to comment.