dmart 1.4.40.post23__py3-none-any.whl → 1.4.40.post24__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/dmart.py +53 -51
- {dmart-1.4.40.post23.dist-info → dmart-1.4.40.post24.dist-info}/METADATA +1 -1
- {dmart-1.4.40.post23.dist-info → dmart-1.4.40.post24.dist-info}/RECORD +6 -6
- {dmart-1.4.40.post23.dist-info → dmart-1.4.40.post24.dist-info}/WHEEL +0 -0
- {dmart-1.4.40.post23.dist-info → dmart-1.4.40.post24.dist-info}/entry_points.txt +0 -0
- {dmart-1.4.40.post23.dist-info → dmart-1.4.40.post24.dist-info}/top_level.txt +0 -0
dmart/dmart.py
CHANGED
|
@@ -17,13 +17,6 @@ from pathlib import Path
|
|
|
17
17
|
from multiprocessing import freeze_support
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
script_dir = str(Path(__file__).resolve().parent)
|
|
21
|
-
|
|
22
|
-
from hypercorn.config import Config
|
|
23
|
-
from hypercorn.run import run
|
|
24
|
-
from dmart.utils.settings import settings
|
|
25
|
-
|
|
26
|
-
|
|
27
20
|
commands = """
|
|
28
21
|
serve
|
|
29
22
|
hyper
|
|
@@ -48,7 +41,6 @@ sentinel = object()
|
|
|
48
41
|
|
|
49
42
|
|
|
50
43
|
def hypercorn_main(args_list: list[str]) -> int:
|
|
51
|
-
from dmart.utils.settings import settings
|
|
52
44
|
parser = argparse.ArgumentParser()
|
|
53
45
|
parser.add_argument(
|
|
54
46
|
"application",
|
|
@@ -256,33 +248,44 @@ def hypercorn_main(args_list: list[str]) -> int:
|
|
|
256
248
|
)
|
|
257
249
|
args = parser.parse_args(args_list)
|
|
258
250
|
|
|
251
|
+
# Allow child processes to find the application
|
|
252
|
+
dmart_dir = os.path.dirname(os.path.abspath(__file__))
|
|
253
|
+
dmart_pkg_parent = os.path.dirname(dmart_dir)
|
|
254
|
+
|
|
255
|
+
# Ensure dmart_pkg_parent is in sys.path
|
|
256
|
+
if dmart_pkg_parent not in sys.path:
|
|
257
|
+
sys.path.insert(0, dmart_pkg_parent)
|
|
258
|
+
|
|
259
|
+
# Ensure dmart_dir itself is NOT in sys.path to avoid module/package conflict
|
|
260
|
+
if dmart_dir in sys.path:
|
|
261
|
+
sys.path.remove(dmart_dir)
|
|
262
|
+
|
|
263
|
+
# If 'dmart' was imported as a module (due to shadowing), remove it
|
|
264
|
+
if "dmart" in sys.modules:
|
|
265
|
+
dmart_mod = sys.modules["dmart"]
|
|
266
|
+
if not hasattr(dmart_mod, "__path__"):
|
|
267
|
+
del sys.modules["dmart"]
|
|
268
|
+
|
|
269
|
+
# Handle the case where we are running from source and 'dmart' package is not available
|
|
270
|
+
# but the current directory contains 'main.py'
|
|
271
|
+
try:
|
|
272
|
+
from dmart import main as _unused
|
|
273
|
+
except ImportError:
|
|
274
|
+
if os.path.exists(os.path.join(dmart_dir, "main.py")):
|
|
275
|
+
if dmart_dir not in sys.path:
|
|
276
|
+
sys.path.insert(0, dmart_dir)
|
|
277
|
+
if args.application == "dmart.main:app":
|
|
278
|
+
args.application = "main:app"
|
|
279
|
+
|
|
280
|
+
from hypercorn.config import Config
|
|
281
|
+
from hypercorn.run import run
|
|
282
|
+
from dmart.utils.settings import settings
|
|
283
|
+
|
|
259
284
|
if args.config == "hypercorn_config.toml" and not os.path.exists(args.config):
|
|
260
285
|
config = Config()
|
|
261
286
|
config.backlog = 2000
|
|
262
287
|
config.workers = 1
|
|
263
288
|
config.bind = ["localhost:8282"]
|
|
264
|
-
# Allow child processes to find the application
|
|
265
|
-
dmart_dir = os.path.dirname(os.path.abspath(__file__))
|
|
266
|
-
dmart_pkg_parent = os.path.dirname(dmart_dir)
|
|
267
|
-
|
|
268
|
-
# Ensure dmart_pkg_parent is in sys.path
|
|
269
|
-
if dmart_pkg_parent not in sys.path:
|
|
270
|
-
sys.path.insert(0, dmart_pkg_parent)
|
|
271
|
-
|
|
272
|
-
# Ensure dmart_dir itself is NOT in sys.path
|
|
273
|
-
if dmart_dir in sys.path:
|
|
274
|
-
sys.path.remove(dmart_dir)
|
|
275
|
-
|
|
276
|
-
# Handle the case where we are running from source and 'dmart' package is not available
|
|
277
|
-
# but the current directory contains 'main.py'
|
|
278
|
-
try:
|
|
279
|
-
from dmart import main as _unused
|
|
280
|
-
except ImportError:
|
|
281
|
-
if os.path.exists(os.path.join(dmart_dir, "main.py")):
|
|
282
|
-
if dmart_dir not in sys.path:
|
|
283
|
-
sys.path.insert(0, dmart_dir)
|
|
284
|
-
if args.application == "dmart.main:app":
|
|
285
|
-
args.application = "main:app"
|
|
286
289
|
else:
|
|
287
290
|
config = Config.from_toml(args.config)
|
|
288
291
|
|
|
@@ -431,6 +434,26 @@ def print_formatted(data):
|
|
|
431
434
|
|
|
432
435
|
|
|
433
436
|
def main():
|
|
437
|
+
# Allow processes to find the dmart package
|
|
438
|
+
dmart_dir = os.path.dirname(os.path.abspath(__file__))
|
|
439
|
+
dmart_pkg_parent = os.path.dirname(dmart_dir)
|
|
440
|
+
|
|
441
|
+
if dmart_pkg_parent not in sys.path:
|
|
442
|
+
sys.path.insert(0, dmart_pkg_parent)
|
|
443
|
+
|
|
444
|
+
if dmart_dir in sys.path:
|
|
445
|
+
sys.path.remove(dmart_dir)
|
|
446
|
+
|
|
447
|
+
if "" in sys.path:
|
|
448
|
+
sys.path.remove("")
|
|
449
|
+
|
|
450
|
+
# If 'dmart' was imported as a module (due to shadowing), remove it
|
|
451
|
+
# so it can be correctly imported as a package from the fixed sys.path
|
|
452
|
+
if "dmart" in sys.modules:
|
|
453
|
+
dmart_mod = sys.modules["dmart"]
|
|
454
|
+
if not hasattr(dmart_mod, "__path__"):
|
|
455
|
+
del sys.modules["dmart"]
|
|
456
|
+
|
|
434
457
|
if len(sys.argv) < 2:
|
|
435
458
|
print("You must provide a command to run:")
|
|
436
459
|
print(commands)
|
|
@@ -846,25 +869,4 @@ def main():
|
|
|
846
869
|
|
|
847
870
|
if __name__ == "__main__":
|
|
848
871
|
freeze_support()
|
|
849
|
-
# If we are running as a script (e.g. during multiprocessing spawn),
|
|
850
|
-
# we need to ensure the parent of dmart package is in sys.path
|
|
851
|
-
# so that 'import dmart' works correctly.
|
|
852
|
-
# However, we must NOT add the directory containing dmart.py itself
|
|
853
|
-
# to sys.path, as that would make 'dmart' a module instead of a package.
|
|
854
|
-
|
|
855
|
-
# Path to this file: .../site-packages/dmart/dmart.py
|
|
856
|
-
# dmart_dir: .../site-packages/dmart
|
|
857
|
-
# dmart_pkg_parent: .../site-packages
|
|
858
|
-
dmart_dir = os.path.dirname(os.path.abspath(__file__))
|
|
859
|
-
dmart_pkg_parent = os.path.dirname(dmart_dir)
|
|
860
|
-
|
|
861
|
-
if dmart_pkg_parent not in sys.path:
|
|
862
|
-
sys.path.append(dmart_pkg_parent)
|
|
863
|
-
|
|
864
|
-
# Ensure dmart_dir itself is NOT in sys.path to avoid module/package conflict
|
|
865
|
-
if dmart_dir in sys.path:
|
|
866
|
-
sys.path.remove(dmart_dir)
|
|
867
|
-
if "" in sys.path:
|
|
868
|
-
sys.path.remove("")
|
|
869
|
-
|
|
870
872
|
main()
|
|
@@ -8,7 +8,7 @@ dmart/conftest.py,sha256=0ry_zeCmdBNLbm5q115b-pkOrUFYxdsOUXbIMkr7E5Y,362
|
|
|
8
8
|
dmart/curl.pypi.sh,sha256=KQ-kgV3_d5mwqoLd4XOwz5s2wRQ7LDVX3z-kvjvp9hA,15631
|
|
9
9
|
dmart/curl.sh,sha256=lmHSFVr5ft-lc5Aq9LfvKyWfntrfYbnirhzx1EGjp_A,15743
|
|
10
10
|
dmart/data_generator.py,sha256=CnE-VHEeX7-lAXtqCgbRqR9WHjTuOgeiZcviYrHAmho,2287
|
|
11
|
-
dmart/dmart.py,sha256=
|
|
11
|
+
dmart/dmart.py,sha256=5ACm3MWKltX-dP4cVz8jp6UpLVfcVGGOHtCcUdVLeZA,34135
|
|
12
12
|
dmart/get_settings.py,sha256=Sbe2WCoiK398E7HY4SNLfDN_GmE8knR4M-YJWF31jcg,153
|
|
13
13
|
dmart/hypercorn_config.toml,sha256=-eryppEG8HBOM_KbFc4dTQePnpyfoW9ZG5aUATU_6yM,50
|
|
14
14
|
dmart/info.json,sha256=6Kb7MXzVS0PzDZOUXtBoAA3zpxvtRBR0PJnedjBE-v4,123
|
|
@@ -483,8 +483,8 @@ dmart/utils/ticket_sys_utils.py,sha256=9QAlW2iiy8KyxQRBDj_WmzS5kKb0aYJmGwd4qzmGV
|
|
|
483
483
|
dmart/utils/web_notifier.py,sha256=QM87VVid2grC5lK3NdS1yzz0z1wXljr4GChJOeK86W4,843
|
|
484
484
|
dmart/utils/templates/activation.html.j2,sha256=XAMKCdoqONoc4ZQucD0yV-Pg5DlHHASZrTVItNS-iBE,640
|
|
485
485
|
dmart/utils/templates/reminder.html.j2,sha256=aoS8bTs56q4hjAZKsb0jV9c-PIURBELuBOpT_qPZNVU,639
|
|
486
|
-
dmart-1.4.40.
|
|
487
|
-
dmart-1.4.40.
|
|
488
|
-
dmart-1.4.40.
|
|
489
|
-
dmart-1.4.40.
|
|
490
|
-
dmart-1.4.40.
|
|
486
|
+
dmart-1.4.40.post24.dist-info/METADATA,sha256=urCqIjPP1uy_ayIMAKGYXsLFTt7j80VgSwCq7WzSr-g,839
|
|
487
|
+
dmart-1.4.40.post24.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
488
|
+
dmart-1.4.40.post24.dist-info/entry_points.txt,sha256=N832M4wG8d2GDw1xztKRVM3TnxpY2QDzvdFE8XaWaG8,43
|
|
489
|
+
dmart-1.4.40.post24.dist-info/top_level.txt,sha256=zJo4qk9fUW0BGIR9f4DCfpxaXbvQXH9izIOom6JsyAo,6
|
|
490
|
+
dmart-1.4.40.post24.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|