-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c82015a
commit 5e9855d
Showing
6 changed files
with
178 additions
and
2 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 |
---|---|---|
|
@@ -18,3 +18,4 @@ Config.ini | |
Examples/~$4 TabColors.xlsx | ||
/Cx_Freeze_Energy_Diagram_Plotter.py | ||
/build/ | ||
/dist/ |
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,51 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
|
||
block_cipher = None | ||
|
||
|
||
a = Analysis( | ||
['Draw_Energy_Diagram_XML.py'], | ||
pathex=[], | ||
binaries=[], | ||
datas=[], | ||
hiddenimports=[], | ||
hookspath=[], | ||
hooksconfig={}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False, | ||
) | ||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
[], | ||
exclude_binaries=True, | ||
name='Draw_Energy_Diagram_XML', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=True, | ||
disable_windowed_traceback=False, | ||
argv_emulation=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None, | ||
icon=['UI\\Draw_Energy_Diagram_Icon.ico'], | ||
) | ||
coll = COLLECT( | ||
exe, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
name='Draw_Energy_Diagram_XML', | ||
) |
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
Empty file.
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,104 @@ | ||
# -*- coding: utf-8 -*- | ||
__author__ = 'LiYuanhe' | ||
|
||
import sys | ||
import os | ||
import math | ||
import copy | ||
import shutil | ||
import re | ||
import time | ||
import random | ||
import subprocess | ||
from collections import OrderedDict | ||
|
||
# import pathlib | ||
# parent_path = str(pathlib.Path(__file__).parent.resolve()) | ||
# sys.path.insert(0,parent_path) | ||
|
||
from Python_Lib.My_Lib_Stock import * | ||
|
||
import PyInstaller.__main__ | ||
|
||
main_py_file = 'Draw_Energy_Diagram_XML.py' | ||
generated_exe_name = "__Energy Diagram Plotter CDXML 3.5.exe" | ||
icon = r"UI\Draw_Energy_Diagram_Icon.ico" | ||
include_all_folder_contents = [] | ||
include_folders = ["UI", "Python_Lib","Examples",r"C:\Anaconda3\Lib\site-packages\setuptools"] | ||
include_files = ["Draw_Energy_Diagram_XML.bat", | ||
"__matplotlib_DPI_Manual_Setting.txt"] | ||
delete_files = ["Qt5WebEngineCore.dll", | ||
"mkl_avx512.1.dll", | ||
"mkl_avx.1.dll", | ||
"mkl_mc3.1.dll", | ||
"mkl_avx2.1.dll", | ||
"mkl_mc.1.dll", | ||
"mkl_tbb_thread.1.dll", | ||
"mkl_sequential.1.dll", | ||
"mkl_vml_avx.1.dll", | ||
"mkl_vml_mc.1.dll", | ||
"mkl_vml_avx2.1.dll", | ||
"mkl_vml_mc3.1.dll", | ||
"mkl_vml_mc2.1.dll", | ||
"mkl_vml_avx512.1.dll", | ||
"mkl_vml_def.1.dll", | ||
"mkl_vml_cmpt.1.dll"] | ||
|
||
|
||
PyInstaller.__main__.run([ | ||
main_py_file, | ||
"--icon",icon, '-y' | ||
]) | ||
|
||
|
||
def copy_folder(src, dst): | ||
""" | ||
:param src: | ||
:param dst: dst will *contain* src folder | ||
:return: | ||
""" | ||
target = os.path.realpath(os.path.join(dst, filename_class(src).name)) | ||
if os.path.isdir(target): | ||
# input('Confirm delete: '+target+" >>>") | ||
try: | ||
shutil.rmtree(target) | ||
print("Deleting:", target) | ||
except Exception: | ||
print("Delete Failed:", target) | ||
return None | ||
print("Copying:", src, 'to', dst) | ||
shutil.copytree(src, target) | ||
|
||
|
||
generated_folder_name = os.path.join('dist',filename_class(main_py_file).name_stem) | ||
|
||
|
||
for file in include_files: | ||
print(f"Copying {file} to {generated_folder_name}") | ||
shutil.copy(file,generated_folder_name) | ||
|
||
for folder in include_folders: | ||
copy_folder(folder, generated_folder_name) | ||
|
||
for file in delete_files: | ||
file = os.path.join(generated_folder_name,file) | ||
if os.path.isfile(file): | ||
print(f"Deleting {file}") | ||
os.remove(file) | ||
else: | ||
print(f"File to remove not exist: {file}") | ||
|
||
for folder in include_all_folder_contents: | ||
target = os.path.realpath(os.path.join(generated_folder_name, filename_class(folder).name)) | ||
for current_object in os.listdir(folder): | ||
current_object = os.path.join(folder, current_object) | ||
if os.path.isfile(current_object): | ||
shutil.copy(current_object, generated_folder_name) | ||
else: | ||
copy_folder(current_object, generated_folder_name) | ||
|
||
shutil.move(os.path.join(generated_folder_name,filename_class(main_py_file).name_stem+'.exe'), | ||
os.path.join(generated_folder_name,generated_exe_name)) | ||
|
||
open_explorer_and_select(os.path.realpath(generated_folder_name)) |