dmart 1.4.21__py3-none-any.whl → 1.4.23__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.
- {dmart-1.4.21.dist-info → dmart-1.4.23.dist-info}/METADATA +1 -1
- {dmart-1.4.21.dist-info → dmart-1.4.23.dist-info}/RECORD +6 -6
- dmart.py +29 -27
- {dmart-1.4.21.dist-info → dmart-1.4.23.dist-info}/WHEEL +0 -0
- {dmart-1.4.21.dist-info → dmart-1.4.23.dist-info}/entry_points.txt +0 -0
- {dmart-1.4.21.dist-info → dmart-1.4.23.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
bundler.py,sha256=MDTUTVS0WL7gb-i1rDcS4i37KTqaW88TluL4L3rwjRw,1817
|
|
2
2
|
data_generator.py,sha256=CnE-VHEeX7-lAXtqCgbRqR9WHjTuOgeiZcviYrHAmho,2287
|
|
3
|
-
dmart.py,sha256=
|
|
3
|
+
dmart.py,sha256=zgHBt-3kfKL4hCXmjK2CtNq0yTgEvrJH-53hETcvfJY,25688
|
|
4
4
|
get_settings.py,sha256=Sbe2WCoiK398E7HY4SNLfDN_GmE8knR4M-YJWF31jcg,153
|
|
5
5
|
info.json,sha256=hXQWl19lfMkEj_zXdehGeKjiKGNJ7emY4S7d4pIqJ1E,123
|
|
6
6
|
main.py,sha256=KZGhIL6AnEm5ZAPy4IvhBDpzSTjuodilV7NafNOyhzM,19676
|
|
@@ -272,8 +272,8 @@ utils/ticket_sys_utils.py,sha256=9QAlW2iiy8KyxQRBDj_WmzS5kKb0aYJmGwd4qzmGVqo,700
|
|
|
272
272
|
utils/web_notifier.py,sha256=QM87VVid2grC5lK3NdS1yzz0z1wXljr4GChJOeK86W4,843
|
|
273
273
|
utils/templates/activation.html.j2,sha256=XAMKCdoqONoc4ZQucD0yV-Pg5DlHHASZrTVItNS-iBE,640
|
|
274
274
|
utils/templates/reminder.html.j2,sha256=aoS8bTs56q4hjAZKsb0jV9c-PIURBELuBOpT_qPZNVU,639
|
|
275
|
-
dmart-1.4.
|
|
276
|
-
dmart-1.4.
|
|
277
|
-
dmart-1.4.
|
|
278
|
-
dmart-1.4.
|
|
279
|
-
dmart-1.4.
|
|
275
|
+
dmart-1.4.23.dist-info/METADATA,sha256=ojXCy8URKygQ9ZaKcr98R76DD5QlBNsc7G3OTiQKmmc,2149
|
|
276
|
+
dmart-1.4.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
277
|
+
dmart-1.4.23.dist-info/entry_points.txt,sha256=GjfoGh1bpxuU9HHGJzbtCFPNptHv9TryxHMN3uBSKpg,37
|
|
278
|
+
dmart-1.4.23.dist-info/top_level.txt,sha256=S-gfX1pLerapNXiHZ8lvPYoV7sgwSX2_NCZ6xfzDUHM,267
|
|
279
|
+
dmart-1.4.23.dist-info/RECORD,,
|
dmart.py
CHANGED
|
@@ -3,12 +3,14 @@ from __future__ import annotations
|
|
|
3
3
|
|
|
4
4
|
import argparse
|
|
5
5
|
import asyncio
|
|
6
|
+
import configparser
|
|
6
7
|
import json
|
|
7
8
|
import os
|
|
8
9
|
import shutil
|
|
9
10
|
import ssl
|
|
10
11
|
import subprocess
|
|
11
12
|
import sys
|
|
13
|
+
import tempfile
|
|
12
14
|
import time
|
|
13
15
|
import warnings
|
|
14
16
|
import webbrowser
|
|
@@ -18,10 +20,9 @@ from pathlib import Path
|
|
|
18
20
|
from hypercorn.config import Config
|
|
19
21
|
from hypercorn.run import run
|
|
20
22
|
|
|
23
|
+
# Try to import alembic
|
|
21
24
|
try:
|
|
22
|
-
# Try to import alembic
|
|
23
25
|
import alembic
|
|
24
|
-
|
|
25
26
|
# Check if we are importing the local alembic directory which is likely a leftover
|
|
26
27
|
if hasattr(alembic, '__path__'):
|
|
27
28
|
local_alembic_path = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'alembic'))
|
|
@@ -38,7 +39,10 @@ try:
|
|
|
38
39
|
import alembic
|
|
39
40
|
except Exception:
|
|
40
41
|
pass
|
|
42
|
+
except ImportError:
|
|
43
|
+
pass
|
|
41
44
|
|
|
45
|
+
try:
|
|
42
46
|
from alembic import command as alembic_command
|
|
43
47
|
from alembic.config import Config as AlembicConfig
|
|
44
48
|
HAS_ALEMBIC = True
|
|
@@ -412,20 +416,6 @@ def hypercorn_main() -> int:
|
|
|
412
416
|
|
|
413
417
|
|
|
414
418
|
def main():
|
|
415
|
-
# Use sys.argv directly instead of modifying it in place which might be confusing
|
|
416
|
-
# But to fix the UnboundLocalError, we just need to refer to the global sys module
|
|
417
|
-
# The error happens because we're assigning to sys.argv, making python think sys is local
|
|
418
|
-
# but we haven't imported it in this scope (it's imported at module level)
|
|
419
|
-
# However, in Python, module-level imports are available in functions.
|
|
420
|
-
# The issue is likely that we are assigning to sys.argv, which makes Python treat 'sys' as a local variable
|
|
421
|
-
# But wait, sys is imported at the top.
|
|
422
|
-
# Actually, the error "UnboundLocalError: cannot access local variable 'sys' where it is not associated with a value"
|
|
423
|
-
# suggests that there might be a local variable named 'sys' somewhere or something weird is happening.
|
|
424
|
-
# Ah, I see what happened. I added "import sys" inside the try/except block in the migrate case!
|
|
425
|
-
# That local import shadows the global import for the whole function scope in Python 3.x due to how scoping works.
|
|
426
|
-
|
|
427
|
-
# Let's fix this by removing the local import of sys in the migrate case since it's already imported globally.
|
|
428
|
-
|
|
429
419
|
global sys
|
|
430
420
|
|
|
431
421
|
args = sys.argv[1:]
|
|
@@ -459,10 +449,6 @@ def main():
|
|
|
459
449
|
import threading
|
|
460
450
|
threading.Thread(target=open_browser, daemon=True).start()
|
|
461
451
|
|
|
462
|
-
# We need to update sys.argv for hypercorn/fastapi if they use it,
|
|
463
|
-
# but here we are calling asyncio.run(server()) which uses settings.
|
|
464
|
-
# hypercorn_main uses sys.argv, but we call it explicitly above.
|
|
465
|
-
# Let's just set sys.argv to the modified args just in case.
|
|
466
452
|
sys.argv = [sys.argv[0]] + args
|
|
467
453
|
asyncio.run(server())
|
|
468
454
|
case "health-check":
|
|
@@ -474,7 +460,6 @@ def main():
|
|
|
474
460
|
parser.add_argument("-s", "--space", help="hit the target space or pass (all) to make the full health check")
|
|
475
461
|
parser.add_argument("-m", "--schemas", nargs="*", help="hit the target schema inside the space")
|
|
476
462
|
|
|
477
|
-
# parse_args defaults to sys.argv[1:], so we need to pass the relevant args
|
|
478
463
|
args_parsed = parser.parse_args(args[1:])
|
|
479
464
|
before_time = time.time()
|
|
480
465
|
asyncio.run(health_check(args_parsed.type, args_parsed.space, args_parsed.schemas))
|
|
@@ -604,12 +589,29 @@ def main():
|
|
|
604
589
|
try:
|
|
605
590
|
# Check if alembic library is installed
|
|
606
591
|
if not HAS_ALEMBIC:
|
|
607
|
-
print("
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
592
|
+
print("Warning: 'alembic' library not found. Attempting to run 'alembic' CLI...")
|
|
593
|
+
|
|
594
|
+
with tempfile.NamedTemporaryFile(mode='w', suffix='.ini', delete=False) as tmp:
|
|
595
|
+
temp_ini_path = tmp.name
|
|
596
|
+
config = configparser.ConfigParser()
|
|
597
|
+
config.read(str(original_ini_path))
|
|
598
|
+
if not config.has_section('alembic'):
|
|
599
|
+
config.add_section('alembic')
|
|
600
|
+
config.set('alembic', 'script_location', alembic_dir.as_posix())
|
|
601
|
+
config.write(tmp)
|
|
602
|
+
|
|
603
|
+
try:
|
|
604
|
+
subprocess.run(["alembic", "-c", temp_ini_path, "upgrade", "head"], check=True)
|
|
605
|
+
except Exception as e:
|
|
606
|
+
print(f"Error running alembic CLI: {e}")
|
|
607
|
+
print("Please install 'alembic' library with 'pip install alembic'.")
|
|
608
|
+
if ALEMBIC_ERROR:
|
|
609
|
+
print(f"Details: {ALEMBIC_ERROR}")
|
|
610
|
+
sys.exit(1)
|
|
611
|
+
finally:
|
|
612
|
+
if os.path.exists(temp_ini_path):
|
|
613
|
+
os.unlink(temp_ini_path)
|
|
614
|
+
return
|
|
613
615
|
|
|
614
616
|
alembic_cfg = AlembicConfig(str(original_ini_path))
|
|
615
617
|
alembic_cfg.set_main_option("script_location", alembic_dir.as_posix())
|
|
File without changes
|
|
File without changes
|
|
File without changes
|