Skip to content

Commit

Permalink
Replace pipes with shlex
Browse files Browse the repository at this point in the history
  • Loading branch information
zjn0505 committed Nov 26, 2024
1 parent 24857c0 commit 0aed113
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -8692,7 +8692,7 @@ You may be able to check it in terminal with "which emulator".</string>
<string>Screen Info|self_scripts/screen_info.py</string>
</dict>
<key>version</key>
<string>1.13.5</string>
<string>1.13.6</string>
<key>webaddress</key>
<string>https://github.com/zjn0505/adb-alfred</string>
</dict>
Expand Down
10 changes: 5 additions & 5 deletions show_install_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import sys
import re
import pipes
import shlex
from workflow import Workflow, ICON_INFO, ICON_NOTE, ICON_ERROR, ICON_WARNING
from toolchain import run_script
from workflow.background import is_running, run_in_background
Expand Down Expand Up @@ -62,7 +62,7 @@ def showApkInstallItems():

arg = wf.args[0].strip()

apkPath = pipes.quote(apkFileOrFolder)
apkPath = shlex.quote(apkFileOrFolder)
log.debug("Path {0}".format(apkPath))
apk = None
if not aapt_path:
Expand All @@ -72,7 +72,7 @@ def showApkInstallItems():
if not apksigner_path:
wf.add_item(title="apksigner not found", subtitle="Please config 'apksigner_path' in workflow settings for richer APK info", valid=False, icon=ICON_WARNING)
else:
cmd_dump_badging = "{0} dump badging {1} | grep 'package:\|application-label:\|dkVersion:\|uses-permission:\|application-debuggable\|testOnly='".format(aapt_path, apkPath)
cmd_dump_badging = r"{0} dump badging {1} | grep 'package:\|application-label:\|dkVersion:\|uses-permission:\|application-debuggable\|testOnly='".format(aapt_path, apkPath)
cmd_list_all = "{0} list -a {1} | grep 'sharedUserId'".format(aapt_path, apkPath)
result_dump = run_script(cmd_dump_badging)
is_system_app = False
Expand Down Expand Up @@ -138,7 +138,7 @@ def showApkInstallItems():
currentVersionCode = ""

if serial:
shell_cmd = "{0} -s {1} shell dumpsys package {2} | grep 'versionCode\|versionName' | awk '{{print $1}}'".format(adb_path, serial, apk["packName"])
shell_cmd = r"{0} -s {1} shell dumpsys package {2} | grep 'versionCode\|versionName' | awk '{{print $1}}'".format(adb_path, serial, apk["packName"])

try:
currentApkResult = run_script(shell_cmd)
Expand Down Expand Up @@ -197,7 +197,7 @@ def showApkInstallItems():

if deviceApi and "min" in apk and int(deviceApi) < apk["min"]:
wf.add_item(title="Incompatiable device", subtitle="current device api level is {1}, lower than apk minSdkVersion {0}, ".format(deviceApi, apk["min"]), icon=ICON_ERROR, valid=False)
if deviceApi and "max" in apk and int(deviceApi) > apk["maxs"]:
if deviceApi and "max" in apk and int(deviceApi) > apk["max"]:
wf.add_item(title="Incompatiable device", subtitle="current device api level is {1}, higher than apk maxSdkVersion {0}, ".format(deviceApi, apk["max"]), icon=ICON_ERROR, valid=False)


Expand Down

0 comments on commit 0aed113

Please sign in to comment.