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
package_registry.py
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
import os
|
2
|
+
import json
|
3
|
+
from manifest_schema import validate_manifest
|
4
|
+
|
5
|
+
def list_packages():
|
6
|
+
"""
|
7
|
+
Yüklü paketlerin listesini döndürür.
|
8
|
+
|
9
|
+
Returns:
|
10
|
+
list: Yüklü paketlerin listesi (dict formatında)
|
11
|
+
"""
|
12
|
+
packages = []
|
13
|
+
apps_dir = "apps"
|
14
|
+
|
15
|
+
# apps dizini yoksa oluştur
|
16
|
+
if not os.path.exists(apps_dir):
|
17
|
+
os.makedirs(apps_dir)
|
18
|
+
return packages
|
19
|
+
|
20
|
+
# apps dizinindeki her klasörü kontrol et
|
21
|
+
for app_name in os.listdir(apps_dir):
|
22
|
+
app_path = os.path.join(apps_dir, app_name)
|
23
|
+
|
24
|
+
# Sadece dizinleri kontrol et
|
25
|
+
if os.path.isdir(app_path):
|
26
|
+
manifest_path = os.path.join(app_path, "manifest.json")
|
27
|
+
|
28
|
+
# Manifest dosyası varsa
|
29
|
+
if os.path.exists(manifest_path):
|
30
|
+
try:
|
31
|
+
with open(manifest_path, 'r', encoding='utf-8') as f:
|
32
|
+
manifest = json.load(f)
|
33
|
+
|
34
|
+
# Manifest geçerliyse listeye ekle
|
35
|
+
if validate_manifest(manifest):
|
36
|
+
packages.append({
|
37
|
+
'name': manifest['name'],
|
38
|
+
'version': manifest.get('version', '0.0.0'),
|
39
|
+
'language': manifest.get('language', 'unknown'),
|
40
|
+
'description': manifest.get('description', 'Açıklama yok'),
|
41
|
+
'entry': manifest.get('entry', 'main.py'),
|
42
|
+
'dependencies': manifest.get('dependencies', [])
|
43
|
+
})
|
44
|
+
except (json.JSONDecodeError, KeyError):
|
45
|
+
# Geçersiz manifest dosyası, atla
|
46
|
+
continue
|
47
|
+
|
48
|
+
return packages
|
49
|
+
|
50
|
+
def get_manifest(app_name):
|
51
|
+
"""
|
52
|
+
Belirtilen uygulamanın manifest bilgilerini döndürür.
|
53
|
+
|
54
|
+
Args:
|
55
|
+
app_name (str): Uygulama adı
|
56
|
+
|
57
|
+
Returns:
|
58
|
+
dict or None: Manifest bilgileri veya None (bulunamazsa)
|
59
|
+
"""
|
60
|
+
app_path = os.path.join("apps", app_name)
|
61
|
+
manifest_path = os.path.join(app_path, "manifest.json")
|
62
|
+
|
63
|
+
if not os.path.exists(manifest_path):
|
64
|
+
return None
|
65
|
+
|
66
|
+
try:
|
67
|
+
with open(manifest_path, 'r', encoding='utf-8') as f:
|
68
|
+
manifest = json.load(f)
|
69
|
+
|
70
|
+
# Manifest geçerliyse döndür
|
71
|
+
if validate_manifest(manifest):
|
72
|
+
return manifest
|
73
|
+
else:
|
74
|
+
return None
|
75
|
+
|
76
|
+
except (json.JSONDecodeError, FileNotFoundError):
|
77
|
+
return None
|
78
|
+
|
79
|
+
def app_exists(app_name):
|
80
|
+
"""
|
81
|
+
Belirtilen uygulamanın yüklü olup olmadığını kontrol eder.
|
82
|
+
|
83
|
+
Args:
|
84
|
+
app_name (str): Uygulama adı
|
85
|
+
|
86
|
+
Returns:
|
87
|
+
bool: Uygulama yüklüyse True, değilse False
|
88
|
+
"""
|
89
|
+
return get_manifest(app_name) is not None
|
90
|
+
|
91
|
+
def list_app_names():
|
92
|
+
"""
|
93
|
+
Yüklü uygulamaların sadece isimlerini döndürür.
|
94
|
+
|
95
|
+
Returns:
|
96
|
+
list: Uygulama isimlerinin listesi (string formatında)
|
97
|
+
"""
|
98
|
+
app_names = []
|
99
|
+
apps_dir = "apps"
|
100
|
+
|
101
|
+
# apps dizini yoksa oluştur
|
102
|
+
if not os.path.exists(apps_dir):
|
103
|
+
os.makedirs(apps_dir)
|
104
|
+
return app_names
|
105
|
+
|
106
|
+
# apps dizinindeki her klasörü kontrol et
|
107
|
+
for app_name in os.listdir(apps_dir):
|
108
|
+
app_path = os.path.join(apps_dir, app_name)
|
109
|
+
|
110
|
+
# Sadece dizinleri kontrol et
|
111
|
+
if os.path.isdir(app_path):
|
112
|
+
manifest_path = os.path.join(app_path, "manifest.json")
|
113
|
+
|
114
|
+
# Manifest dosyası varsa
|
115
|
+
if os.path.exists(manifest_path):
|
116
|
+
try:
|
117
|
+
with open(manifest_path, 'r', encoding='utf-8') as f:
|
118
|
+
manifest = json.load(f)
|
119
|
+
|
120
|
+
# Manifest geçerliyse listeye ekle
|
121
|
+
if validate_manifest(manifest):
|
122
|
+
app_names.append(app_name)
|
123
|
+
except (json.JSONDecodeError, KeyError):
|
124
|
+
# Geçersiz manifest dosyası, atla
|
125
|
+
continue
|
126
|
+
|
127
|
+
return app_names
|
package_runner.py
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
import os
|
2
|
+
import json
|
3
|
+
import subprocess
|
4
|
+
from package_registry import get_manifest
|
5
|
+
|
6
|
+
def run_app(app_name):
|
7
|
+
"""
|
8
|
+
Belirtilen uygulamayı çalıştırır.
|
9
|
+
|
10
|
+
Args:
|
11
|
+
app_name (str): Çalıştırılacak uygulamanın adı
|
12
|
+
|
13
|
+
Returns:
|
14
|
+
bool: Uygulama başarıyla çalıştırıldıysa True, değilse False
|
15
|
+
"""
|
16
|
+
# Manifest bilgilerini al
|
17
|
+
manifest = get_manifest(app_name)
|
18
|
+
|
19
|
+
if not manifest:
|
20
|
+
print(f"Hata: '{app_name}' uygulaması bulunamadı veya geçersiz manifest dosyası.")
|
21
|
+
return False
|
22
|
+
|
23
|
+
# Uygulama dizini ve giriş dosyası
|
24
|
+
app_path = os.path.join("apps", app_name)
|
25
|
+
entry_file = manifest['entry']
|
26
|
+
entry_path = os.path.join(app_path, entry_file)
|
27
|
+
|
28
|
+
# Giriş dosyasının varlığını kontrol et
|
29
|
+
if not os.path.exists(entry_path):
|
30
|
+
print(f"Hata: Giriş dosyası '{entry_file}' bulunamadı.")
|
31
|
+
return False
|
32
|
+
|
33
|
+
# Dile göre çalıştır
|
34
|
+
language = manifest['language'].lower()
|
35
|
+
|
36
|
+
try:
|
37
|
+
if language == 'python':
|
38
|
+
# Python uygulamasını çalıştır
|
39
|
+
result = subprocess.run(['python', entry_file],
|
40
|
+
cwd=app_path,
|
41
|
+
capture_output=False)
|
42
|
+
return result.returncode == 0
|
43
|
+
|
44
|
+
elif language == 'lua':
|
45
|
+
# Lua uygulamasını çalıştır
|
46
|
+
result = subprocess.run(['lua', entry_file],
|
47
|
+
cwd=app_path,
|
48
|
+
capture_output=False)
|
49
|
+
return result.returncode == 0
|
50
|
+
|
51
|
+
else:
|
52
|
+
print(f"Hata: Desteklenmeyen dil '{language}'. Desteklenen diller: python, lua")
|
53
|
+
return False
|
54
|
+
|
55
|
+
except FileNotFoundError as e:
|
56
|
+
if language == 'python':
|
57
|
+
print("Hata: Python yüklü değil veya PATH'te bulunamadı.")
|
58
|
+
elif language == 'lua':
|
59
|
+
print("Hata: Lua yüklü değil veya PATH'te bulunamadı.")
|
60
|
+
return False
|
61
|
+
|
62
|
+
except Exception as e:
|
63
|
+
print(f"Hata: Uygulama çalıştırılırken bir hata oluştu: {e}")
|
64
|
+
return False
|
65
|
+
|
66
|
+
def get_supported_languages():
|
67
|
+
"""
|
68
|
+
Desteklenen programlama dillerinin listesini döndürür.
|
69
|
+
|
70
|
+
Returns:
|
71
|
+
list: Desteklenen diller listesi
|
72
|
+
"""
|
73
|
+
return ['python', 'lua']
|
74
|
+
|
75
|
+
def check_language_support(language):
|
76
|
+
"""
|
77
|
+
Belirtilen dilin desteklenip desteklenmediğini kontrol eder.
|
78
|
+
|
79
|
+
Args:
|
80
|
+
language (str): Kontrol edilecek dil
|
81
|
+
|
82
|
+
Returns:
|
83
|
+
bool: Dil destekleniyorsa True, değilse False
|
84
|
+
"""
|
85
|
+
return language.lower() in get_supported_languages()
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
Hello Python - Basit Python merhaba dünya uygulaması
|
4
|
+
clapp paket yöneticisi için örnek uygulama
|
5
|
+
"""
|
6
|
+
|
7
|
+
import sys
|
8
|
+
import os
|
9
|
+
from datetime import datetime
|
10
|
+
|
11
|
+
def main():
|
12
|
+
"""Ana fonksiyon"""
|
13
|
+
print("🐍 Merhaba Python Dünyası!")
|
14
|
+
print("=" * 40)
|
15
|
+
|
16
|
+
# Uygulama bilgileri
|
17
|
+
print(f"📦 Uygulama: hello-python")
|
18
|
+
print(f"🔢 Sürüm: 1.0.0")
|
19
|
+
print(f"💻 Dil: Python {sys.version.split()[0]}")
|
20
|
+
print(f"📅 Tarih: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
21
|
+
|
22
|
+
# Sistem bilgileri
|
23
|
+
print(f"\n🖥️ Sistem Bilgileri:")
|
24
|
+
print(f" İşletim Sistemi: {os.name}")
|
25
|
+
print(f" Python Sürümü: {sys.version}")
|
26
|
+
print(f" Çalışma Dizini: {os.getcwd()}")
|
27
|
+
|
28
|
+
# Basit hesaplama
|
29
|
+
print(f"\n🧮 Basit Hesaplama:")
|
30
|
+
a, b = 15, 25
|
31
|
+
print(f" {a} + {b} = {a + b}")
|
32
|
+
print(f" {a} * {b} = {a * b}")
|
33
|
+
|
34
|
+
# Dosya listesi
|
35
|
+
print(f"\n📁 Mevcut Dizin İçeriği:")
|
36
|
+
try:
|
37
|
+
files = os.listdir('.')
|
38
|
+
for i, file in enumerate(files[:5], 1):
|
39
|
+
print(f" {i}. {file}")
|
40
|
+
if len(files) > 5:
|
41
|
+
print(f" ... ve {len(files) - 5} dosya daha")
|
42
|
+
except Exception as e:
|
43
|
+
print(f" Dosya listesi alınamadı: {e}")
|
44
|
+
|
45
|
+
print(f"\n✅ hello-python uygulaması başarıyla çalıştı!")
|
46
|
+
print("🎉 clapp paket yöneticisine hoş geldiniz!")
|
47
|
+
|
48
|
+
if __name__ == "__main__":
|
49
|
+
main()
|
@@ -0,0 +1 @@
|
|
1
|
+
print("Test app çalışıyor!")
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name": "test-app", "version": "1.0.0", "language": "python", "description": "Test uygulaması", "entry": "main.py"}
|
@@ -0,0 +1 @@
|
|
1
|
+
print("Test app 2 çalışıyor!")
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name": "test-app2", "version": "1.0.0", "language": "python", "description": "Test uygulaması 2", "entry": "main.py"}
|
post_install_hint.py
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
post_install_hint.py - Kurulum sonrası yardım ipuçları
|
4
|
+
|
5
|
+
Bu modül kullanıcıya clapp kurulumu sonrasında PATH ve ortam
|
6
|
+
sorunları hakkında bilgi verir.
|
7
|
+
"""
|
8
|
+
|
9
|
+
import os
|
10
|
+
import sys
|
11
|
+
import shutil
|
12
|
+
import platform
|
13
|
+
from pathlib import Path
|
14
|
+
|
15
|
+
def get_platform_type():
|
16
|
+
"""Platform türünü döndürür"""
|
17
|
+
system = platform.system().lower()
|
18
|
+
if system == "windows":
|
19
|
+
return "windows"
|
20
|
+
elif system == "darwin":
|
21
|
+
return "macos"
|
22
|
+
else:
|
23
|
+
return "linux"
|
24
|
+
|
25
|
+
def get_onboarded_flag_path():
|
26
|
+
"""Onboarding flag dosyasının yolunu döndürür"""
|
27
|
+
home = Path.home()
|
28
|
+
clapp_dir = home / ".clapp"
|
29
|
+
return clapp_dir / ".onboarded"
|
30
|
+
|
31
|
+
def is_onboarded():
|
32
|
+
"""Kullanıcının daha önce onboarding gördüğünü kontrol eder"""
|
33
|
+
return get_onboarded_flag_path().exists()
|
34
|
+
|
35
|
+
def mark_as_onboarded():
|
36
|
+
"""Kullanıcıyı onboarded olarak işaretler"""
|
37
|
+
flag_path = get_onboarded_flag_path()
|
38
|
+
flag_path.parent.mkdir(exist_ok=True)
|
39
|
+
flag_path.write_text("onboarded")
|
40
|
+
|
41
|
+
def get_path_suggestions():
|
42
|
+
"""Platform'a göre PATH önerilerini döndürür"""
|
43
|
+
platform_type = get_platform_type()
|
44
|
+
|
45
|
+
if platform_type == "windows":
|
46
|
+
return [
|
47
|
+
"Windows PATH'e eklemek için:",
|
48
|
+
"1. Sistem Özellikleri > Gelişmiş > Ortam Değişkenleri",
|
49
|
+
"2. PATH değişkenine Python Scripts klasörünü ekleyin",
|
50
|
+
"3. Örnek: C:\\Python39\\Scripts",
|
51
|
+
"",
|
52
|
+
"Veya PowerShell'de:",
|
53
|
+
'$env:PATH += ";C:\\Python39\\Scripts"'
|
54
|
+
]
|
55
|
+
elif platform_type == "macos":
|
56
|
+
return [
|
57
|
+
"macOS PATH'e eklemek için:",
|
58
|
+
"~/.zshrc veya ~/.bash_profile dosyasına ekleyin:",
|
59
|
+
'export PATH="$PATH:$HOME/.local/bin"',
|
60
|
+
"",
|
61
|
+
"Sonra terminali yeniden başlatın veya:",
|
62
|
+
"source ~/.zshrc"
|
63
|
+
]
|
64
|
+
else: # linux
|
65
|
+
return [
|
66
|
+
"Linux PATH'e eklemek için:",
|
67
|
+
"~/.bashrc veya ~/.profile dosyasına ekleyin:",
|
68
|
+
'export PATH="$PATH:$HOME/.local/bin"',
|
69
|
+
"",
|
70
|
+
"Sonra terminali yeniden başlatın veya:",
|
71
|
+
"source ~/.bashrc"
|
72
|
+
]
|
73
|
+
|
74
|
+
def show_post_install_hint():
|
75
|
+
"""Kurulum sonrası ipuçlarını gösterir"""
|
76
|
+
# Eğer zaten onboarded ise gösterme
|
77
|
+
if is_onboarded():
|
78
|
+
return
|
79
|
+
|
80
|
+
# clapp PATH'te var mı kontrol et
|
81
|
+
clapp_in_path = shutil.which("clapp") is not None
|
82
|
+
|
83
|
+
if not clapp_in_path:
|
84
|
+
print("🚀 clapp'e Hoş Geldiniz!")
|
85
|
+
print("=" * 50)
|
86
|
+
print("⚠️ clapp komutu sistem PATH'inde bulunamadı.")
|
87
|
+
print("Bu, 'clapp' komutunu her yerden çalıştıramamanız anlamına gelir.")
|
88
|
+
print()
|
89
|
+
|
90
|
+
# Platform'a göre öneriler
|
91
|
+
suggestions = get_path_suggestions()
|
92
|
+
for suggestion in suggestions:
|
93
|
+
print(suggestion)
|
94
|
+
|
95
|
+
print()
|
96
|
+
print("🔧 Alternatif olarak:")
|
97
|
+
print("• Python -m clapp [komut] şeklinde çalıştırabilirsiniz")
|
98
|
+
print("• Veya python main.py [komut] şeklinde çalıştırabilirsiniz")
|
99
|
+
print()
|
100
|
+
print("📋 Sistem kontrolü için: clapp check-env")
|
101
|
+
print("🩺 Detaylı tanılama için: clapp doctor")
|
102
|
+
print()
|
103
|
+
print("Bu mesajı bir daha görmek istemiyorsanız:")
|
104
|
+
print("clapp doctor komutunu çalıştırın ve sorunları düzeltin.")
|
105
|
+
print("=" * 50)
|
106
|
+
else:
|
107
|
+
print("✅ clapp başarıyla kuruldu ve PATH'te mevcut!")
|
108
|
+
print("🎉 Başlamak için: clapp list")
|
109
|
+
|
110
|
+
# Onboarded olarak işaretle
|
111
|
+
mark_as_onboarded()
|
112
|
+
|
113
|
+
def show_welcome_message():
|
114
|
+
"""Hoş geldin mesajını gösterir"""
|
115
|
+
print("🎉 clapp - Hafif Çoklu Dil Uygulama Yöneticisi")
|
116
|
+
print()
|
117
|
+
print("📚 Temel komutlar:")
|
118
|
+
print(" clapp list - Yüklü uygulamaları listele")
|
119
|
+
print(" clapp run <app> - Uygulama çalıştır")
|
120
|
+
print(" clapp info <app> - Uygulama bilgilerini göster")
|
121
|
+
print(" clapp gui - Grafik arayüzü başlat")
|
122
|
+
print(" clapp check-env - Sistem kontrolü")
|
123
|
+
print(" clapp doctor - Detaylı tanılama")
|
124
|
+
print()
|
125
|
+
print("🔧 Yönetim komutları:")
|
126
|
+
print(" clapp install <source> - Uygulama yükle")
|
127
|
+
print(" clapp uninstall <app> - Uygulama kaldır")
|
128
|
+
print(" clapp upgrade <app> - Uygulama güncelle")
|
129
|
+
print(" clapp validate <folder> - Uygulama klasörünü doğrula")
|
130
|
+
print(" clapp clean - Geçici dosyaları temizle")
|
131
|
+
print()
|
132
|
+
print("📖 Daha fazla yardım için: clapp --help")
|
133
|
+
|
134
|
+
def check_first_run():
|
135
|
+
"""İlk çalıştırma kontrolü yapar"""
|
136
|
+
if not is_onboarded():
|
137
|
+
show_welcome_message()
|
138
|
+
print()
|
139
|
+
show_post_install_hint()
|
140
|
+
return True
|
141
|
+
return False
|
142
|
+
|
143
|
+
if __name__ == "__main__":
|
144
|
+
show_post_install_hint()
|