clapp-pm 1.0.0__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.
- check_env.py +133 -0
- clapp-packages-repo/README.md +46 -0
- clapp-packages-repo/index.json +35 -0
- clapp-packages-repo/packages/hello-python/main.py +49 -0
- clapp-packages-repo/packages/hello-python/manifest.json +8 -0
- clapp-packages-repo/packages/test-app/main.py +1 -0
- clapp-packages-repo/packages/test-app/manifest.json +1 -0
- clapp-packages-repo/packages/test-app2/main.py +1 -0
- clapp-packages-repo/packages/test-app2/manifest.json +1 -0
- clapp-packages-repo/packages.json +40 -0
- clapp_core.py +61 -0
- clapp_pm-1.0.0.data/data/version.json +9 -0
- clapp_pm-1.0.0.dist-info/METADATA +117 -0
- clapp_pm-1.0.0.dist-info/RECORD +40 -0
- clapp_pm-1.0.0.dist-info/WHEEL +5 -0
- clapp_pm-1.0.0.dist-info/entry_points.txt +2 -0
- clapp_pm-1.0.0.dist-info/licenses/LICENSE +21 -0
- clapp_pm-1.0.0.dist-info/top_level.txt +20 -0
- clean_command.py +214 -0
- cli_commands.py +404 -0
- dependency_resolver.py +272 -0
- doctor_command.py +279 -0
- info_command.py +194 -0
- installer.py +320 -0
- main.py +294 -0
- manifest_schema.py +84 -0
- manifest_validator.py +245 -0
- package_registry.py +127 -0
- package_runner.py +85 -0
- packages/hello-python/main.py +49 -0
- packages/hello-python/manifest.json +8 -0
- packages/test-app/main.py +1 -0
- packages/test-app/manifest.json +1 -0
- packages/test-app2/main.py +1 -0
- packages/test-app2/manifest.json +1 -0
- post_install_hint.py +144 -0
- remote_registry.py +285 -0
- validate_command.py +225 -0
- version_command.py +145 -0
- where_command.py +207 -0
clean_command.py
ADDED
@@ -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)
|
cli_commands.py
ADDED
@@ -0,0 +1,404 @@
|
|
1
|
+
import os
|
2
|
+
import argparse
|
3
|
+
from remote_registry import get_package_info, list_remote_packages, search_packages
|
4
|
+
from installer import install_package, uninstall_package, create_package_from_directory
|
5
|
+
from package_registry import list_packages, get_manifest
|
6
|
+
from dependency_resolver import get_dependency_report, get_system_dependency_report
|
7
|
+
from manifest_validator import validate_manifest_file, get_validation_summary
|
8
|
+
|
9
|
+
# Yeni komut modüllerini import et
|
10
|
+
from publish_command import publish_app
|
11
|
+
from install_command import install_app
|
12
|
+
from uninstall_command import uninstall_app
|
13
|
+
from list_command import list_apps
|
14
|
+
|
15
|
+
def install_from_remote(app_name, force=False):
|
16
|
+
"""
|
17
|
+
Uzak paket deposundan uygulama yükler.
|
18
|
+
|
19
|
+
Args:
|
20
|
+
app_name (str): Yüklenecek uygulama adı
|
21
|
+
force (bool): Mevcut uygulamanın üzerine yazılmasına izin ver
|
22
|
+
|
23
|
+
Returns:
|
24
|
+
tuple: (success: bool, message: str)
|
25
|
+
"""
|
26
|
+
# Yeni install_command modülünü kullan
|
27
|
+
return install_app(app_name)
|
28
|
+
|
29
|
+
def install_from_remote_legacy(app_name, force=False):
|
30
|
+
"""
|
31
|
+
Uzak paket deposundan uygulama yükler (eski sistem).
|
32
|
+
|
33
|
+
Args:
|
34
|
+
app_name (str): Yüklenecek uygulama adı
|
35
|
+
force (bool): Mevcut uygulamanın üzerine yazılmasına izin ver
|
36
|
+
|
37
|
+
Returns:
|
38
|
+
tuple: (success: bool, message: str)
|
39
|
+
"""
|
40
|
+
print(f"'{app_name}' uzak paket deposunda aranıyor...")
|
41
|
+
|
42
|
+
# Uzak paket bilgilerini al
|
43
|
+
package_info = get_package_info(app_name)
|
44
|
+
|
45
|
+
if not package_info:
|
46
|
+
return False, f"'{app_name}' uzak paket deposunda bulunamadı"
|
47
|
+
|
48
|
+
# İndirme URL'sini al
|
49
|
+
download_url = package_info.get('download_url')
|
50
|
+
if not download_url:
|
51
|
+
return False, f"'{app_name}' için indirme URL'si bulunamadı"
|
52
|
+
|
53
|
+
print(f"📦 {app_name} v{package_info.get('version', '0.0.0')}")
|
54
|
+
print(f"📝 {package_info.get('description', 'Açıklama yok')}")
|
55
|
+
print(f"💻 Dil: {package_info.get('language', 'Bilinmiyor')}")
|
56
|
+
|
57
|
+
# Bağımlılıkları göster
|
58
|
+
dependencies = package_info.get('dependencies', [])
|
59
|
+
if dependencies:
|
60
|
+
print(f"🔗 Bağımlılıklar: {', '.join(dependencies)}")
|
61
|
+
|
62
|
+
print(f"⬇️ İndiriliyor: {download_url}")
|
63
|
+
|
64
|
+
# Paketi yükle
|
65
|
+
success, message = install_package(download_url, force)
|
66
|
+
|
67
|
+
if success:
|
68
|
+
print(f"✅ {message}")
|
69
|
+
|
70
|
+
# Bağımlılık kontrolü
|
71
|
+
print("\n🔍 Bağımlılıklar kontrol ediliyor...")
|
72
|
+
dep_report = get_dependency_report(app_name)
|
73
|
+
print(dep_report)
|
74
|
+
|
75
|
+
else:
|
76
|
+
print(f"❌ {message}")
|
77
|
+
|
78
|
+
return success, message
|
79
|
+
|
80
|
+
def uninstall_from_local(app_name, skip_confirmation=False):
|
81
|
+
"""
|
82
|
+
Yerel uygulamayı kaldırır.
|
83
|
+
|
84
|
+
Args:
|
85
|
+
app_name (str): Kaldırılacak uygulama adı
|
86
|
+
skip_confirmation (bool): Onay sorma
|
87
|
+
|
88
|
+
Returns:
|
89
|
+
tuple: (success: bool, message: str)
|
90
|
+
"""
|
91
|
+
# Yeni uninstall_command modülünü kullan
|
92
|
+
return uninstall_app(app_name, skip_confirmation)
|
93
|
+
|
94
|
+
def publish_to_repository(app_path):
|
95
|
+
"""
|
96
|
+
Uygulamayı repository'e publish eder.
|
97
|
+
|
98
|
+
Args:
|
99
|
+
app_path (str): Uygulama dizini
|
100
|
+
|
101
|
+
Returns:
|
102
|
+
tuple: (success: bool, message: str)
|
103
|
+
"""
|
104
|
+
# Yeni publish_command modülünü kullan
|
105
|
+
return publish_app(app_path)
|
106
|
+
|
107
|
+
def list_installed_apps(format_type="table", language_filter=None, search_term=None):
|
108
|
+
"""
|
109
|
+
Kurulu uygulamaları listeler.
|
110
|
+
|
111
|
+
Args:
|
112
|
+
format_type (str): Çıktı formatı (table, simple, json, detailed)
|
113
|
+
language_filter (str): Dil filtresi
|
114
|
+
search_term (str): Arama terimi
|
115
|
+
|
116
|
+
Returns:
|
117
|
+
tuple: (success: bool, message: str)
|
118
|
+
"""
|
119
|
+
try:
|
120
|
+
output = list_apps(format_type, language_filter, search_term)
|
121
|
+
print(output)
|
122
|
+
return True, "Liste gösterildi"
|
123
|
+
except Exception as e:
|
124
|
+
return False, f"Liste hatası: {e}"
|
125
|
+
|
126
|
+
def upgrade_package(app_name):
|
127
|
+
"""
|
128
|
+
Uygulamayı günceller.
|
129
|
+
|
130
|
+
Args:
|
131
|
+
app_name (str): Güncellenecek uygulama adı
|
132
|
+
|
133
|
+
Returns:
|
134
|
+
tuple: (success: bool, message: str)
|
135
|
+
"""
|
136
|
+
# Yerel sürümü kontrol et
|
137
|
+
local_manifest = get_manifest(app_name)
|
138
|
+
if not local_manifest:
|
139
|
+
return False, f"'{app_name}' yerel olarak yüklü değil"
|
140
|
+
|
141
|
+
local_version = local_manifest.get('version', '0.0.0')
|
142
|
+
|
143
|
+
# Uzak sürümü kontrol et
|
144
|
+
remote_package = get_package_info(app_name)
|
145
|
+
if not remote_package:
|
146
|
+
return False, f"'{app_name}' uzak paket deposunda bulunamadı"
|
147
|
+
|
148
|
+
remote_version = remote_package.get('version', '0.0.0')
|
149
|
+
|
150
|
+
print(f"📦 {app_name}")
|
151
|
+
print(f"📱 Yerel sürüm: {local_version}")
|
152
|
+
print(f"🌐 Uzak sürüm: {remote_version}")
|
153
|
+
|
154
|
+
# Sürüm karşılaştırması (basit string karşılaştırması)
|
155
|
+
if local_version == remote_version:
|
156
|
+
return True, f"'{app_name}' zaten güncel (v{local_version})"
|
157
|
+
|
158
|
+
print(f"🔄 Güncelleme mevcut: {local_version} → {remote_version}")
|
159
|
+
|
160
|
+
# Güncelleme için yeniden yükle
|
161
|
+
return install_from_remote(app_name, force=True)
|
162
|
+
|
163
|
+
def publish_package(app_path):
|
164
|
+
"""
|
165
|
+
Uygulama paketini yayınlamak için hazırlar.
|
166
|
+
|
167
|
+
Args:
|
168
|
+
app_path (str): Uygulama dizini
|
169
|
+
|
170
|
+
Returns:
|
171
|
+
tuple: (success: bool, message: str)
|
172
|
+
"""
|
173
|
+
if not os.path.exists(app_path):
|
174
|
+
return False, f"Dizin bulunamadı: {app_path}"
|
175
|
+
|
176
|
+
if not os.path.isdir(app_path):
|
177
|
+
return False, f"'{app_path}' bir dizin değil"
|
178
|
+
|
179
|
+
print(f"📁 Paket hazırlanıyor: {app_path}")
|
180
|
+
|
181
|
+
# Manifest doğrulama
|
182
|
+
manifest_path = os.path.join(app_path, "manifest.json")
|
183
|
+
is_valid, errors = validate_manifest_file(manifest_path)
|
184
|
+
|
185
|
+
print("🔍 Manifest doğrulanıyor...")
|
186
|
+
print(get_validation_summary(errors))
|
187
|
+
|
188
|
+
if not is_valid:
|
189
|
+
return False, "Manifest doğrulama başarısız"
|
190
|
+
|
191
|
+
# Paketi oluştur
|
192
|
+
success, message, output_file = create_package_from_directory(app_path)
|
193
|
+
|
194
|
+
if success:
|
195
|
+
print(f"✅ {message}")
|
196
|
+
print("\n📋 Yayınlama talimatları:")
|
197
|
+
print("1. Oluşturulan .clapp.zip dosyasını GitHub'a yükleyin")
|
198
|
+
print("2. packages.json dosyasını güncelleyin")
|
199
|
+
print("3. Pull request oluşturun")
|
200
|
+
print(f"\n📁 Paket dosyası: {output_file}")
|
201
|
+
|
202
|
+
else:
|
203
|
+
print(f"❌ {message}")
|
204
|
+
|
205
|
+
return success, message
|
206
|
+
|
207
|
+
def search_remote_packages(query):
|
208
|
+
"""
|
209
|
+
Uzak paket deposunda arama yapar.
|
210
|
+
|
211
|
+
Args:
|
212
|
+
query (str): Arama terimi
|
213
|
+
|
214
|
+
Returns:
|
215
|
+
tuple: (success: bool, message: str)
|
216
|
+
"""
|
217
|
+
print(f"🔍 Arama yapılıyor: '{query}'")
|
218
|
+
|
219
|
+
results = search_packages(query)
|
220
|
+
|
221
|
+
if not results:
|
222
|
+
return False, f"'{query}' için sonuç bulunamadı"
|
223
|
+
|
224
|
+
print(f"✅ {len(results)} sonuç bulundu:\n")
|
225
|
+
|
226
|
+
for package in results:
|
227
|
+
name = package.get('name', 'Bilinmiyor')
|
228
|
+
version = package.get('version', '0.0.0')
|
229
|
+
description = package.get('description', 'Açıklama yok')
|
230
|
+
language = package.get('language', 'Bilinmiyor')
|
231
|
+
|
232
|
+
print(f"📦 {name} (v{version})")
|
233
|
+
print(f" 💻 Dil: {language}")
|
234
|
+
print(f" 📝 {description}")
|
235
|
+
print()
|
236
|
+
|
237
|
+
return True, f"{len(results)} paket bulundu"
|
238
|
+
|
239
|
+
def show_package_info(app_name, remote=False):
|
240
|
+
"""
|
241
|
+
Paket bilgilerini gösterir.
|
242
|
+
|
243
|
+
Args:
|
244
|
+
app_name (str): Uygulama adı
|
245
|
+
remote (bool): Uzak paket deposundan bilgi al
|
246
|
+
|
247
|
+
Returns:
|
248
|
+
tuple: (success: bool, message: str)
|
249
|
+
"""
|
250
|
+
if remote:
|
251
|
+
# Uzak paket bilgisi
|
252
|
+
package = get_package_info(app_name)
|
253
|
+
if not package:
|
254
|
+
return False, f"'{app_name}' uzak paket deposunda bulunamadı"
|
255
|
+
|
256
|
+
print(f"🌐 Uzak Paket Bilgisi: {app_name}")
|
257
|
+
print("=" * 40)
|
258
|
+
|
259
|
+
else:
|
260
|
+
# Yerel paket bilgisi
|
261
|
+
package = get_manifest(app_name)
|
262
|
+
if not package:
|
263
|
+
return False, f"'{app_name}' yerel olarak yüklü değil"
|
264
|
+
|
265
|
+
print(f"📱 Yerel Paket Bilgisi: {app_name}")
|
266
|
+
print("=" * 40)
|
267
|
+
|
268
|
+
# Paket bilgilerini göster
|
269
|
+
print(f"📦 Ad: {package.get('name', 'Bilinmiyor')}")
|
270
|
+
print(f"🔢 Sürüm: {package.get('version', '0.0.0')}")
|
271
|
+
print(f"💻 Dil: {package.get('language', 'Bilinmiyor')}")
|
272
|
+
print(f"📝 Açıklama: {package.get('description', 'Açıklama yok')}")
|
273
|
+
print(f"🚀 Giriş: {package.get('entry', 'Bilinmiyor')}")
|
274
|
+
|
275
|
+
# Bağımlılıklar
|
276
|
+
dependencies = package.get('dependencies', [])
|
277
|
+
if dependencies:
|
278
|
+
print(f"🔗 Bağımlılıklar: {', '.join(dependencies)}")
|
279
|
+
else:
|
280
|
+
print("🔗 Bağımlılık yok")
|
281
|
+
|
282
|
+
# Uzak paket için ek bilgiler
|
283
|
+
if remote and 'download_url' in package:
|
284
|
+
print(f"⬇️ İndirme: {package['download_url']}")
|
285
|
+
|
286
|
+
# Yerel paket için bağımlılık raporu
|
287
|
+
if not remote:
|
288
|
+
print("\n" + get_dependency_report(app_name))
|
289
|
+
|
290
|
+
return True, "Bilgi gösterildi"
|
291
|
+
|
292
|
+
def list_all_packages():
|
293
|
+
"""
|
294
|
+
Hem yerel hem uzak paketleri listeler.
|
295
|
+
|
296
|
+
Returns:
|
297
|
+
tuple: (success: bool, message: str)
|
298
|
+
"""
|
299
|
+
print("📱 Yerel Paketler:")
|
300
|
+
print("=" * 30)
|
301
|
+
|
302
|
+
# Yerel paketler - yeni list_command kullan
|
303
|
+
success, message = list_installed_apps("simple")
|
304
|
+
|
305
|
+
print(f"\n🌐 Uzak Paketler:")
|
306
|
+
print("=" * 30)
|
307
|
+
|
308
|
+
# Uzak paketler
|
309
|
+
remote_list = list_remote_packages()
|
310
|
+
print(remote_list)
|
311
|
+
|
312
|
+
return True, "Paket listesi gösterildi"
|
313
|
+
|
314
|
+
def check_system_health():
|
315
|
+
"""
|
316
|
+
Sistem sağlığını kontrol eder.
|
317
|
+
|
318
|
+
Returns:
|
319
|
+
tuple: (success: bool, message: str)
|
320
|
+
"""
|
321
|
+
print("🏥 Sistem Sağlık Kontrolü")
|
322
|
+
print("=" * 40)
|
323
|
+
|
324
|
+
# Bağımlılık kontrolü
|
325
|
+
print("🔍 Bağımlılıklar kontrol ediliyor...")
|
326
|
+
dep_report = get_system_dependency_report()
|
327
|
+
print(dep_report)
|
328
|
+
|
329
|
+
# Uzak bağlantı kontrolü
|
330
|
+
print("🌐 Uzak bağlantı kontrol ediliyor...")
|
331
|
+
from remote_registry import check_remote_connectivity
|
332
|
+
|
333
|
+
if check_remote_connectivity():
|
334
|
+
print("✅ Uzak paket deposuna bağlantı başarılı")
|
335
|
+
else:
|
336
|
+
print("❌ Uzak paket deposuna bağlantı kurulamadı")
|
337
|
+
|
338
|
+
# Manifest doğrulama
|
339
|
+
print("\n🔍 Tüm manifest'ler doğrulanıyor...")
|
340
|
+
local_packages = list_packages()
|
341
|
+
invalid_count = 0
|
342
|
+
|
343
|
+
for package in local_packages:
|
344
|
+
app_name = package['name']
|
345
|
+
app_path = os.path.join("apps", app_name)
|
346
|
+
manifest_path = os.path.join(app_path, "manifest.json")
|
347
|
+
|
348
|
+
is_valid, errors = validate_manifest_file(manifest_path)
|
349
|
+
if not is_valid:
|
350
|
+
print(f"❌ {app_name}: Geçersiz manifest")
|
351
|
+
invalid_count += 1
|
352
|
+
|
353
|
+
if invalid_count == 0:
|
354
|
+
print("✅ Tüm manifest'ler geçerli")
|
355
|
+
else:
|
356
|
+
print(f"❌ {invalid_count} geçersiz manifest bulundu")
|
357
|
+
|
358
|
+
return True, "Sistem sağlık kontrolü tamamlandı"
|
359
|
+
|
360
|
+
# Yeni komut fonksiyonları
|
361
|
+
def handle_publish_command(args):
|
362
|
+
"""Publish komutunu işler"""
|
363
|
+
if not args.folder:
|
364
|
+
print("❌ Hata: Publish edilecek klasör belirtilmedi")
|
365
|
+
print("Kullanım: clapp publish <folder>")
|
366
|
+
return False, "Klasör belirtilmedi"
|
367
|
+
|
368
|
+
return publish_to_repository(args.folder)
|
369
|
+
|
370
|
+
def handle_install_command(args):
|
371
|
+
"""Install komutunu işler"""
|
372
|
+
if not args.app_name:
|
373
|
+
print("❌ Hata: Kurulacak uygulama adı belirtilmedi")
|
374
|
+
print("Kullanım: clapp install <app_name>")
|
375
|
+
return False, "Uygulama adı belirtilmedi"
|
376
|
+
|
377
|
+
return install_from_remote(args.app_name)
|
378
|
+
|
379
|
+
def handle_uninstall_command(args):
|
380
|
+
"""Uninstall komutunu işler"""
|
381
|
+
if not args.app_name:
|
382
|
+
print("❌ Hata: Kaldırılacak uygulama adı belirtilmedi")
|
383
|
+
print("Kullanım: clapp uninstall <app_name>")
|
384
|
+
return False, "Uygulama adı belirtilmedi"
|
385
|
+
|
386
|
+
return uninstall_from_local(args.app_name, args.yes)
|
387
|
+
|
388
|
+
def handle_list_command(args):
|
389
|
+
"""List komutunu işler"""
|
390
|
+
format_type = getattr(args, 'format', 'table')
|
391
|
+
language_filter = getattr(args, 'language', None)
|
392
|
+
search_term = getattr(args, 'search', None)
|
393
|
+
|
394
|
+
return list_installed_apps(format_type, language_filter, search_term)
|
395
|
+
|
396
|
+
if __name__ == "__main__":
|
397
|
+
# Test için örnek kullanım
|
398
|
+
print("CLI Commands Test")
|
399
|
+
print("=" * 30)
|
400
|
+
|
401
|
+
# Sistem sağlığını kontrol et
|
402
|
+
check_system_health()
|
403
|
+
|
404
|
+
print("\nTest tamamlandı.")
|