clapp-pm 1.0.10__py3-none-any.whl → 1.0.13__py3-none-any.whl
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.
- backup_current/build_index.py +132 -0
- backup_current/check_env.py +133 -0
- backup_current/clapp_core.py +61 -0
- backup_current/clean_command.py +214 -0
- backup_current/cli_commands.py +404 -0
- backup_current/dependency_resolver.py +272 -0
- backup_current/doctor_command.py +239 -0
- backup_current/info_command.py +194 -0
- backup_current/install_command.py +236 -0
- backup_current/installer.py +323 -0
- backup_current/list_command.py +262 -0
- backup_current/main.py +294 -0
- backup_current/manifest_schema.py +84 -0
- backup_current/manifest_validator.py +245 -0
- backup_current/package_registry.py +127 -0
- backup_current/package_runner.py +85 -0
- backup_current/post_install_hint.py +144 -0
- backup_current/publish_command.py +253 -0
- backup_current/remote_registry.py +285 -0
- backup_current/setup.py +160 -0
- backup_current/system_test.py +477 -0
- backup_current/uninstall_command.py +215 -0
- backup_current/validate_command.py +225 -0
- backup_current/version.py +8 -0
- backup_current/version_command.py +145 -0
- backup_current/where_command.py +207 -0
- check_env.py +1 -8
- clapp-packages-repo/packages/hello-python/main.py +0 -49
- clapp-packages-repo/packages/hello-python/manifest.json +0 -8
- {clapp_pm-1.0.10.data → clapp_pm-1.0.13.data}/data/version.json +1 -1
- {clapp_pm-1.0.10.dist-info → clapp_pm-1.0.13.dist-info}/METADATA +1 -1
- clapp_pm-1.0.13.dist-info/RECORD +71 -0
- {clapp_pm-1.0.10.dist-info → clapp_pm-1.0.13.dist-info}/top_level.txt +1 -0
- doctor_command.py +0 -1
- install_command.py +3 -0
- version.py +1 -1
- clapp_pm-1.0.10.dist-info/RECORD +0 -45
- {clapp_pm-1.0.10.dist-info → clapp_pm-1.0.13.dist-info}/WHEEL +0 -0
- {clapp_pm-1.0.10.dist-info → clapp_pm-1.0.13.dist-info}/entry_points.txt +0 -0
- {clapp_pm-1.0.10.dist-info → clapp_pm-1.0.13.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,132 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
build_index.py - clapp Index Builder Script
|
4
|
+
|
5
|
+
Bu script packages/ klasörünü tarayarak tüm uygulamaların metadata'sını
|
6
|
+
index.json dosyasına toplar. Publish işlemlerinden sonra otomatik çalışır.
|
7
|
+
"""
|
8
|
+
|
9
|
+
import os
|
10
|
+
import json
|
11
|
+
import sys
|
12
|
+
from pathlib import Path
|
13
|
+
from typing import List, Dict, Any
|
14
|
+
|
15
|
+
def load_manifest(app_path: str) -> Dict[str, Any]:
|
16
|
+
"""Uygulama klasöründen manifest.json yükler"""
|
17
|
+
manifest_path = os.path.join(app_path, "manifest.json")
|
18
|
+
|
19
|
+
if not os.path.exists(manifest_path):
|
20
|
+
raise FileNotFoundError(f"manifest.json bulunamadı: {manifest_path}")
|
21
|
+
|
22
|
+
try:
|
23
|
+
with open(manifest_path, 'r', encoding='utf-8') as f:
|
24
|
+
return json.load(f)
|
25
|
+
except json.JSONDecodeError as e:
|
26
|
+
raise ValueError(f"Geçersiz JSON formatı {manifest_path}: {e}")
|
27
|
+
|
28
|
+
def validate_manifest(manifest: Dict[str, Any], app_name: str) -> bool:
|
29
|
+
"""Manifest'in gerekli alanları içerip içermediğini kontrol eder"""
|
30
|
+
required_fields = ['name', 'version', 'language', 'description', 'entry']
|
31
|
+
|
32
|
+
for field in required_fields:
|
33
|
+
if field not in manifest:
|
34
|
+
print(f"⚠️ {app_name}: Eksik alan '{field}'")
|
35
|
+
return False
|
36
|
+
|
37
|
+
return True
|
38
|
+
|
39
|
+
def scan_packages_directory(packages_dir: str = "./packages") -> List[Dict[str, Any]]:
|
40
|
+
"""packages klasörünü tarayarak tüm uygulamaları bulur"""
|
41
|
+
apps = []
|
42
|
+
|
43
|
+
if not os.path.exists(packages_dir):
|
44
|
+
print(f"⚠️ packages klasörü bulunamadı: {packages_dir}")
|
45
|
+
return apps
|
46
|
+
|
47
|
+
for app_name in os.listdir(packages_dir):
|
48
|
+
app_path = os.path.join(packages_dir, app_name)
|
49
|
+
|
50
|
+
# Sadece klasörleri işle
|
51
|
+
if not os.path.isdir(app_path):
|
52
|
+
continue
|
53
|
+
|
54
|
+
# Gizli klasörleri atla
|
55
|
+
if app_name.startswith('.'):
|
56
|
+
continue
|
57
|
+
|
58
|
+
try:
|
59
|
+
manifest = load_manifest(app_path)
|
60
|
+
|
61
|
+
# Manifest'i doğrula
|
62
|
+
if not validate_manifest(manifest, app_name):
|
63
|
+
continue
|
64
|
+
|
65
|
+
# Index için gerekli alanları çıkar
|
66
|
+
app_info = {
|
67
|
+
'name': manifest['name'],
|
68
|
+
'version': manifest['version'],
|
69
|
+
'language': manifest['language'],
|
70
|
+
'description': manifest['description'],
|
71
|
+
'entry': manifest['entry'],
|
72
|
+
'dependencies': manifest.get('dependencies', []),
|
73
|
+
'folder': app_name,
|
74
|
+
'repo_url': f"https://github.com/mburakmmm/clapp-packages",
|
75
|
+
'subdir': app_name
|
76
|
+
}
|
77
|
+
|
78
|
+
apps.append(app_info)
|
79
|
+
print(f"✅ {app_name} (v{manifest['version']}) eklendi")
|
80
|
+
|
81
|
+
except Exception as e:
|
82
|
+
print(f"❌ {app_name}: {e}")
|
83
|
+
continue
|
84
|
+
|
85
|
+
return apps
|
86
|
+
|
87
|
+
def generate_index(output_file: str = "index.json") -> bool:
|
88
|
+
"""Index.json dosyasını oluşturur"""
|
89
|
+
try:
|
90
|
+
print("🔄 packages/ klasörü taranıyor...")
|
91
|
+
apps = scan_packages_directory()
|
92
|
+
|
93
|
+
if not apps:
|
94
|
+
print("⚠️ Hiç geçerli uygulama bulunamadı!")
|
95
|
+
return False
|
96
|
+
|
97
|
+
# Alfabetik sıralama
|
98
|
+
apps.sort(key=lambda x: x['name'].lower())
|
99
|
+
|
100
|
+
# Index.json'u yaz
|
101
|
+
with open(output_file, 'w', encoding='utf-8') as f:
|
102
|
+
json.dump(apps, f, indent=2, ensure_ascii=False)
|
103
|
+
|
104
|
+
print(f"✅ {output_file} başarıyla oluşturuldu ({len(apps)} uygulama)")
|
105
|
+
return True
|
106
|
+
|
107
|
+
except Exception as e:
|
108
|
+
print(f"❌ Index oluşturulurken hata: {e}")
|
109
|
+
return False
|
110
|
+
|
111
|
+
def main():
|
112
|
+
"""Ana fonksiyon"""
|
113
|
+
print("🚀 clapp Index Builder v1.0.0")
|
114
|
+
print("=" * 40)
|
115
|
+
|
116
|
+
# Komut satırı argümanları
|
117
|
+
output_file = "index.json"
|
118
|
+
if len(sys.argv) > 1:
|
119
|
+
output_file = sys.argv[1]
|
120
|
+
|
121
|
+
# Index oluştur
|
122
|
+
success = generate_index(output_file)
|
123
|
+
|
124
|
+
if success:
|
125
|
+
print("\n🎉 Index başarıyla güncellendi!")
|
126
|
+
sys.exit(0)
|
127
|
+
else:
|
128
|
+
print("\n💥 Index güncellenemedi!")
|
129
|
+
sys.exit(1)
|
130
|
+
|
131
|
+
if __name__ == "__main__":
|
132
|
+
main()
|
@@ -0,0 +1,133 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
check_env.py - Sistem ortam kontrolü modülü
|
4
|
+
|
5
|
+
Bu modül `clapp check-env` komutunu destekler ve kullanıcının
|
6
|
+
sisteminin clapp çalıştırmak için uygun olup olmadığını kontrol eder.
|
7
|
+
"""
|
8
|
+
|
9
|
+
import os
|
10
|
+
import sys
|
11
|
+
import shutil
|
12
|
+
import platform
|
13
|
+
import subprocess
|
14
|
+
from pathlib import Path
|
15
|
+
|
16
|
+
def check_python_version():
|
17
|
+
"""Python sürümünü kontrol eder (>= 3.8 gerekli)"""
|
18
|
+
version = sys.version_info
|
19
|
+
required_major, required_minor = 3, 8
|
20
|
+
|
21
|
+
if version.major >= required_major and version.minor >= required_minor:
|
22
|
+
return True, f"Python {version.major}.{version.minor}.{version.micro}"
|
23
|
+
else:
|
24
|
+
return False, f"Python {version.major}.{version.minor}.{version.micro} (>= {required_major}.{required_minor} gerekli)"
|
25
|
+
|
26
|
+
def check_clapp_in_path():
|
27
|
+
"""clapp komutunun PATH'te olup olmadığını kontrol eder"""
|
28
|
+
clapp_path = shutil.which("clapp")
|
29
|
+
if clapp_path:
|
30
|
+
return True, f"clapp komutu bulundu: {clapp_path}"
|
31
|
+
else:
|
32
|
+
return False, "clapp komutu PATH'te bulunamadı"
|
33
|
+
|
34
|
+
def check_platform_info():
|
35
|
+
"""Platform bilgilerini toplar"""
|
36
|
+
system = platform.system()
|
37
|
+
release = platform.release()
|
38
|
+
machine = platform.machine()
|
39
|
+
|
40
|
+
return True, f"{system} {release} ({machine})"
|
41
|
+
|
42
|
+
def check_python_executable():
|
43
|
+
"""Python çalıştırılabilir dosyasının konumunu kontrol eder"""
|
44
|
+
python_path = sys.executable
|
45
|
+
return True, f"Python çalıştırılabilir: {python_path}"
|
46
|
+
|
47
|
+
def check_working_directory():
|
48
|
+
"""Mevcut çalışma dizinini kontrol eder"""
|
49
|
+
cwd = os.getcwd()
|
50
|
+
return True, f"Çalışma dizini: {cwd}"
|
51
|
+
|
52
|
+
def check_apps_directory():
|
53
|
+
"""apps/ dizininin var olup olmadığını kontrol eder"""
|
54
|
+
apps_dir = Path("apps")
|
55
|
+
if apps_dir.exists() and apps_dir.is_dir():
|
56
|
+
app_count = len([d for d in apps_dir.iterdir() if d.is_dir()])
|
57
|
+
return True, f"apps/ dizini mevcut ({app_count} uygulama)"
|
58
|
+
else:
|
59
|
+
return False, "apps/ dizini bulunamadı"
|
60
|
+
|
61
|
+
def check_permissions():
|
62
|
+
"""Yazma izinlerini kontrol eder"""
|
63
|
+
try:
|
64
|
+
# Mevcut dizinde yazma izni kontrolü
|
65
|
+
test_file = Path("test_write_permission.tmp")
|
66
|
+
test_file.write_text("test")
|
67
|
+
test_file.unlink()
|
68
|
+
|
69
|
+
return True, "Yazma izinleri: OK"
|
70
|
+
except PermissionError:
|
71
|
+
return False, "Yazma izinleri: Yetersiz izin"
|
72
|
+
except Exception as e:
|
73
|
+
return False, f"Yazma izinleri: Hata - {str(e)}"
|
74
|
+
|
75
|
+
def check_flet_installation():
|
76
|
+
"""Flet kurulumunu kontrol eder"""
|
77
|
+
try:
|
78
|
+
import flet
|
79
|
+
return True, f"Flet kurulu: v{flet.__version__}"
|
80
|
+
except ImportError:
|
81
|
+
return False, "Flet kurulu değil (pip install flet)"
|
82
|
+
|
83
|
+
def run_environment_check():
|
84
|
+
"""Tüm ortam kontrollerini çalıştırır ve sonuçları yazdırır"""
|
85
|
+
print("🔍 clapp Ortam Kontrolü")
|
86
|
+
print("=" * 50)
|
87
|
+
|
88
|
+
checks = [
|
89
|
+
("Python Sürümü", check_python_version),
|
90
|
+
("Platform Bilgisi", check_platform_info),
|
91
|
+
("Python Çalıştırılabilir", check_python_executable),
|
92
|
+
("Çalışma Dizini", check_working_directory),
|
93
|
+
("clapp PATH Kontrolü", check_clapp_in_path),
|
94
|
+
("apps/ Dizini", check_apps_directory),
|
95
|
+
("Yazma İzinleri", check_permissions),
|
96
|
+
("Flet Kurulumu", check_flet_installation),
|
97
|
+
]
|
98
|
+
|
99
|
+
passed = 0
|
100
|
+
failed = 0
|
101
|
+
warnings = 0
|
102
|
+
|
103
|
+
for check_name, check_func in checks:
|
104
|
+
try:
|
105
|
+
success, message = check_func()
|
106
|
+
if success:
|
107
|
+
print(f"✅ {check_name}: {message}")
|
108
|
+
passed += 1
|
109
|
+
else:
|
110
|
+
print(f"❌ {check_name}: {message}")
|
111
|
+
failed += 1
|
112
|
+
except Exception as e:
|
113
|
+
print(f"⚠️ {check_name}: Hata - {str(e)}")
|
114
|
+
warnings += 1
|
115
|
+
|
116
|
+
print("\n" + "=" * 50)
|
117
|
+
print(f"📊 Özet: {passed} başarılı, {failed} başarısız, {warnings} uyarı")
|
118
|
+
|
119
|
+
if failed > 0:
|
120
|
+
print("\n🔧 Öneriler:")
|
121
|
+
if not shutil.which("clapp"):
|
122
|
+
print("• clapp'i PATH'e ekleyin veya pip install ile kurun")
|
123
|
+
if not Path("apps").exists():
|
124
|
+
print("• apps/ dizini oluşturun: mkdir apps")
|
125
|
+
|
126
|
+
print("• Daha fazla yardım için: clapp doctor")
|
127
|
+
|
128
|
+
print("\n✨ Sorun yaşıyorsanız 'clapp doctor' komutunu çalıştırın!")
|
129
|
+
|
130
|
+
return failed == 0
|
131
|
+
|
132
|
+
if __name__ == "__main__":
|
133
|
+
run_environment_check()
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import os
|
2
|
+
import json
|
3
|
+
import argparse
|
4
|
+
from package_registry import list_packages
|
5
|
+
from package_runner import run_app
|
6
|
+
|
7
|
+
def main():
|
8
|
+
"""
|
9
|
+
clapp CLI'sinin ana giriş noktası. Komut satırı argümanlarını işler ve uygun fonksiyonları çağırır.
|
10
|
+
"""
|
11
|
+
parser = argparse.ArgumentParser(
|
12
|
+
description='clapp - Basit paket yöneticisi',
|
13
|
+
prog='clapp'
|
14
|
+
)
|
15
|
+
|
16
|
+
subparsers = parser.add_subparsers(dest='command', help='Mevcut komutlar')
|
17
|
+
|
18
|
+
# run komutu
|
19
|
+
run_parser = subparsers.add_parser('run', help='Yüklü bir uygulamayı çalıştır')
|
20
|
+
run_parser.add_argument('app_name', help='Çalıştırılacak uygulamanın adı')
|
21
|
+
|
22
|
+
# list komutu
|
23
|
+
list_parser = subparsers.add_parser('list', help='Yüklü uygulamaları listele')
|
24
|
+
|
25
|
+
args = parser.parse_args()
|
26
|
+
|
27
|
+
if args.command == 'run':
|
28
|
+
success = run_app(args.app_name)
|
29
|
+
if not success:
|
30
|
+
exit(1)
|
31
|
+
|
32
|
+
elif args.command == 'list':
|
33
|
+
list_apps()
|
34
|
+
|
35
|
+
else:
|
36
|
+
parser.print_help()
|
37
|
+
|
38
|
+
def list_apps():
|
39
|
+
"""
|
40
|
+
Yüklü uygulamaları listeler ve konsola yazdırır.
|
41
|
+
"""
|
42
|
+
packages = list_packages()
|
43
|
+
|
44
|
+
if not packages:
|
45
|
+
print("Yüklü uygulama bulunamadı.")
|
46
|
+
print("Uygulamaları 'apps/' dizinine yerleştirin.")
|
47
|
+
return
|
48
|
+
|
49
|
+
print(f"Yüklü Uygulamalar ({len(packages)} adet):")
|
50
|
+
print("-" * 50)
|
51
|
+
|
52
|
+
for package in packages:
|
53
|
+
print(f"📦 {package['name']} (v{package['version']})")
|
54
|
+
print(f" Dil: {package['language']}")
|
55
|
+
print(f" Açıklama: {package['description']}")
|
56
|
+
if package['dependencies']:
|
57
|
+
print(f" Bağımlılıklar: {', '.join(package['dependencies'])}")
|
58
|
+
print()
|
59
|
+
|
60
|
+
if __name__ == '__main__':
|
61
|
+
main()
|
@@ -0,0 +1,214 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
clean_command.py - Geçici dosya temizleme modülü
|
4
|
+
|
5
|
+
Bu modül `clapp clean` komutunu destekler ve geçici dosyaları,
|
6
|
+
logları ve eski dosyaları temizler.
|
7
|
+
"""
|
8
|
+
|
9
|
+
import os
|
10
|
+
import shutil
|
11
|
+
import glob
|
12
|
+
from pathlib import Path
|
13
|
+
|
14
|
+
def format_size(size_bytes):
|
15
|
+
"""Dosya boyutunu formatlar"""
|
16
|
+
if size_bytes == 0:
|
17
|
+
return "0 B"
|
18
|
+
|
19
|
+
for unit in ['B', 'KB', 'MB', 'GB']:
|
20
|
+
if size_bytes < 1024.0:
|
21
|
+
return f"{size_bytes:.1f} {unit}"
|
22
|
+
size_bytes /= 1024.0
|
23
|
+
|
24
|
+
return f"{size_bytes:.1f} TB"
|
25
|
+
|
26
|
+
def clean_temp_files():
|
27
|
+
"""Geçici dosyaları temizler"""
|
28
|
+
temp_patterns = [
|
29
|
+
"*.tmp",
|
30
|
+
"*.temp",
|
31
|
+
"*.log",
|
32
|
+
"*.old",
|
33
|
+
"*.bak",
|
34
|
+
"*.backup",
|
35
|
+
"__pycache__",
|
36
|
+
"*.pyc",
|
37
|
+
"*.pyo",
|
38
|
+
".DS_Store",
|
39
|
+
"Thumbs.db",
|
40
|
+
"test_write_permission.tmp"
|
41
|
+
]
|
42
|
+
|
43
|
+
cleaned_files = []
|
44
|
+
total_size = 0
|
45
|
+
|
46
|
+
# Mevcut dizinde temizlik
|
47
|
+
for pattern in temp_patterns:
|
48
|
+
if pattern == "__pycache__":
|
49
|
+
# __pycache__ dizinlerini bul ve sil
|
50
|
+
for pycache_dir in Path(".").rglob("__pycache__"):
|
51
|
+
if pycache_dir.is_dir():
|
52
|
+
try:
|
53
|
+
dir_size = sum(f.stat().st_size for f in pycache_dir.rglob("*") if f.is_file())
|
54
|
+
shutil.rmtree(pycache_dir)
|
55
|
+
cleaned_files.append(str(pycache_dir))
|
56
|
+
total_size += dir_size
|
57
|
+
except Exception as e:
|
58
|
+
print(f"⚠️ {pycache_dir} silinemedi: {e}")
|
59
|
+
else:
|
60
|
+
# Dosya desenlerini bul ve sil
|
61
|
+
for file_path in Path(".").rglob(pattern):
|
62
|
+
if file_path.is_file():
|
63
|
+
try:
|
64
|
+
file_size = file_path.stat().st_size
|
65
|
+
file_path.unlink()
|
66
|
+
cleaned_files.append(str(file_path))
|
67
|
+
total_size += file_size
|
68
|
+
except Exception as e:
|
69
|
+
print(f"⚠️ {file_path} silinemedi: {e}")
|
70
|
+
|
71
|
+
return cleaned_files, total_size
|
72
|
+
|
73
|
+
def clean_apps_directory():
|
74
|
+
"""apps/ dizinindeki geçici dosyaları temizler"""
|
75
|
+
apps_dir = Path("apps")
|
76
|
+
if not apps_dir.exists():
|
77
|
+
return [], 0
|
78
|
+
|
79
|
+
cleaned_files = []
|
80
|
+
total_size = 0
|
81
|
+
|
82
|
+
# Her uygulama dizininde temizlik
|
83
|
+
for app_dir in apps_dir.iterdir():
|
84
|
+
if app_dir.is_dir():
|
85
|
+
# .zip dosyalarını temizle
|
86
|
+
for zip_file in app_dir.glob("*.zip"):
|
87
|
+
try:
|
88
|
+
file_size = zip_file.stat().st_size
|
89
|
+
zip_file.unlink()
|
90
|
+
cleaned_files.append(str(zip_file))
|
91
|
+
total_size += file_size
|
92
|
+
except Exception as e:
|
93
|
+
print(f"⚠️ {zip_file} silinemedi: {e}")
|
94
|
+
|
95
|
+
# .old dosyalarını temizle
|
96
|
+
for old_file in app_dir.glob("*.old"):
|
97
|
+
try:
|
98
|
+
file_size = old_file.stat().st_size
|
99
|
+
old_file.unlink()
|
100
|
+
cleaned_files.append(str(old_file))
|
101
|
+
total_size += file_size
|
102
|
+
except Exception as e:
|
103
|
+
print(f"⚠️ {old_file} silinemedi: {e}")
|
104
|
+
|
105
|
+
return cleaned_files, total_size
|
106
|
+
|
107
|
+
def clean_clapp_config():
|
108
|
+
"""~/.clapp dizinindeki geçici dosyaları temizler"""
|
109
|
+
home = Path.home()
|
110
|
+
clapp_dir = home / ".clapp"
|
111
|
+
|
112
|
+
if not clapp_dir.exists():
|
113
|
+
return [], 0
|
114
|
+
|
115
|
+
cleaned_files = []
|
116
|
+
total_size = 0
|
117
|
+
|
118
|
+
# temp dizini
|
119
|
+
temp_dir = clapp_dir / "temp"
|
120
|
+
if temp_dir.exists():
|
121
|
+
try:
|
122
|
+
dir_size = sum(f.stat().st_size for f in temp_dir.rglob("*") if f.is_file())
|
123
|
+
shutil.rmtree(temp_dir)
|
124
|
+
cleaned_files.append(str(temp_dir))
|
125
|
+
total_size += dir_size
|
126
|
+
except Exception as e:
|
127
|
+
print(f"⚠️ {temp_dir} silinemedi: {e}")
|
128
|
+
|
129
|
+
# logs dizini
|
130
|
+
logs_dir = clapp_dir / "logs"
|
131
|
+
if logs_dir.exists():
|
132
|
+
try:
|
133
|
+
# Sadece .log dosyalarını sil, dizini koru
|
134
|
+
for log_file in logs_dir.glob("*.log"):
|
135
|
+
file_size = log_file.stat().st_size
|
136
|
+
log_file.unlink()
|
137
|
+
cleaned_files.append(str(log_file))
|
138
|
+
total_size += file_size
|
139
|
+
except Exception as e:
|
140
|
+
print(f"⚠️ Log dosyaları silinemedi: {e}")
|
141
|
+
|
142
|
+
return cleaned_files, total_size
|
143
|
+
|
144
|
+
def run_clean(dry_run=False):
|
145
|
+
"""Temizleme işlemini çalıştırır"""
|
146
|
+
print("🧹 clapp Temizleme Aracı")
|
147
|
+
print("=" * 50)
|
148
|
+
|
149
|
+
if dry_run:
|
150
|
+
print("🔍 Kuru çalıştırma modu - Dosyalar silinmeyecek")
|
151
|
+
print()
|
152
|
+
|
153
|
+
total_cleaned = 0
|
154
|
+
total_size = 0
|
155
|
+
|
156
|
+
# 1. Geçici dosyaları temizle
|
157
|
+
print("🗑️ Geçici dosyalar temizleniyor...")
|
158
|
+
temp_files, temp_size = clean_temp_files()
|
159
|
+
if temp_files:
|
160
|
+
print(f" ✅ {len(temp_files)} geçici dosya temizlendi")
|
161
|
+
total_cleaned += len(temp_files)
|
162
|
+
total_size += temp_size
|
163
|
+
else:
|
164
|
+
print(" ✅ Geçici dosya bulunamadı")
|
165
|
+
|
166
|
+
# 2. apps/ dizinini temizle
|
167
|
+
print("📦 apps/ dizini temizleniyor...")
|
168
|
+
apps_files, apps_size = clean_apps_directory()
|
169
|
+
if apps_files:
|
170
|
+
print(f" ✅ {len(apps_files)} dosya temizlendi")
|
171
|
+
total_cleaned += len(apps_files)
|
172
|
+
total_size += apps_size
|
173
|
+
else:
|
174
|
+
print(" ✅ Temizlenecek dosya bulunamadı")
|
175
|
+
|
176
|
+
# 3. ~/.clapp dizinini temizle
|
177
|
+
print("🏠 ~/.clapp dizini temizleniyor...")
|
178
|
+
config_files, config_size = clean_clapp_config()
|
179
|
+
if config_files:
|
180
|
+
print(f" ✅ {len(config_files)} öğe temizlendi")
|
181
|
+
total_cleaned += len(config_files)
|
182
|
+
total_size += config_size
|
183
|
+
else:
|
184
|
+
print(" ✅ Temizlenecek dosya bulunamadı")
|
185
|
+
|
186
|
+
# Özet
|
187
|
+
print("\n" + "=" * 50)
|
188
|
+
print("📊 Temizleme Özeti:")
|
189
|
+
print(f"🗑️ Toplam temizlenen: {total_cleaned} öğe")
|
190
|
+
print(f"💾 Kazanılan alan: {format_size(total_size)}")
|
191
|
+
|
192
|
+
if total_cleaned > 0:
|
193
|
+
print("\n✨ Temizlik tamamlandı!")
|
194
|
+
|
195
|
+
# Detaylı liste (ilk 10 dosya)
|
196
|
+
all_files = temp_files + apps_files + config_files
|
197
|
+
if len(all_files) > 0:
|
198
|
+
print("\n📋 Temizlenen dosyalar:")
|
199
|
+
for i, file_path in enumerate(all_files[:10]):
|
200
|
+
print(f" • {file_path}")
|
201
|
+
|
202
|
+
if len(all_files) > 10:
|
203
|
+
print(f" ... ve {len(all_files) - 10} dosya daha")
|
204
|
+
else:
|
205
|
+
print("\n🎉 Sistem zaten temiz!")
|
206
|
+
print("Temizlenecek dosya bulunamadı.")
|
207
|
+
|
208
|
+
return total_cleaned > 0
|
209
|
+
|
210
|
+
if __name__ == "__main__":
|
211
|
+
import sys
|
212
|
+
|
213
|
+
dry_run = "--dry-run" in sys.argv
|
214
|
+
run_clean(dry_run)
|