diff --git a/tools/create_package.py b/tools/create_package.py index 8d33d12..fce22c9 100644 --- a/tools/create_package.py +++ b/tools/create_package.py @@ -4,7 +4,7 @@ import shutil import zipfile import json -from lib import tools_lib as Tools +from lib import utils as Utils def GetVersion (rootDir): packageJson = None @@ -57,7 +57,7 @@ def CreateWebsite (config, rootDir, websiteDir, version, testBuild): ] for htmlFileName in htmlFileNames: htmlFilePath = os.path.join (websiteDir, htmlFileName) - replacer = Tools.TokenReplacer (htmlFilePath, False) + replacer = Utils.TokenReplacer (htmlFilePath, False) replacer.ReplaceTokenFileLinks ('', '', websiteLibFiles, version) replacer.ReplaceTokenFileLinks ('', '', websiteFiles, version) replacer.ReplaceTokenFileLinks ('', '', pluginFiles, version) @@ -73,15 +73,15 @@ def CreateWebsite (config, rootDir, websiteDir, version, testBuild): replacer.ReplaceTokenContent ('', '', embedInitScriptContent) metaFile = os.path.join (rootDir, 'plugins', 'website_meta_data.txt') if os.path.exists (metaFile): - metaContent = Tools.GetFileContent (metaFile) + metaContent = Utils.GetFileContent (metaFile) replacer.ReplaceTokenContent ('', '', metaContent) analyticsFile = os.path.join (rootDir, 'plugins', 'website_analytics_data.txt') if os.path.exists (analyticsFile) and not testBuild: - analyticsContent = Tools.GetFileContent (analyticsFile) + analyticsContent = Utils.GetFileContent (analyticsFile) replacer.ReplaceTokenContent ('', '', analyticsContent) introFile = os.path.join (rootDir, 'plugins', 'website_intro_data.txt') if os.path.exists (introFile): - introContent = Tools.GetFileContent (introFile) + introContent = Utils.GetFileContent (introFile) replacer.ReplaceTokenContent ('', '', introContent) replacer.WriteToFile (htmlFilePath) @@ -116,7 +116,7 @@ def Main (argv): if len (argv) >= 2 and argv[1] == 'test': testBuild = True buildDir = os.path.join (rootDir, 'build', 'test') - Tools.PrintInfo ('Creating test build.') + Utils.PrintInfo ('Creating test build.') websiteDir = os.path.join (buildDir, 'website') packageDir = os.path.join (buildDir, 'package') @@ -128,13 +128,13 @@ def Main (argv): config = json.load (configJson) version = GetVersion (rootDir) - Tools.PrintInfo ('Create build directory') + Utils.PrintInfo ('Create build directory') CreateWebsite (config, rootDir, websiteDir, version, testBuild) - Tools.PrintInfo ('Create package.') + Utils.PrintInfo ('Create package.') packageResult = CreatePackage (rootDir, websiteDir, packageDir) if not packageResult: - Tools.PrintError ('Create package failed.') + Utils.PrintError ('Create package failed.') return 1 return 0 diff --git a/tools/generate_docs.py b/tools/generate_docs.py index bd93585..801c375 100644 --- a/tools/generate_docs.py +++ b/tools/generate_docs.py @@ -8,7 +8,7 @@ import platform import html import re -from lib import tools_lib as Tools +from lib import utils as Utils class HtmlGenerator: def __init__ (self, eol): @@ -362,7 +362,7 @@ def BuildHierarchy (doclets): def CreateFromTemplate (templateHtmlPath, resultHtmlPath, navigation, title, content, eol): shutil.copy (templateHtmlPath, resultHtmlPath) - Tools.ReplaceStringsInFile (resultHtmlPath, [ + Utils.ReplaceStringsInFile (resultHtmlPath, [ ('$$$TITLE$$$', title), ('$$$NAVIGATION$$$', navigation.GenerateHtml (eol)), ('$$$MAIN$$$', content) @@ -399,7 +399,7 @@ def BuildNavigation (pageGroups, hierarchy): def BuildDocumentationFiles (navigation, pageGroups, hierarchy, sourceDir, resultDir): templateHtmlPath = os.path.join (sourceDir, 'Template.html') - eol = Tools.GetEOLCharFromFile (templateHtmlPath) + eol = Utils.GetEOLCharFromFile (templateHtmlPath) for pageGroup in pageGroups: for page in pageGroup['pages']: @@ -407,7 +407,7 @@ def BuildDocumentationFiles (navigation, pageGroups, hierarchy, sourceDir, resul continue sourceHtmlPath = os.path.join (sourceDir, page['url']) pageHtmlPath = os.path.join (resultDir, page['url']) - pageContent = '
' + eol + Tools.GetFileContent (sourceHtmlPath) + eol + '
' + pageContent = '
' + eol + Utils.GetFileContent (sourceHtmlPath) + eol + '
' CreateFromTemplate (templateHtmlPath, pageHtmlPath, navigation, page['name'], pageContent, eol) for classDoc in hierarchy['classes']: diff --git a/tools/generate_icon_font.py b/tools/generate_icon_font.py index d17e6aa..3ffe87d 100644 --- a/tools/generate_icon_font.py +++ b/tools/generate_icon_font.py @@ -2,7 +2,7 @@ import os import sys import shutil -from lib import tools_lib as Tools +from lib import utils as Utils def Main (argv): toolsDir = os.path.dirname (os.path.abspath (__file__)) @@ -21,12 +21,12 @@ def Main (argv): if not os.path.exists (iconFontDir): os.makedirs (iconFontDir) - Tools.RunCommand ('oslllo-svg-fixer', [ + Utils.RunCommand ('oslllo-svg-fixer', [ '-s', iconsDir, '-d', fixedIconsDir ]) - Tools.RunCommand ('svgo', [fixedIconsDir]) - Tools.RunCommand ('fantasticon', [ + Utils.RunCommand ('svgo', [fixedIconsDir]) + Utils.RunCommand ('fantasticon', [ fixedIconsDir, '-o', iconFontDir, '-t', 'woff', @@ -40,7 +40,7 @@ def Main (argv): websiteIconsCssPath = os.path.join (websiteCssDir, 'icons.css') shutil.copy (os.path.join (iconFontDir, 'O3DVIcons.css'), websiteIconsCssPath) - Tools.ReplaceStringInFile (websiteIconsCssPath, './O3DVIcons.woff', 'O3DVIcons/O3DVIcons.woff') + Utils.ReplaceStringInFile (websiteIconsCssPath, './O3DVIcons.woff', 'O3DVIcons/O3DVIcons.woff') shutil.copy (os.path.join (iconFontDir, 'O3DVIcons.woff'), websiteIconFontDir) infoCssDir = os.path.join (rootDir, 'website', 'info', 'css') diff --git a/tools/lib/tools_lib.py b/tools/lib/utils.py similarity index 100% rename from tools/lib/tools_lib.py rename to tools/lib/utils.py diff --git a/tools/update_engine_exports.py b/tools/update_engine_exports.py index ff7e790..550b8aa 100644 --- a/tools/update_engine_exports.py +++ b/tools/update_engine_exports.py @@ -2,7 +2,7 @@ import os import sys import re -from lib import tools_lib as Tools +from lib import utils as Utils def Main (argv): toolsDir = os.path.dirname (os.path.abspath (__file__)) @@ -22,13 +22,13 @@ def Main (argv): }) mainFilePath = os.path.join (sourceFolder, 'main.js') - eolChar = Tools.GetEOLCharFromFile (mainFilePath) + eolChar = Utils.GetEOLCharFromFile (mainFilePath) exportedSymbols = [] mainFileContent = '' for engineFile in engineFiles: engineFilePath = os.path.join (sourceFolder, engineFile['dirName'], engineFile['fileName']) - content = Tools.GetFileContent (engineFilePath) + content = Utils.GetFileContent (engineFilePath) matches = re.findall ('export class ([a-zA-Z0-9]+)', content) matches.extend (re.findall ('export function ([a-zA-Z0-9]+)', content)) matches.extend (re.findall ('export const ([a-zA-Z0-9]+)', content)) @@ -49,7 +49,7 @@ def Main (argv): mainFileContent += eolChar mainFileContent += '};' + eolChar - Tools.WriteContentToFile (mainFilePath, mainFileContent) + Utils.WriteContentToFile (mainFilePath, mainFileContent) return 0 sys.exit (Main (sys.argv))