Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-30 09:40:28

0001 # This file is part of the actsvg package.
0002 #
0003 # Copyright (C) 2022 CERN for the benefit of the ACTS project
0004 #
0005 # This Source Code Form is subject to the terms of the Mozilla Public
0006 # License, v. 2.0. If a copy of the MPL was not distributed with this
0007 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 import os
0010 import sys
0011 import datetime
0012 
0013 
0014 current_directory = os.path.dirname(os.path.abspath(sys.argv[0]))
0015 js_path = os.path.join(current_directory, "template", "script.js")
0016 html_path = os.path.join(current_directory, "template", "index.html")
0017 css_path = os.path.join(current_directory, "template", "styles.css")
0018 rebuild_path = os.path.join(current_directory, "template", "rebuild.py")
0019 
0020 namespace = "actsvg::web"
0021 file_text_variables = [
0022     ("index_text", html_path),
0023     ("script_text", js_path),
0024     ("css_text", css_path),
0025     ("rebuild_text", rebuild_path),
0026 ]
0027 
0028 current_year = str(datetime.datetime.now().year)
0029 license = (
0030     r"""// This file is part of the actsvg package.
0031 //
0032 // Copyright (C) """
0033     + current_year
0034     + r""" CERN for the benefit of the ACTS project
0035 //
0036 // This Source Code Form is subject to the terms of the Mozilla Public
0037 // License, v. 2.0. If a copy of the MPL was not distributed with this
0038 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0039 
0040 """
0041 )
0042 
0043 file_content = (
0044     license
0045     + "#pragma once\n\n#include <string>\n\n"
0046     + "namespace "
0047     + namespace
0048     + " {\n\n"
0049 )
0050 for variable_name, path in file_text_variables:
0051     with open(path, "r") as file:
0052         file_content += (
0053             "const std::string " + variable_name + ' = R"(' + file.read() + ')";\n\n'
0054         )
0055 file_content += "} //  namespace " + namespace
0056 
0057 outputFile = os.path.join(current_directory, "webpage_text.hpp")
0058 with open(outputFile, "w") as file:
0059     file.write(file_content)
0060 print("Header File Created")