File indexing completed on 2025-01-18 09:16:07
0001 import os
0002 import shutil
0003 import subprocess
0004 import sys
0005
0006
0007 def main():
0008
0009 script_path = os.path.dirname(os.path.abspath(__file__))
0010
0011
0012 firebird_ng_path = os.path.join(script_path, '..', 'firebird-ng')
0013 dist_path = os.path.join(firebird_ng_path, 'dist', 'firebird')
0014 static_path = os.path.join(script_path, 'pyrobird', 'server', 'static')
0015
0016 print(f"Script Path: {script_path}")
0017 print(f"Firebird NG Path: {firebird_ng_path}")
0018 print(f"Dist Path: {dist_path}")
0019 print(f"Static Path: {static_path}")
0020
0021
0022 try:
0023 print("Running ng build at firebird-ng")
0024 subprocess.run(['ng', 'build'], cwd=firebird_ng_path, check=True)
0025 except subprocess.CalledProcessError as e:
0026 print(f"Error running 'ng build': {e}")
0027 sys.exit(1)
0028
0029
0030 print("removing existing pyrobird/server/static")
0031 if os.path.exists(static_path):
0032 shutil.rmtree(static_path)
0033 os.makedirs(static_path)
0034
0035
0036 print("copying firebird-ng/dist/firebird to pyrobird/server/static")
0037 if os.path.exists(dist_path):
0038 for item in os.listdir(dist_path):
0039 s = os.path.join(dist_path, item)
0040 d = os.path.join(static_path, item)
0041 if os.path.isdir(s):
0042 shutil.copytree(s, d)
0043 else:
0044 shutil.copy2(s, d)
0045 else:
0046 print(f"Source directory {dist_path} does not exist.")
0047 sys.exit(1)
0048
0049
0050 if __name__ == "__main__":
0051 main()