MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / update_termux_usage_stats

Function update_termux_usage_stats

Scripts/Settings.py:1844–1891  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1842 os.path.dirname(ENGLISH_BASE_PATH),
1843 os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
1844 ])
1845
1846 seen = set()
1847 for candidate in candidates:
1848 real = os.path.realpath(os.path.expanduser(candidate))
1849 if real in seen:
1850 continue
1851 seen.add(real)
1852 if os.path.isdir(real):
1853 return real
1854 return ""
1855
1856
1857def _copy_local_project_for_backup(source, destination):
1858 """Copy local project state while excluding Git metadata and Python caches."""
1859 _remove_path_if_exists(destination)
1860 shutil.copytree(
1861 source,
1862 destination,
1863 symlinks=True,
1864 ignore=shutil.ignore_patterns(".git", "__pycache__", "*.pyc", ".pytest_cache", ".mypy_cache"),
1865 )
1866
1867
1868def _write_project_backup_report(bundle_root, report_lines):
1869 report_path = os.path.join(bundle_root, "Backup Report.txt")
1870 with open(report_path, "w", encoding="utf-8") as handle:
1871 handle.write(pipboy_text("DedSec ecosystem backup report", "Αναφορά αντιγράφου ασφαλείας οικοσυστήματος DedSec") + "\n")
1872 handle.write("=" * 56 + "\n")
1873 handle.write("\n".join(report_lines).rstrip() + "\n")
1874
1875def _build_project_save_archive(archive_path):
1876 """Create a recoverable multi-project backup and continue after item failures."""
1877 _remove_path_if_exists(PROJECT_SAVE_WORKDIR)
1878 os.makedirs(PROJECT_SAVE_WORKDIR, exist_ok=True)
1879
1880 bundle_root = os.path.join(PROJECT_SAVE_WORKDIR, PROJECT_SAVE_BUNDLE_DIRNAME)
1881 apks_dir = os.path.join(bundle_root, "APKs")
1882 repos_dir = os.path.join(bundle_root, "Repositories")
1883 os.makedirs(apks_dir, exist_ok=True)
1884 os.makedirs(repos_dir, exist_ok=True)
1885 report_lines = [pipboy_text("Created: ", "Δημιουργήθηκε: ") + time.strftime('%Y-%m-%d %H:%M:%S'), ""]
1886 failures = 0
1887
1888 report_lines.append(pipboy_text("APKs:", "APK αρχεία:"))
1889 for apk_source in PROJECT_SAVE_APK_SOURCES:
1890 target_path = os.path.join(apks_dir, apk_source["filename"])
1891 try:
1892 if apk_source["type"] == "direct":
1893 apk_url = apk_source["url"]
1894 else:

Callers 1

show_termux_usage_statsFunction · 0.70

Calls 4

load_termux_usage_statsFunction · 0.70
summarize_bash_historyFunction · 0.70
save_termux_usage_statsFunction · 0.70

Tested by

no test coverage detected