Refactoring

This commit is contained in:
Oleg Korshul
2025-12-26 01:42:56 +03:00
parent 9241aa8a9b
commit 6f59b470a3
2 changed files with 19 additions and 9 deletions

View File

@ -4,7 +4,6 @@
import package_utils as utils
import package_common as common
import package_branding as branding
import os
def make():
utils.log_h1("BUILDER")
@ -205,14 +204,11 @@ def make_wheel():
utils.delete_file("docbuilder.net.dll")
utils.delete_file("docbuilder.jni.dll")
elif utils.is_macos():
utils.delete_file("libdocbuilder.jni.dylib")
utils.delete_file("libdocbuilder.jni.framework")
# delete all symlinks
for root, dirs, files in os.walk('.'):
for name in dirs + files:
path = os.path.join(root, name)
if os.path.islink(path):
os.unlink(path)
if (utils.is_file("libdocbuilder.jni.dylib")):
utils.delete_file("libdocbuilder.jni.dylib")
if (utils.is_dir("libdocbuilder.jni.framework")):
utils.delete_file("libdocbuilder.jni.framework")
utils.remove_all_symlinks(".")
elif utils.is_linux():
utils.delete_file("libdocbuilder.jni.so")

View File

@ -262,6 +262,20 @@ def delete_files(src, verbose=True):
shutil.rmtree(path, ignore_errors=True)
return
def remove_all_symlinks(dir):
for root, dirs, files in os.walk(dir, topdown=True, followlinks=False):
for name in files:
path = os.path.join(root, name)
if os.path.islink(path):
os.unlink(path)
for name in list(dirs):
path = os.path.join(root, name)
if os.path.islink(path):
os.unlink(path)
dirs.remove(name)
return
def set_summary(target, status):
common.summary.append({target: status})
return