-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add redist script for the convenience of building plugin package, especially for Blender 4.2
- Loading branch information
Showing
5 changed files
with
159 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# disable distribution build folder | ||
redist/ | ||
!redist/.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import os, argparse, shutil | ||
import common | ||
|
||
def create_redist(redist_folder: str) -> None: | ||
# get plugin root folder and redist folder | ||
root_folder: str = common.get_plugin_folder() | ||
|
||
# we do not want to use script to recursively delete any folder | ||
# because we are afraid of accident `rm -rf /*` disaster. | ||
# but we still need a empty folder to copy file, | ||
# so we check whether redist folder is existing and hope user manually clean it. | ||
redist_folder = os.path.abspath(redist_folder) | ||
if os.path.exists(redist_folder): | ||
print(f'"{redist_folder}" is already existing. This may cause problem, please empty it first before running redist script.') | ||
# make sure redist folder is existing. | ||
os.makedirs(redist_folder, exist_ok=True) | ||
|
||
# copy core python files | ||
common.conditional_file_copy( | ||
root_folder, | ||
redist_folder, | ||
('*.py', '*.toml', ), | ||
None, | ||
False | ||
) | ||
|
||
# copy jsons | ||
common.conditional_file_copy( | ||
os.path.join(root_folder, 'jsons'), | ||
os.path.join(redist_folder, 'jsons'), | ||
('*.json', ), | ||
None, | ||
False | ||
) | ||
# copy icons | ||
common.conditional_file_copy( | ||
os.path.join(root_folder, 'icons'), | ||
os.path.join(redist_folder, 'icons'), | ||
('*.png', ), | ||
None, | ||
True | ||
) | ||
# copy meshes | ||
common.conditional_file_copy( | ||
os.path.join(root_folder, 'meshes'), | ||
os.path.join(redist_folder, 'meshes'), | ||
('*.bin', ), | ||
None, | ||
False | ||
) | ||
# copy BMap library | ||
common.conditional_file_copy( | ||
os.path.join(root_folder, 'PyBMap'), | ||
os.path.join(redist_folder, 'PyBMap'), | ||
('*.py', '*.dll', '*.so', '*.dylib', '*.bin', '*.pdb', ), | ||
None, | ||
False | ||
) | ||
|
||
print('Done.') | ||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='BBP NG Redist Script') | ||
parser.add_argument('-o', '--output', required=True, action='store', dest='output', help='The path to redist folder.') | ||
args = parser.parse_args() | ||
create_redist(args.output) |