karnel-termux 4.17.23 ā 4.17.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/karnel/RELEASE_COMMIT
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
da9b390f62c1b73f31fa5a00a458162589b09c38
|
|
@@ -7,12 +7,25 @@ import "@/utils/downloaded-python"
|
|
|
7
7
|
LOG_FILE="$KARNEL_CACHE/install_dev.log"
|
|
8
8
|
DOWNLOAD_URL="https://raw.githubusercontent.com/dedsec1121fk/DedSec/87d69293f4b89b8ab114fa644074629e86313182/Scripts/Network%20Tools/QR%20Code%20Generator.py"
|
|
9
9
|
|
|
10
|
+
_qrcode_dependencies() {
|
|
11
|
+
if ! command -v python3 &>/dev/null && ! pkg install python -y &>>"$LOG_FILE"; then
|
|
12
|
+
return 1
|
|
13
|
+
fi
|
|
14
|
+
if ! python3 -c 'import PIL' &>/dev/null && ! pkg install python-pillow -y &>>"$LOG_FILE"; then
|
|
15
|
+
return 1
|
|
16
|
+
fi
|
|
17
|
+
if ! python3 -c 'import qrcode' &>/dev/null && ! python3 -m pip install --no-deps qrcode &>>"$LOG_FILE"; then
|
|
18
|
+
return 1
|
|
19
|
+
fi
|
|
20
|
+
python3 -c 'import qrcode, PIL' &>/dev/null
|
|
21
|
+
}
|
|
22
|
+
|
|
10
23
|
install_qrcode() {
|
|
11
24
|
local TOOL_DIR="$KARNEL_DATA/utils/qrcode"
|
|
12
25
|
local BIN_NAME="qrcode"
|
|
13
26
|
log_info "Installing QR Code Generator..."
|
|
14
27
|
mkdir -p "$(dirname "$LOG_FILE")" "$TOOL_DIR"
|
|
15
|
-
|
|
28
|
+
_qrcode_dependencies || { log_error "Failed to install QR Code Generator dependencies"; return 1; }
|
|
16
29
|
_downloaded_python_install "$BIN_NAME" "$TOOL_DIR" "$DOWNLOAD_URL" || return $?
|
|
17
30
|
log_success "QR Code Generator installed"
|
|
18
31
|
return 0
|
|
@@ -31,6 +44,7 @@ update_qrcode() {
|
|
|
31
44
|
local TOOL_DIR="$KARNEL_DATA/utils/qrcode"
|
|
32
45
|
local BIN_NAME="qrcode"
|
|
33
46
|
log_info "Updating QR Code Generator..."
|
|
47
|
+
_qrcode_dependencies || { log_error "Failed to install QR Code Generator dependencies"; return 1; }
|
|
34
48
|
_downloaded_python_update "$BIN_NAME" "$TOOL_DIR" "$DOWNLOAD_URL" || return 1
|
|
35
49
|
log_success "QR Code Generator updated"
|
|
36
50
|
return 0
|
|
@@ -1,36 +1,14 @@
|
|
|
1
1
|
#!/data/data/com.termux/files/usr/bin/python3
|
|
2
2
|
import os
|
|
3
3
|
import re
|
|
4
|
-
import subprocess
|
|
5
4
|
import sys
|
|
6
5
|
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
The 'qrcode[pil]' installs both qrcode and Pillow (PIL) for image generation.
|
|
12
|
-
"""
|
|
13
|
-
try:
|
|
14
|
-
__import__(package)
|
|
15
|
-
print(f"ā
Required package '{package}' is already installed.")
|
|
16
|
-
except ImportError:
|
|
17
|
-
print(f"š¦ Package '{package}' not found. Installing now...")
|
|
18
|
-
try:
|
|
19
|
-
if package == 'qrcode':
|
|
20
|
-
# Install qrcode with pil dependency for image saving
|
|
21
|
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "qrcode[pil]"])
|
|
22
|
-
else:
|
|
23
|
-
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
|
|
24
|
-
|
|
25
|
-
__import__(package)
|
|
26
|
-
print(f"ā
Successfully installed '{package}'.")
|
|
27
|
-
except subprocess.CalledProcessError as e:
|
|
28
|
-
print(f"ā Failed to install '{package}'. Error: {e}")
|
|
29
|
-
print("Please ensure 'pip' is installed and working in Termux.")
|
|
30
|
-
sys.exit(1)
|
|
6
|
+
# The launcher is named qrcode.py, so remove its directory before importing
|
|
7
|
+
# the third-party qrcode package to avoid importing this file recursively.
|
|
8
|
+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
9
|
+
sys.path = [path for path in sys.path if path not in ("", SCRIPT_DIR)]
|
|
31
10
|
|
|
32
|
-
|
|
33
|
-
import qrcode
|
|
11
|
+
import qrcode
|
|
34
12
|
|
|
35
13
|
# ----------------------------------------------------------------------
|
|
36
14
|
# --- Main Generator Function (Updated Path) ---
|
|
@@ -87,4 +65,4 @@ def generate_qr_for_link():
|
|
|
87
65
|
print(f"\nā Error saving file: {e}")
|
|
88
66
|
|
|
89
67
|
if __name__ == "__main__":
|
|
90
|
-
generate_qr_for_link()
|
|
68
|
+
generate_qr_for_link()
|
package/package.json
CHANGED