mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-04-12 23:07:13 +03:00
Add IntelliJ project files & reformat Python code
This commit is contained in:
parent
17cf87991c
commit
bee593106a
5
.idea/.gitignore
generated
vendored
Normal file
5
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/inspectionProfiles/
|
||||||
|
/httpRequests/
|
||||||
|
/shelf/
|
||||||
|
/misc.xml
|
||||||
|
/workspace.xml
|
18
.idea/Discord-History-Tracker.iml
generated
Normal file
18
.idea/Discord-History-Tracker.iml
generated
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/web" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/tools" isTestSource="false" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.vscode" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/bld" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/lib" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
<component name="TestRunnerService">
|
||||||
|
<option name="PROJECT_TEST_RUNNER" value="pytest" />
|
||||||
|
</component>
|
||||||
|
</module>
|
6
.idea/encodings.xml
generated
Normal file
6
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
|
||||||
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/Discord-History-Tracker.iml" filepath="$PROJECT_DIR$/.idea/Discord-History-Tracker.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
24
.idea/runConfigurations/Build_Minified.xml
generated
Normal file
24
.idea/runConfigurations/Build_Minified.xml
generated
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Build Minified" type="PythonConfigurationType" factoryName="Python">
|
||||||
|
<module name="Discord-History-Tracker" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="C:\Development\Python\3\python.exe" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="false" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/build.py" />
|
||||||
|
<option name="PARAMETERS" value="--copytracker" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
<option name="REDIRECT_INPUT" value="false" />
|
||||||
|
<option name="INPUT_FILE" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
24
.idea/runConfigurations/Build_Raw.xml
generated
Normal file
24
.idea/runConfigurations/Build_Raw.xml
generated
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Build Raw" type="PythonConfigurationType" factoryName="Python">
|
||||||
|
<module name="Discord-History-Tracker" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="C:\Development\Python\3\python.exe" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="false" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/build.py" />
|
||||||
|
<option name="PARAMETERS" value="--nominify --copytracker" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
<option name="REDIRECT_INPUT" value="false" />
|
||||||
|
<option name="INPUT_FILE" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
24
.idea/runConfigurations/Build_Website.xml
generated
Normal file
24
.idea/runConfigurations/Build_Website.xml
generated
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Build Website" type="PythonConfigurationType" factoryName="Python">
|
||||||
|
<module name="Discord-History-Tracker" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="C:\Development\Python\3\python.exe" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="false" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/build.py" />
|
||||||
|
<option name="PARAMETERS" value="--website" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
<option name="REDIRECT_INPUT" value="false" />
|
||||||
|
<option name="INPUT_FILE" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
11
.idea/vcs.xml
generated
Normal file
11
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GitSharedSettings">
|
||||||
|
<option name="FORCE_PUSH_PROHIBITED_PATTERNS">
|
||||||
|
<list />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
304
build.py
304
build.py
@ -8,11 +8,9 @@ import os
|
|||||||
import re
|
import re
|
||||||
import distutils.dir_util
|
import distutils.dir_util
|
||||||
|
|
||||||
|
|
||||||
VERSION_SHORT = "v.27"
|
VERSION_SHORT = "v.27"
|
||||||
VERSION_FULL = VERSION_SHORT + ", released 24 Aug 2020"
|
VERSION_FULL = VERSION_SHORT + ", released 24 Aug 2020"
|
||||||
|
|
||||||
|
|
||||||
EXEC_UGLIFYJS_WIN = "{2}/lib/uglifyjs.cmd --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved=[{3}] --output \"{1}\" \"{0}\""
|
EXEC_UGLIFYJS_WIN = "{2}/lib/uglifyjs.cmd --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved=[{3}] --output \"{1}\" \"{0}\""
|
||||||
EXEC_UGLIFYJS_AUTO = "uglifyjs --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved=[{3}] --output \"{1}\" \"{0}\""
|
EXEC_UGLIFYJS_AUTO = "uglifyjs --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved=[{3}] --output \"{1}\" \"{0}\""
|
||||||
|
|
||||||
@ -23,184 +21,182 @@ CLIPBOARD_TRACKER = "--copytracker" in sys.argv
|
|||||||
|
|
||||||
WORKING_DIR = os.getcwd()
|
WORKING_DIR = os.getcwd()
|
||||||
|
|
||||||
|
|
||||||
# UglifyJS Setup
|
# UglifyJS Setup
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
EXEC_UGLIFYJS = EXEC_UGLIFYJS_WIN
|
EXEC_UGLIFYJS = EXEC_UGLIFYJS_WIN
|
||||||
else:
|
else:
|
||||||
EXEC_UGLIFYJS = EXEC_UGLIFYJS_AUTO
|
EXEC_UGLIFYJS = EXEC_UGLIFYJS_AUTO
|
||||||
|
|
||||||
if USE_UGLIFYJS and shutil.which("uglifyjs") is None:
|
if USE_UGLIFYJS and shutil.which("uglifyjs") is None:
|
||||||
USE_UGLIFYJS = False
|
USE_UGLIFYJS = False
|
||||||
print("Could not find 'uglifyjs', JS minification will be disabled")
|
print("Could not find 'uglifyjs', JS minification will be disabled")
|
||||||
|
|
||||||
|
|
||||||
if USE_UGLIFYJS:
|
if USE_UGLIFYJS:
|
||||||
with open("reserve.txt", "r") as reserved:
|
with open("reserve.txt", "r") as reserved:
|
||||||
RESERVED_PROPS = ",".join(line.strip() for line in reserved.readlines())
|
RESERVED_PROPS = ",".join(line.strip() for line in reserved.readlines())
|
||||||
|
|
||||||
|
|
||||||
# File Utilities
|
# File Utilities
|
||||||
|
|
||||||
def combine_files(input_pattern, output_file):
|
def combine_files(input_pattern, output_file):
|
||||||
is_first_file = True
|
is_first_file = True
|
||||||
|
|
||||||
with fileinput.input(sorted(glob.glob(input_pattern))) as stream:
|
with fileinput.input(sorted(glob.glob(input_pattern))) as stream:
|
||||||
for line in stream:
|
for line in stream:
|
||||||
if stream.isfirstline():
|
if stream.isfirstline():
|
||||||
if is_first_file:
|
if is_first_file:
|
||||||
is_first_file = False
|
is_first_file = False
|
||||||
else:
|
else:
|
||||||
output_file.write("\n")
|
output_file.write("\n")
|
||||||
|
|
||||||
output_file.write(line.replace("{{{version:full}}}", VERSION_FULL))
|
output_file.write(line.replace("{{{version:full}}}", VERSION_FULL))
|
||||||
|
|
||||||
|
|
||||||
def minify_css(input_file, output_file):
|
def minify_css(input_file, output_file):
|
||||||
if not USE_MINIFICATION:
|
if not USE_MINIFICATION:
|
||||||
if input_file != output_file:
|
if input_file != output_file:
|
||||||
shutil.copyfile(input_file, output_file)
|
shutil.copyfile(input_file, output_file)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
return
|
with open(input_file, "r") as fin:
|
||||||
|
css = fin.read()
|
||||||
with open(input_file, "r") as fin:
|
|
||||||
css = fin.read()
|
css = re.sub(r"^\s+(.+?):\s*(.+?)(?:\s*(!important))?;\n", r"\1:\2\3;", css, flags = re.M) # remove spaces after colons
|
||||||
|
css = re.sub(r"\{\n", r"{", css, flags = re.M) # remove new lines after {
|
||||||
css = re.sub(r"^\s+(.+?):\s*(.+?)(?:\s*(!important))?;\n", r"\1:\2\3;", css, flags = re.M) # remove spaces after colons
|
css = re.sub(r"\n\}", r"}", css, flags = re.M) # remove new lines before }
|
||||||
css = re.sub(r"\{\n", r"{", css, flags = re.M) # remove new lines after {
|
css = re.sub(r"\n\n", r"\n", css, flags = re.M) # remove empty lines
|
||||||
css = re.sub(r"\n\}", r"}", css, flags = re.M) # remove new lines before }
|
css = re.sub(r";\}$", r"}", css, flags = re.M) # remove last semicolons
|
||||||
css = re.sub(r"\n\n", r"\n", css, flags = re.M) # remove empty lines
|
css = re.sub(r"rgb\((.*?),\s*(.*?),\s*(.*?)\)", r"rgb(\1,\2,\3)", css, flags = re.M) # remove spaces after commas in rgb()
|
||||||
css = re.sub(r";\}$", r"}", css, flags = re.M) # remove last semicolons
|
css = re.sub(r"rgba\((.*?),\s*(.*?),\s*(.*?),\s*(.*?)\)", r"rgba(\1,\2,\3,\4)", css, flags = re.M) # remove spaces after commas in rgba()
|
||||||
css = re.sub(r"rgb\((.*?),\s*(.*?),\s*(.*?)\)", r"rgb(\1,\2,\3)", css, flags = re.M) # remove spaces after commas in rgb()
|
|
||||||
css = re.sub(r"rgba\((.*?),\s*(.*?),\s*(.*?),\s*(.*?)\)", r"rgba(\1,\2,\3,\4)", css, flags = re.M) # remove spaces after commas in rgba()
|
with open(output_file, "w") as out:
|
||||||
|
out.write(css)
|
||||||
with open(output_file, "w") as out:
|
|
||||||
out.write(css)
|
|
||||||
|
|
||||||
|
|
||||||
# Build System
|
# Build System
|
||||||
|
|
||||||
def build_tracker_html():
|
def build_tracker_html():
|
||||||
output_file_raw = "bld/track.js"
|
output_file_raw = "bld/track.js"
|
||||||
output_file_html = "bld/track.html"
|
output_file_html = "bld/track.html"
|
||||||
|
|
||||||
output_file_tmp = "bld/track.tmp.js"
|
|
||||||
input_pattern = "src/tracker/*.js"
|
|
||||||
|
|
||||||
with open(output_file_raw, "w") as out:
|
|
||||||
if not USE_UGLIFYJS:
|
|
||||||
out.write("(function(){\n")
|
|
||||||
|
|
||||||
combine_files(input_pattern, out)
|
output_file_tmp = "bld/track.tmp.js"
|
||||||
|
input_pattern = "src/tracker/*.js"
|
||||||
if not USE_UGLIFYJS:
|
|
||||||
out.write("})()")
|
|
||||||
|
|
||||||
if USE_UGLIFYJS:
|
|
||||||
os.system(EXEC_UGLIFYJS.format(output_file_raw, output_file_tmp, WORKING_DIR, RESERVED_PROPS))
|
|
||||||
|
|
||||||
with open(output_file_raw, "w") as out:
|
with open(output_file_raw, "w") as out:
|
||||||
out.write("javascript:(function(){")
|
if not USE_UGLIFYJS:
|
||||||
|
out.write("(function(){\n")
|
||||||
with open(output_file_tmp, "r") as minified:
|
|
||||||
out.write(minified.read().replace("\n", " ").replace("\r", ""))
|
combine_files(input_pattern, out)
|
||||||
|
|
||||||
out.write("})()")
|
if not USE_UGLIFYJS:
|
||||||
|
out.write("})()")
|
||||||
|
|
||||||
os.remove(output_file_tmp)
|
if USE_UGLIFYJS:
|
||||||
|
os.system(EXEC_UGLIFYJS.format(output_file_raw, output_file_tmp, WORKING_DIR, RESERVED_PROPS))
|
||||||
with open(output_file_raw, "r") as raw:
|
|
||||||
script_contents = raw.read().replace("&", "&").replace('"', """).replace("'", "'").replace("<", "<").replace(">", ">")
|
with open(output_file_raw, "w") as out:
|
||||||
|
out.write("javascript:(function(){")
|
||||||
with open(output_file_html, "w") as out:
|
|
||||||
out.write(script_contents)
|
with open(output_file_tmp, "r") as minified:
|
||||||
|
out.write(minified.read().replace("\n", " ").replace("\r", ""))
|
||||||
|
|
||||||
|
out.write("})()")
|
||||||
|
|
||||||
|
os.remove(output_file_tmp)
|
||||||
|
|
||||||
|
with open(output_file_raw, "r") as raw:
|
||||||
|
script_contents = raw.read().replace("&", "&").replace('"', """).replace("'", "'").replace("<", "<").replace(">", ">")
|
||||||
|
|
||||||
|
with open(output_file_html, "w") as out:
|
||||||
|
out.write(script_contents)
|
||||||
|
|
||||||
|
|
||||||
def build_tracker_userscript():
|
def build_tracker_userscript():
|
||||||
output_file = "bld/track.user.js"
|
output_file = "bld/track.user.js"
|
||||||
|
|
||||||
input_pattern = "src/tracker/*.js"
|
input_pattern = "src/tracker/*.js"
|
||||||
userscript_base = "src/base/track.user.js"
|
userscript_base = "src/base/track.user.js"
|
||||||
|
|
||||||
with open(userscript_base, "r") as base:
|
with open(userscript_base, "r") as base:
|
||||||
userscript_contents = base.read().replace("{{{version}}}", VERSION_SHORT).split("{{{contents}}}")
|
userscript_contents = base.read().replace("{{{version}}}", VERSION_SHORT).split("{{{contents}}}")
|
||||||
|
|
||||||
with open(output_file, "w") as out:
|
with open(output_file, "w") as out:
|
||||||
out.write(userscript_contents[0])
|
out.write(userscript_contents[0])
|
||||||
combine_files(input_pattern, out)
|
combine_files(input_pattern, out)
|
||||||
out.write(userscript_contents[1])
|
out.write(userscript_contents[1])
|
||||||
|
|
||||||
|
|
||||||
def build_viewer():
|
def build_viewer():
|
||||||
output_file = "bld/viewer.html"
|
output_file = "bld/viewer.html"
|
||||||
input_html = "src/viewer/index.html"
|
input_html = "src/viewer/index.html"
|
||||||
|
|
||||||
input_css_pattern = "src/viewer/styles/*.css"
|
input_css_pattern = "src/viewer/styles/*.css"
|
||||||
tmp_css_file_combined = "bld/viewer.tmp.css"
|
tmp_css_file_combined = "bld/viewer.tmp.css"
|
||||||
tmp_css_file_minified = "bld/viewer.min.css"
|
tmp_css_file_minified = "bld/viewer.min.css"
|
||||||
|
|
||||||
with open(tmp_css_file_combined, "w") as out:
|
with open(tmp_css_file_combined, "w") as out:
|
||||||
combine_files(input_css_pattern, out)
|
combine_files(input_css_pattern, out)
|
||||||
|
|
||||||
minify_css(tmp_css_file_combined, tmp_css_file_minified)
|
minify_css(tmp_css_file_combined, tmp_css_file_minified)
|
||||||
os.remove(tmp_css_file_combined)
|
os.remove(tmp_css_file_combined)
|
||||||
|
|
||||||
input_js_pattern = "src/viewer/scripts/*.js"
|
input_js_pattern = "src/viewer/scripts/*.js"
|
||||||
tmp_js_file_combined = "bld/viewer.tmp.js"
|
tmp_js_file_combined = "bld/viewer.tmp.js"
|
||||||
tmp_js_file_minified = "bld/viewer.min.js"
|
tmp_js_file_minified = "bld/viewer.min.js"
|
||||||
|
|
||||||
with open(tmp_js_file_combined, "w") as out:
|
with open(tmp_js_file_combined, "w") as out:
|
||||||
combine_files(input_js_pattern, out)
|
combine_files(input_js_pattern, out)
|
||||||
|
|
||||||
if USE_UGLIFYJS:
|
if USE_UGLIFYJS:
|
||||||
os.system(EXEC_UGLIFYJS.format(tmp_js_file_combined, tmp_js_file_minified, WORKING_DIR, RESERVED_PROPS))
|
os.system(EXEC_UGLIFYJS.format(tmp_js_file_combined, tmp_js_file_minified, WORKING_DIR, RESERVED_PROPS))
|
||||||
else:
|
else:
|
||||||
shutil.copyfile(tmp_js_file_combined, tmp_js_file_minified)
|
shutil.copyfile(tmp_js_file_combined, tmp_js_file_minified)
|
||||||
|
|
||||||
os.remove(tmp_js_file_combined)
|
os.remove(tmp_js_file_combined)
|
||||||
|
|
||||||
tokens = {
|
tokens = {
|
||||||
"/*{js}*/": tmp_js_file_minified,
|
"/*{js}*/": tmp_js_file_minified,
|
||||||
"/*{css}*/": tmp_css_file_minified
|
"/*{css}*/": tmp_css_file_minified
|
||||||
}
|
}
|
||||||
|
|
||||||
with open(output_file, "w") as out:
|
with open(output_file, "w") as out:
|
||||||
with open(input_html, "r") as fin:
|
with open(input_html, "r") as fin:
|
||||||
for line in fin:
|
for line in fin:
|
||||||
token = None
|
token = None
|
||||||
|
|
||||||
for token in (token for token in tokens if token in line):
|
for token in (token for token in tokens if token in line):
|
||||||
with open(tokens[token], "r") as token_file:
|
with open(tokens[token], "r") as token_file:
|
||||||
embedded = token_file.read()
|
embedded = token_file.read()
|
||||||
|
|
||||||
out.write(embedded)
|
out.write(embedded)
|
||||||
os.remove(tokens[token])
|
os.remove(tokens[token])
|
||||||
|
|
||||||
if token is None:
|
if token is None:
|
||||||
out.write(line)
|
out.write(line)
|
||||||
|
|
||||||
|
|
||||||
def build_website():
|
def build_website():
|
||||||
tracker_file_html = "bld/track.html"
|
tracker_file_html = "bld/track.html"
|
||||||
tracker_file_userscript = "bld/track.user.js"
|
tracker_file_userscript = "bld/track.user.js"
|
||||||
viewer_file = "bld/viewer.html"
|
viewer_file = "bld/viewer.html"
|
||||||
web_style_file = "bld/web/style.css"
|
web_style_file = "bld/web/style.css"
|
||||||
|
|
||||||
distutils.dir_util.copy_tree("web", "bld/web")
|
distutils.dir_util.copy_tree("web", "bld/web")
|
||||||
index_file = "bld/web/index.php"
|
index_file = "bld/web/index.php"
|
||||||
|
|
||||||
with open(index_file, "r") as index:
|
with open(index_file, "r") as index:
|
||||||
index_contents = index.read()
|
index_contents = index.read()
|
||||||
|
|
||||||
with open(index_file, "w") as index:
|
with open(index_file, "w") as index:
|
||||||
index.write(index_contents.replace("{{{version:web}}}", VERSION_SHORT.replace(" ", " ")))
|
index.write(index_contents.replace("{{{version:web}}}", VERSION_SHORT.replace(" ", " ")))
|
||||||
|
|
||||||
os.makedirs("bld/web/build", exist_ok = True)
|
os.makedirs("bld/web/build", exist_ok = True)
|
||||||
shutil.copyfile(tracker_file_html, "bld/web/build/track.html")
|
shutil.copyfile(tracker_file_html, "bld/web/build/track.html")
|
||||||
shutil.copyfile(tracker_file_userscript, "bld/web/build/track.user.js")
|
shutil.copyfile(tracker_file_userscript, "bld/web/build/track.user.js")
|
||||||
shutil.copyfile(viewer_file, "bld/web/build/viewer.html")
|
shutil.copyfile(viewer_file, "bld/web/build/viewer.html")
|
||||||
minify_css(web_style_file, web_style_file)
|
minify_css(web_style_file, web_style_file)
|
||||||
|
|
||||||
|
|
||||||
# Build Process
|
# Build Process
|
||||||
@ -217,14 +213,14 @@ print("Building viewer...")
|
|||||||
build_viewer()
|
build_viewer()
|
||||||
|
|
||||||
if BUILD_WEBSITE:
|
if BUILD_WEBSITE:
|
||||||
print("Building website...")
|
print("Building website...")
|
||||||
build_website()
|
build_website()
|
||||||
|
|
||||||
if CLIPBOARD_TRACKER:
|
if CLIPBOARD_TRACKER:
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
print("Copying to clipboard...")
|
print("Copying to clipboard...")
|
||||||
os.system("clip < bld/track.js")
|
os.system("clip < bld/track.js")
|
||||||
else:
|
else:
|
||||||
print("Clipboard is only supported on Windows")
|
print("Clipboard is only supported on Windows")
|
||||||
|
|
||||||
print("Done")
|
print("Done")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user