Skip to content

Commit 214665f

Browse files
committed
v-1.1
1 parent eb5ebf7 commit 214665f

15 files changed

Lines changed: 115 additions & 35 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
**env.bak
1111
**venv.bak
1212
**__pycache__
13+
**.egg-info
1314

1415
**.Trash-*
1516
**.vscode

InitProject.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ source $SCRIPT_DIR/venv/bin/activate
1616
#.......................Requirements.................................#
1717

1818
echo "------------------Tools-----------------"
19-
sudo apt-get install -y python3.10
19+
sudo apt-get install -y python3
2020
sudo apt-get install -y python3-pip
2121
pip3 install -r $SCRIPT_DIR/Requirements.txt
2222
echo "----------------------------------------"

Install.bat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
3+
4+
pip install -e %~dp0
5+
6+
pause

Install.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
4+
SCRIPT_PATH=`realpath "$0"`
5+
SCRIPT_DIR=`dirname "$SCRIPT_PATH"`
6+
7+
8+
9+
# install tool
10+
pip3 install -e $SCRIPT_DIR

PPBuilder.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

PyProjectBuilder/BuildPipeline.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ def __Build(self):
196196
self.__PrepareForBuild()
197197
self.__ProcessBuild()
198198
self.__LinkObjectFiles()
199+
if self.ConfigFile.PostBuildAction != "":
200+
os.system(self.ConfigFile.PostBuildAction)
199201
#------------------------------------------------------#
200202
'''
201203
Start project build.

PyProjectBuilder/FileDependencies.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
66

77
import PyProjectBuildLibrary
8+
import Logger
89
import CppHeaderParser
910

1011

@@ -24,7 +25,11 @@
2425
def __GetFileIncludes(FilePath: str) -> list[str]:
2526
LFileExtension = PyProjectBuildLibrary.GetFileExtension(FilePath)
2627
if LFileExtension in ["C", "c", "CPP", "cpp", "H", "h", "HPP", "hpp"]:
27-
return list(map(lambda X: X[1: -1], CppHeaderParser.CppHeader(FilePath).includes))
28+
try:
29+
return list(map(lambda X: X[1: -1], CppHeaderParser.CppHeader(FilePath).includes))
30+
except Exception as ex:
31+
Logger.ErrorLog(ex)
32+
return list[str]()
2833
else:
2934
return list[str]()
3035
#------------------------------------------------------#

PyProjectBuilder/Logger.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010

1111

12+
'''
13+
Mutex for console print.
14+
'''
1215
LogMutex = multiprocessing.Lock()
1316

1417

PyProjectBuilder/PPBuilder.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) 2022 GrosSlava
2+
3+
import os
4+
import sys
5+
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
6+
7+
import PyProjectBuildLibrary
8+
import Logger
9+
import ProgramOptions
10+
import ProjectConfigFile
11+
import BuildPipeline
12+
13+
14+
15+
16+
17+
'''
18+
Run builder standard logic.
19+
'''
20+
def Run():
21+
if not PyProjectBuildLibrary.CheckCurrentPlatform():
22+
Logger.ErrorLog("Your os is not supported.")
23+
24+
LProgramOptions = ProgramOptions.FProgramOptions(sys.argv[1:])
25+
LProjectConfig = ProjectConfigFile.ParseConfigFile(LProgramOptions.ConfigFilePath)
26+
27+
LBuildPipeline = BuildPipeline.FBuildPipeline(LProgramOptions, LProjectConfig)
28+
29+
if LProgramOptions.Action == ProgramOptions.EAction.BUILD:
30+
LBuildPipeline.Build()
31+
elif LProgramOptions.Action == ProgramOptions.EAction.CLEAR:
32+
LBuildPipeline.Clear()
33+
elif LProgramOptions.Action == ProgramOptions.EAction.REBUILD:
34+
LBuildPipeline.Clear()
35+
LBuildPipeline.Build()
36+
#------------------------------------------------------#
37+
38+
39+
40+
if __name__ == "__main__":
41+
Run()
42+

PyProjectBuilder/ProjectConfigFile.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def __init__(self, ConfigFilePath: str):
4747
self.EntryPointName = "" # name of the function that will be the entry point (empty means compiler default)
4848
self.ConvertWarningsToErrors = False # tell compiler convert warnings into errors
4949
self.EnableAllWarnings = False # tell compiler to show all warnings
50+
self.PostBuildAction = "" # system console command to execute after build complete
5051
#------------------------------------------------------#
5152

5253

@@ -109,6 +110,8 @@ def ParseConfigFile(ConfigFilePath: str) -> FConfigFile:
109110
LProjectConfig.ConvertWarningsToErrors = PyProjectBuildLibrary.StrToBool(LRight)
110111
elif LLeft == "EnableAllWarnings":
111112
LProjectConfig.EnableAllWarnings = PyProjectBuildLibrary.StrToBool(LRight)
113+
elif LLeft == "PostBuildAction":
114+
LProjectConfig.PostBuildAction = LRight
112115
else:
113116
Logger.ErrorLog("Invalid configuration key: '{Key}'.".format(Key = LLeft))
114117

0 commit comments

Comments
 (0)