diff --git a/openandroidinstaller/app_state.py b/openandroidinstaller/app_state.py index c1341526..f13d6288 100644 --- a/openandroidinstaller/app_state.py +++ b/openandroidinstaller/app_state.py @@ -1,4 +1,5 @@ """This file contains a class and function to manage the app state over various steps.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index 01ac57b0..f1fc90eb 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -1,4 +1,5 @@ """Class to load config files for the install procedure.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/openandroidinstaller.py b/openandroidinstaller/openandroidinstaller.py index 1708eab1..0a834d04 100644 --- a/openandroidinstaller/openandroidinstaller.py +++ b/openandroidinstaller/openandroidinstaller.py @@ -1,4 +1,5 @@ """Main file of the OpenAndroidInstaller.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/styles.py b/openandroidinstaller/styles.py index 9ac227d3..6b1a1816 100644 --- a/openandroidinstaller/styles.py +++ b/openandroidinstaller/styles.py @@ -1,4 +1,5 @@ """This module contains different pre-configured style elements for building the application.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index 0403264b..50e170b7 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -595,28 +595,23 @@ def search_device(platform: str, bin_path: Path) -> SearchResult: try: # read device code if platform in ("linux", "darwin"): - # check if grep is installed and find the right path - try: - grep_command = check_output(["which", "grep"]).decode().strip() - except CalledProcessError: - logger.error( - "Failed to detect a device. Please make sure `grep` is installed." - ) - return SearchResult( - msg="Failed to detect a device. Please make sure `grep` is installed." - ) # run the command to get the device code - output = check_output( - [ - str(bin_path.joinpath(Path("adb"))), - "shell", - "getprop", - "|", - grep_command, - "ro.product.device", - ], + command = [ + str(bin_path.joinpath(Path("adb"))), + "shell", + "getprop", + # "|", + # "grep", + # "ro.product.device", + ] + logger.info(f"Run command: {command}") + device_prop = check_output( + command, stderr=STDOUT, ).decode() + output = [ + line for line in device_prop.split("\n") if "ro.product.device" in line + ][0] elif platform in ("windows", "win32"): # run the command to get the device code on windows output = check_output( @@ -639,8 +634,8 @@ def search_device(platform: str, bin_path: Path) -> SearchResult: device_code=device_code, msg=f"Found device with device code '{device_code}'.", ) - except CalledProcessError: - logger.error("Failed to detect a device.") + except CalledProcessError as e: + logger.error(f"Failed to detect a device. {e}") return SearchResult( msg="Failed to detect a device. Connect to USB and try again." ) diff --git a/openandroidinstaller/views/addon_view.py b/openandroidinstaller/views/addon_view.py index 16e4427e..d9eaa78d 100644 --- a/openandroidinstaller/views/addon_view.py +++ b/openandroidinstaller/views/addon_view.py @@ -1,4 +1,5 @@ """Contains the select addons view.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/views/base.py b/openandroidinstaller/views/base.py index 20e2392f..34d68cf5 100644 --- a/openandroidinstaller/views/base.py +++ b/openandroidinstaller/views/base.py @@ -1,4 +1,5 @@ """Contains the base class for views.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/views/install_addons_view.py b/openandroidinstaller/views/install_addons_view.py index be26062d..bc11dc98 100644 --- a/openandroidinstaller/views/install_addons_view.py +++ b/openandroidinstaller/views/install_addons_view.py @@ -1,4 +1,5 @@ """Contains the install addons view.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/views/install_view.py b/openandroidinstaller/views/install_view.py index 7d8e444e..b01640ed 100644 --- a/openandroidinstaller/views/install_view.py +++ b/openandroidinstaller/views/install_view.py @@ -1,4 +1,5 @@ """Contains the install view.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/views/requirements_view.py b/openandroidinstaller/views/requirements_view.py index 92039a83..ccbd50cf 100644 --- a/openandroidinstaller/views/requirements_view.py +++ b/openandroidinstaller/views/requirements_view.py @@ -1,4 +1,5 @@ """Contains the requirements view.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index e4ab1ba2..9f76a3f7 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -1,4 +1,5 @@ """Contains the select files view.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/views/step_view.py b/openandroidinstaller/views/step_view.py index 99fae039..8780946d 100644 --- a/openandroidinstaller/views/step_view.py +++ b/openandroidinstaller/views/step_view.py @@ -1,4 +1,5 @@ """Contains the steps view.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/views/success_view.py b/openandroidinstaller/views/success_view.py index b9e20458..2a564846 100644 --- a/openandroidinstaller/views/success_view.py +++ b/openandroidinstaller/views/success_view.py @@ -1,4 +1,5 @@ """Contains the final success view.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/views/welcome_view.py b/openandroidinstaller/views/welcome_view.py index bba78cc6..505e791e 100644 --- a/openandroidinstaller/views/welcome_view.py +++ b/openandroidinstaller/views/welcome_view.py @@ -1,4 +1,5 @@ """Contains the welcome view.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/openandroidinstaller/widgets.py b/openandroidinstaller/widgets.py index 1d72d933..e9d779de 100644 --- a/openandroidinstaller/widgets.py +++ b/openandroidinstaller/widgets.py @@ -1,4 +1,5 @@ """Contains functions and classes to get different elements and widgets of the installer.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/scripts/build.py b/scripts/build.py index be410aab..4a65cda3 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -1,4 +1,5 @@ """Script to build the OpenAndroidInstaller executable on different platforms with pyinstaller.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/scripts/check-install.py b/scripts/check-install.py index 63c4eda2..bd30c3b0 100644 --- a/scripts/check-install.py +++ b/scripts/check-install.py @@ -1,4 +1,5 @@ """Check if adb works and print the version.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/scripts/download-tools.py b/scripts/download-tools.py index c8a4c230..5c2f4df4 100644 --- a/scripts/download-tools.py +++ b/scripts/download-tools.py @@ -2,6 +2,7 @@ Inspired by: https://gitlab.com/ubports/installer/android-tools-bin/-/blob/master/build.js """ + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/scripts/lineageos-on-galaxy-a3.py b/scripts/lineageos-on-galaxy-a3.py index 8839b8e5..2d2f461c 100644 --- a/scripts/lineageos-on-galaxy-a3.py +++ b/scripts/lineageos-on-galaxy-a3.py @@ -5,6 +5,7 @@ Example usage: poetry run python scripts/lineageos-on-galaxy-a3.py --recovery images/samsung-galaxy-a3/twrp-3.6.2_9-0-a3y17lte.img --image images/samsung-galaxy-a3/lineage-16.0-20190908-UNOFFICIAL-a3y17lte.zip """ + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/scripts/lineageos-on-pixel3a.py b/scripts/lineageos-on-pixel3a.py index 97b7d6fa..a5fdb613 100644 --- a/scripts/lineageos-on-pixel3a.py +++ b/scripts/lineageos-on-pixel3a.py @@ -3,6 +3,7 @@ Example usage: poetry run python scripts/lineageos-on-pixel3a.py --recovery images/google-pixel3a/lineage-19.1-20220830-recovery-sargo.img --image images/google-pixel3a/lineage-19.1-20220830-nightly-sargo-signed.zip """ + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/scripts/lineageos-on-sony-xperia-z.py b/scripts/lineageos-on-sony-xperia-z.py index 8478c1c3..29603a02 100644 --- a/scripts/lineageos-on-sony-xperia-z.py +++ b/scripts/lineageos-on-sony-xperia-z.py @@ -3,6 +3,7 @@ Example usage: poetry run python scripts/lineageos-on-sony-xperia-z.py --recovery images/sony-xperia-z/twrp-3.6.2_9-0-yuga.img --image images/sony-xperia-z/lineage-18.1-20220214-UNOFFICIAL-yuga.zip """ + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/scripts/utils.py b/scripts/utils.py index 51707274..e0950644 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -1,4 +1,5 @@ """Reusable functions for flashing.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/tests/test_app.py b/tests/test_app.py index 760e24c3..69754eb4 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -1,4 +1,5 @@ """Test if the main app starts up.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/tests/test_configs.py b/tests/test_configs.py index b7a09e05..a55b64d8 100644 --- a/tests/test_configs.py +++ b/tests/test_configs.py @@ -1,4 +1,5 @@ """Test existing config files for schema.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/tests/test_progress_bar.py b/tests/test_progress_bar.py index 793c60dd..21b58189 100644 --- a/tests/test_progress_bar.py +++ b/tests/test_progress_bar.py @@ -1,4 +1,5 @@ """Test the ProgressIndicator class.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, diff --git a/tests/test_terminal_box.py b/tests/test_terminal_box.py index fbb9a06a..ea9266ca 100644 --- a/tests/test_terminal_box.py +++ b/tests/test_terminal_box.py @@ -1,4 +1,5 @@ """Test the TerminalBox class.""" + # This file is part of OpenAndroidInstaller. # OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation,