webtools-cli 1.2.3__tar.gz → 1.2.4__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webtools-cli
3
- Version: 1.2.3
3
+ Version: 1.2.4
4
4
  Summary: Advanced Web Intelligence & Scraping Toolkit with CLI and Web UI
5
5
  Author: Abhinav Adarsh
6
6
  License-Expression: MIT
@@ -29,7 +29,6 @@ Requires-Dist: Pillow
29
29
  Requires-Dist: mtranslate
30
30
  Requires-Dist: colorama
31
31
  Requires-Dist: playwright
32
- Requires-Dist: mega.py
33
32
  Requires-Dist: pycryptodome
34
33
  Requires-Dist: tenacity>=8.2.3
35
34
  Requires-Dist: pyreadline3; platform_system == "Windows"
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "webtools-cli"
7
- version = "1.2.3"
7
+ version = "1.2.4"
8
8
  description = "Advanced Web Intelligence & Scraping Toolkit with CLI and Web UI"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -36,7 +36,6 @@ dependencies = [
36
36
  "mtranslate",
37
37
  "colorama",
38
38
  "playwright",
39
- "mega.py",
40
39
  "pycryptodome",
41
40
  "tenacity>=8.2.3",
42
41
  "pyreadline3; platform_system == 'Windows'",
@@ -7,47 +7,59 @@ if sys.stdout.encoding and sys.stdout.encoding.lower() != 'utf-8':
7
7
  sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
8
8
  except Exception: pass
9
9
 
10
- # --- AUTO-INSTALLER FOR MISSING DEPENDENCIES ---
10
+ # --- AUTO-INSTALLER FOR MISSING/BROKEN DEPENDENCIES ---
11
11
  def ensure_dependencies():
12
- """Checks and installs missing dependencies at runtime"""
13
- dependencies = {
14
- "mega": "mega.py",
15
- "Crypto": "pycryptodome",
16
- "tenacity": "tenacity>=8.2.3"
12
+ """Checks and performs a forced clean install of dependencies at runtime"""
13
+ # Dependencies that must be imported successfully
14
+ # Format: module_name -> (pip_package_name, min_version_prefix, forced_upgrade)
15
+ check_deps = {
16
+ "mega": ("mega.py", None, False),
17
+ "Crypto": ("pycryptodome", None, True), # Always ensure pycryptodome over pycrypto
18
+ "tenacity": ("tenacity>=8.2.3", "8", True)
17
19
  }
18
- missing = []
19
20
 
20
- # Check for missing or broken modules
21
- for module_name, package_name in dependencies.items():
21
+ missing_or_broken = []
22
+
23
+ # 1. Clean up "pycrypto" which causes SyntaxError on Python 3
24
+ # If we catch a SyntaxError from 'from mega import Mega', it's almost certainly pycrypto
25
+ try:
26
+ import Crypto.PublicKey.RSA
27
+ except (SyntaxError, AttributeError, ImportError):
28
+ # SyntaxError means it's the old pycrypto. We must kill it.
29
+ missing_or_broken.append("pycryptodome")
30
+
31
+ # 2. Check for missing or outdated modules
32
+ for module_name, (pkg_name, min_v, forced) in check_deps.items():
22
33
  try:
23
- # We use __import__ to check if the module is available and functional
24
- __import__(module_name)
25
-
26
- # Special check for tenacity version if it exists
27
- if module_name == "tenacity":
28
- from importlib.metadata import version as get_version
34
+ mod = __import__(module_name)
35
+ if min_v:
36
+ from importlib.metadata import version as get_v
29
37
  try:
30
- v = get_version("tenacity")
31
- major = int(v.split('.')[0])
32
- if major < 8:
33
- missing.append(package_name)
34
- except Exception:
35
- pass
36
- except Exception:
37
- # If import fails for ANY reason (ImportError, AttributeError, etc.)
38
- # we mark it as missing/broken so we can try to fix it.
39
- missing.append(package_name)
40
-
41
- if missing:
42
- print(f"\n[!] Missing or outdated dependencies detected: {', '.join(missing)}")
43
- print("[*] Attempting automatic installation/upgrade...")
38
+ if int(get_v(module_name).split('.')[0]) < int(min_v):
39
+ missing_or_broken.append(pkg_name)
40
+ except:
41
+ if forced: missing_or_broken.append(pkg_name)
42
+ except:
43
+ missing_or_broken.append(pkg_name)
44
+
45
+ if missing_or_broken:
46
+ print(f"\n[!] Critical dependency issues detected: {', '.join(missing_or_broken)}")
47
+ print("[*] Running Forced Clean Repair (Python 3.11+ Stability Patch)...")
44
48
  try:
45
- # Added --upgrade to ensure tenacity gets bumped if it's too old
46
- subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade"] + missing)
47
- print("[+] Dependencies updated successfully!\n")
49
+ # Step A: Uninstall known troublemakers
50
+ subprocess.call([sys.executable, "-m", "pip", "uninstall", "-y", "pycrypto", "tenacity"],
51
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
52
+
53
+ # Step B: Install modern core deps
54
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "pycryptodome", "tenacity>=8.2.3", "requests"])
55
+
56
+ # Step C: Install mega.py WITHOUT dependencies to avoid downgrading tenacity
57
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "mega.py", "--no-deps"])
58
+
59
+ print("[+] Environment repaired successfully! Please restart the app if it fails next.\n")
48
60
  except Exception as e:
49
- print(f"[-] Auto-installation failed: {e}")
50
- print(f"[!] Please run: pip install --upgrade {' '.join(missing)}")
61
+ print(f"[-] Auto-repair failed: {e}")
62
+ print("[!] Please run manually: pip uninstall pycrypto tenacity && pip install pycryptodome tenacity>=8.2.3 mega.py --no-deps")
51
63
 
52
64
  ensure_dependencies()
53
65
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webtools-cli
3
- Version: 1.2.3
3
+ Version: 1.2.4
4
4
  Summary: Advanced Web Intelligence & Scraping Toolkit with CLI and Web UI
5
5
  Author: Abhinav Adarsh
6
6
  License-Expression: MIT
@@ -29,7 +29,6 @@ Requires-Dist: Pillow
29
29
  Requires-Dist: mtranslate
30
30
  Requires-Dist: colorama
31
31
  Requires-Dist: playwright
32
- Requires-Dist: mega.py
33
32
  Requires-Dist: pycryptodome
34
33
  Requires-Dist: tenacity>=8.2.3
35
34
  Requires-Dist: pyreadline3; platform_system == "Windows"
@@ -9,7 +9,6 @@ Pillow
9
9
  mtranslate
10
10
  colorama
11
11
  playwright
12
- mega.py
13
12
  pycryptodome
14
13
  tenacity>=8.2.3
15
14
 
File without changes
File without changes
File without changes