po-lang-engine 1.0.0__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.
- po_lang_engine-1.0.0/PKG-INFO +5 -0
- po_lang_engine-1.0.0/README.md +3 -0
- po_lang_engine-1.0.0/po_engine.py +46 -0
- po_lang_engine-1.0.0/po_lang_engine.egg-info/PKG-INFO +5 -0
- po_lang_engine-1.0.0/po_lang_engine.egg-info/SOURCES.txt +9 -0
- po_lang_engine-1.0.0/po_lang_engine.egg-info/dependency_links.txt +1 -0
- po_lang_engine-1.0.0/po_lang_engine.egg-info/entry_points.txt +2 -0
- po_lang_engine-1.0.0/po_lang_engine.egg-info/requires.txt +1 -0
- po_lang_engine-1.0.0/po_lang_engine.egg-info/top_level.txt +1 -0
- po_lang_engine-1.0.0/setup.cfg +4 -0
- po_lang_engine-1.0.0/setup.py +13 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import urllib.request
|
|
4
|
+
import requests
|
|
5
|
+
|
|
6
|
+
SUPABASE_URL = "https://bnwpmwufxbdnlcgbuhwi.supabase.co"
|
|
7
|
+
SUPABASE_API_KEY = "sb_publishable_wD9PusMz74qxK2AWRc8Jug_2aMqUAuD"
|
|
8
|
+
|
|
9
|
+
def run_po_engine(file_path):
|
|
10
|
+
if not file_path.endswith('.po'): return
|
|
11
|
+
variables = {}
|
|
12
|
+
try:
|
|
13
|
+
with open(file_path, 'r') as file:
|
|
14
|
+
for line in file:
|
|
15
|
+
line = line.strip()
|
|
16
|
+
if not line or line.startswith('#'): continue
|
|
17
|
+
if line.startswith('keep'):
|
|
18
|
+
expr = line.replace('keep', '').strip()
|
|
19
|
+
if '=' in expr:
|
|
20
|
+
k, v = expr.split('=', 1)
|
|
21
|
+
variables[k.strip()] = v.strip().strip('"').strip("'")
|
|
22
|
+
elif line.startswith('show'):
|
|
23
|
+
target = line.replace('show', '').strip()
|
|
24
|
+
print(variables.get(target, target.strip('"').strip("'")))
|
|
25
|
+
except Exception: pass
|
|
26
|
+
|
|
27
|
+
def run_pop_manager(package_name):
|
|
28
|
+
headers = {"apikey": SUPABASE_API_KEY, "Authorization": f"Bearer {SUPABASE_API_KEY}"}
|
|
29
|
+
endpoint = f"{SUPABASE_URL}/rest/v1/packages?name=eq.{package_name}"
|
|
30
|
+
target = os.path.join(os.getcwd(), f"{package_name}.po")
|
|
31
|
+
try:
|
|
32
|
+
resp = requests.get(endpoint, headers=headers)
|
|
33
|
+
if resp.status_code == 200 and resp.json():
|
|
34
|
+
url = resp.json()[0].get('download_url')
|
|
35
|
+
urllib.request.urlretrieve(url, target)
|
|
36
|
+
print(f"Package '{package_name}' installed.")
|
|
37
|
+
run_po_engine(target)
|
|
38
|
+
except Exception: print("Connection Error")
|
|
39
|
+
|
|
40
|
+
def main():
|
|
41
|
+
args = sys.argv[1:]
|
|
42
|
+
if len(args) >= 2 and args[0] == "get": run_pop_manager(args[1])
|
|
43
|
+
else: print("Usage: pop get <package_name>")
|
|
44
|
+
|
|
45
|
+
if __name__ == "__main__":
|
|
46
|
+
main()
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
po_engine.py
|
|
3
|
+
setup.py
|
|
4
|
+
po_lang_engine.egg-info/PKG-INFO
|
|
5
|
+
po_lang_engine.egg-info/SOURCES.txt
|
|
6
|
+
po_lang_engine.egg-info/dependency_links.txt
|
|
7
|
+
po_lang_engine.egg-info/entry_points.txt
|
|
8
|
+
po_lang_engine.egg-info/requires.txt
|
|
9
|
+
po_lang_engine.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
po_engine
|