Skip to content

Commit 7f40afb

Browse files
committed
Move licencse header around
1 parent d0d86e1 commit 7f40afb

4 files changed

Lines changed: 31 additions & 6 deletions

File tree

openandroidinstaller/tool_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ def heimdall_flash_recovery(bin_path: Path, recovery: str) -> bool:
260260
def search_device(platform: str, bin_path: Path) -> Optional[str]:
261261
"""Search for a connected device."""
262262
logger.info(f"Search devices on {platform} with {bin_path}...")
263+
# map some detected device codes to their real code.
264+
device_code_mapping = {
265+
"C6603": "yuga",
266+
}
263267
try:
264268
# read device properties
265269
if platform in ("linux", "darwin"):
@@ -291,7 +295,7 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]:
291295
raise Exception(f"Unknown platform {platform}.")
292296
device_code = output.split("[")[-1].strip()[:-1].strip()
293297
logger.info(device_code)
294-
return device_code
298+
return device_code_mapping.get(device_code, device_code)
295299
except CalledProcessError:
296300
logger.error("Failed to detect a device.")
297301
return None

openandroidinstaller/views.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,6 @@ def close_developer_options_dlg(self, e):
402402

403403
def search_devices(self, e):
404404
"""Search the device when the button is clicked."""
405-
# map some detected device codes to their real code.
406-
device_code_mapping = {
407-
"C6603": "yuga",
408-
}
409405
# search the device
410406
if self.state.test:
411407
# this only happens for testing
@@ -418,7 +414,6 @@ def search_devices(self, e):
418414
platform=self.state.platform, bin_path=self.state.bin_path
419415
)
420416
if device_code:
421-
device_code = device_code_mapping.get(device_code, device_code)
422417
self.device_name.value = device_code
423418
self.device_name.color = colors.BLACK
424419
else:

tests/conftest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# This file is part of OpenAndroidInstaller.
2+
# OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of
3+
# the GNU General Public License as published by the Free Software Foundation,
4+
# either version 3 of the License, or (at your option) any later version.
5+
6+
# OpenAndroidInstaller is distributed in the hope that it will be useful, but WITHOUT ANY
7+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
8+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
9+
10+
# You should have received a copy of the GNU General Public License along with OpenAndroidInstaller.
11+
# If not, see <https://www.gnu.org/licenses/>."""
12+
# Author: Tobias Sterbak
13+
114
import pytest
215
from pathlib import Path
316

tests/test_configs.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
"""Test existing config files for schema."""
22

3+
# This file is part of OpenAndroidInstaller.
4+
# OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of
5+
# the GNU General Public License as published by the Free Software Foundation,
6+
# either version 3 of the License, or (at your option) any later version.
7+
8+
# OpenAndroidInstaller is distributed in the hope that it will be useful, but WITHOUT ANY
9+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
10+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11+
12+
# You should have received a copy of the GNU General Public License along with OpenAndroidInstaller.
13+
# If not, see <https://www.gnu.org/licenses/>."""
14+
# Author: Tobias Sterbak
15+
316
from pathlib import Path
417

518
import pytest

0 commit comments

Comments
 (0)