dmart 1.4.40.post9__py3-none-any.whl → 1.4.40.post10__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 +40 -16
- {dmart-1.4.40.post9.dist-info → dmart-1.4.40.post10.dist-info}/METADATA +1 -1
- {dmart-1.4.40.post9.dist-info → dmart-1.4.40.post10.dist-info}/RECORD +6 -6
- {dmart-1.4.40.post9.dist-info → dmart-1.4.40.post10.dist-info}/WHEEL +0 -0
- {dmart-1.4.40.post9.dist-info → dmart-1.4.40.post10.dist-info}/entry_points.txt +0 -0
- {dmart-1.4.40.post9.dist-info → dmart-1.4.40.post10.dist-info}/top_level.txt +0 -0
dmart/dmart.py
CHANGED
|
@@ -732,9 +732,9 @@ def main():
|
|
|
732
732
|
print(f"Error initializing sample spaces: {e}")
|
|
733
733
|
sys.exit(1)
|
|
734
734
|
case "migrate":
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
735
|
+
import configparser
|
|
736
|
+
import tempfile
|
|
737
|
+
|
|
738
738
|
dmart_root = Path(__file__).resolve().parent
|
|
739
739
|
alembic_ini_path = dmart_root / "alembic.ini"
|
|
740
740
|
|
|
@@ -742,27 +742,51 @@ def main():
|
|
|
742
742
|
print(f"Error: alembic.ini not found at {alembic_ini_path}")
|
|
743
743
|
sys.exit(1)
|
|
744
744
|
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
# Set script location relative to dmart package
|
|
748
|
-
alembic_cfg.set_main_option("script_location", str(dmart_root / "alembic"))
|
|
745
|
+
config = configparser.ConfigParser()
|
|
746
|
+
config.read(alembic_ini_path)
|
|
749
747
|
|
|
750
748
|
if "sqlite" in settings.database_driver:
|
|
751
749
|
db_url = f"{settings.database_driver}:///{settings.database_name}"
|
|
752
750
|
else:
|
|
753
751
|
db_url = f"{settings.database_driver}://{settings.database_username}:{settings.database_password}@{settings.database_host}:{settings.database_port}/{settings.database_name}"
|
|
754
752
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
sys.path.insert(0, str(dmart_root.parent))
|
|
753
|
+
config.set('alembic', 'sqlalchemy.url', db_url)
|
|
754
|
+
config.set('alembic', 'script_location', str(dmart_root / "alembic"))
|
|
755
|
+
config.set('alembic', 'prepend_sys_path', str(dmart_root.parent))
|
|
759
756
|
|
|
757
|
+
temp_config_path = ""
|
|
760
758
|
try:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
sys.
|
|
759
|
+
with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix=".ini") as temp_config_file:
|
|
760
|
+
config.write(temp_config_file)
|
|
761
|
+
temp_config_path = temp_config_file.name
|
|
762
|
+
|
|
763
|
+
alembic_cli_args = sys.argv[1:]
|
|
764
|
+
if not alembic_cli_args:
|
|
765
|
+
alembic_cli_args = ["upgrade", "head"]
|
|
766
|
+
|
|
767
|
+
command = [sys.executable, "-m", "alembic", "-c", temp_config_path] + alembic_cli_args
|
|
768
|
+
|
|
769
|
+
result = subprocess.run(command, capture_output=True, text=True, check=False)
|
|
770
|
+
|
|
771
|
+
if result.returncode == 0:
|
|
772
|
+
print("Alembic command finished.")
|
|
773
|
+
if result.stdout:
|
|
774
|
+
print(result.stdout)
|
|
775
|
+
if result.stderr:
|
|
776
|
+
print(result.stderr)
|
|
777
|
+
else:
|
|
778
|
+
print(f"Error during alembic command (exit code: {result.returncode}):")
|
|
779
|
+
if result.stdout:
|
|
780
|
+
print("--- stdout ---")
|
|
781
|
+
print(result.stdout)
|
|
782
|
+
if result.stderr:
|
|
783
|
+
print("--- stderr ---")
|
|
784
|
+
print(result.stderr)
|
|
785
|
+
sys.exit(1)
|
|
786
|
+
|
|
787
|
+
finally:
|
|
788
|
+
if temp_config_path and os.path.exists(temp_config_path):
|
|
789
|
+
os.remove(temp_config_path)
|
|
766
790
|
|
|
767
791
|
if __name__ == "__main__":
|
|
768
792
|
main()
|
|
@@ -7,7 +7,7 @@ dmart/config.ini.sample,sha256=AADMdwG07zRV_cAGMoOorHQaqzTTL2WEIC_mPWjIslE,159
|
|
|
7
7
|
dmart/conftest.py,sha256=0ry_zeCmdBNLbm5q115b-pkOrUFYxdsOUXbIMkr7E5Y,362
|
|
8
8
|
dmart/curl.sh,sha256=lmHSFVr5ft-lc5Aq9LfvKyWfntrfYbnirhzx1EGjp_A,15743
|
|
9
9
|
dmart/data_generator.py,sha256=CnE-VHEeX7-lAXtqCgbRqR9WHjTuOgeiZcviYrHAmho,2287
|
|
10
|
-
dmart/dmart.py,sha256=
|
|
10
|
+
dmart/dmart.py,sha256=Jiw1lzo1r_xEo1JXlI_gsHMcgl6lPkT1ErQmphcCefw,30855
|
|
11
11
|
dmart/get_settings.py,sha256=Sbe2WCoiK398E7HY4SNLfDN_GmE8knR4M-YJWF31jcg,153
|
|
12
12
|
dmart/hypercorn_config.toml,sha256=-eryppEG8HBOM_KbFc4dTQePnpyfoW9ZG5aUATU_6yM,50
|
|
13
13
|
dmart/info.json,sha256=u-MRDFZVj6_3IVamajI201LZqjNJLkGGr20IsyB4BtQ,123
|
|
@@ -482,8 +482,8 @@ dmart/utils/ticket_sys_utils.py,sha256=9QAlW2iiy8KyxQRBDj_WmzS5kKb0aYJmGwd4qzmGV
|
|
|
482
482
|
dmart/utils/web_notifier.py,sha256=QM87VVid2grC5lK3NdS1yzz0z1wXljr4GChJOeK86W4,843
|
|
483
483
|
dmart/utils/templates/activation.html.j2,sha256=XAMKCdoqONoc4ZQucD0yV-Pg5DlHHASZrTVItNS-iBE,640
|
|
484
484
|
dmart/utils/templates/reminder.html.j2,sha256=aoS8bTs56q4hjAZKsb0jV9c-PIURBELuBOpT_qPZNVU,639
|
|
485
|
-
dmart-1.4.40.
|
|
486
|
-
dmart-1.4.40.
|
|
487
|
-
dmart-1.4.40.
|
|
488
|
-
dmart-1.4.40.
|
|
489
|
-
dmart-1.4.40.
|
|
485
|
+
dmart-1.4.40.post10.dist-info/METADATA,sha256=zmK0XLtfnmcQThoesQ22KKN7yCrJZxjgZ6UR9Lzkp0Y,2555
|
|
486
|
+
dmart-1.4.40.post10.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
487
|
+
dmart-1.4.40.post10.dist-info/entry_points.txt,sha256=N832M4wG8d2GDw1xztKRVM3TnxpY2QDzvdFE8XaWaG8,43
|
|
488
|
+
dmart-1.4.40.post10.dist-info/top_level.txt,sha256=zJo4qk9fUW0BGIR9f4DCfpxaXbvQXH9izIOom6JsyAo,6
|
|
489
|
+
dmart-1.4.40.post10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|