Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

windows/package_complete.py: Fix split_debug

Freya Lupen824571086c29
diff --git a/packaging/windows/package-complete.py b/packaging/windows/package-complete.py
index 209c312b80..a90efe35e9 100644
--- a/packaging/windows/package-complete.py
+++ b/packaging/windows/package-complete.py
@@ -586,46 +586,47 @@ def split_debug(arg1, arg2):
commandToRun = f"objcopy --only-keep-debug {arg1} {arg1}.debug"
try:
subprocess.check_call(commandToRun, stdout=sys.stdout, stderr=sys.stderr, shell=True)
- except subprocess.CalledProcessError:
- sys.exit(1)
+ except subprocess.CalledProcessError as status:
+ return status.returncode
# If the debug file is small enough then consider there being no debug info.
# Discard these files since they somehow make gdb crash.
if os.path.getsize(f"{arg1}.debug") <= 2048:
print(f"Discarding {arg2}.debug")
os.remove(f"{arg1}.debug")
return 0
- if not os.path.isdir(os.path.dirname(f"{arg1}.debug")):
- os.mkdir(os.path.dirname(f"{arg1}.debug"))
- shutil.move(f"{arg1}.debug", f"{os.path.dirname(f'{arg1}.debug')}\\")
- commandToRun = f"strip --strip-debug {arg1}"
+ debugDir = os.path.dirname(arg1)+".debug"
+ if not os.path.isdir(debugDir):
+ os.mkdir(debugDir)
+ shutil.move(f"{arg1}.debug", debugDir+"\\")
+ commandToRun = f"strip --strip-debug {arg1}"
+ subprocess.check_call(commandToRun, stdout=sys.stdout, stderr=sys.stderr, shell=True)
+ # Add debuglink
+ # FIXME: There is a problem with gdb that cause it to output this warning
+ # FIXME: "warning: section .gnu_debuglink not found in xxx.debug"
+ # FIXME: I tried adding a link to itself but this kills drmingw :(
+ commandToRun = fr'objcopy --add-gnu-debuglink="{debugDir}\{os.path.basename(arg1)}.debug" {arg1}'
+ try:
subprocess.check_call(commandToRun, stdout=sys.stdout, stderr=sys.stderr, shell=True)
- # Add debuglink
- # FIXME: There is a problem with gdb that cause it to output this warning
- # FIXME: "warning: section .gnu_debuglink not found in xxx.debug"
- # FIXME: I tried adding a link to itself but this kills drmingw :(
- commandToRun = fr'objcopy --add-gnu-debuglink="{os.path.dirname(f"{arg1}")}.debug\{os.path.basename(arg1)}.debug" {arg1}'
- try:
- subprocess.check_call(commandToRun, stdout=sys.stdout, stderr=sys.stderr, shell=True)
- except subprocess.CalledProcessError as status:
- return status.returncode
- return 0
+ except subprocess.CalledProcessError as status:
+ return status.returncode
+ return 0
split_debug(fr"{pkg_root}\bin\krita.exe", r"bin\krita.exe")
split_debug(fr"{pkg_root}\bin\krita.com", r"bin\krita.com")
split_debug(fr"{pkg_root}\bin\kritarunner.exe", r"bin\kritarunner.exe")
split_debug(fr"{pkg_root}\bin\kritarunner.com", r"bin\kritarunner.com")
# Find all DLLs
-files = glob.glob(fr"{pkg_root}\*.dll")
+files = glob.glob(fr"{pkg_root}\**\*.dll", recursive=True)
for f in files:
split_debug(f, os.path.relpath(f, pkg_root))
# Find all Python native modules
-files = glob.glob(fr"{pkg_root}\share\krita\pykrita\*.pyd")
+files = glob.glob(fr"{pkg_root}\share\krita\pykrita\**\*.pyd", recursive=True)
for f in files:
split_debug(f, os.path.relpath(f, pkg_root))
-files = glob.glob(fr"{pkg_root}\lib\krita-python-libs\*.pyd")
+files = glob.glob(fr"{pkg_root}\lib\krita-python-libs\**\*.pyd", recursive=True)
for f in files:
split_debug(f, os.path.relpath(f, pkg_root))
-files = glob.glob(fr"{pkg_root}\lib\site-packages\*.pyd")
+files = glob.glob(fr"{pkg_root}\lib\site-packages\**\*.pyd", recursive=True)
for f in files:
split_debug(f, os.path.relpath(f, pkg_root))
@@ -637,12 +638,12 @@ if args.pre_zip_hook:
print("\nPackaging stripped binaries...")
subprocess.run([os.environ["SEVENZIP_EXE"], "a", "-tzip",
- f"{pkg_name}.zip", f"{pkg_root}\\", "-xr!**\*.pdb"], check=True)
+ f"{pkg_name}.zip", f"{pkg_root}\\", "-xr!*.debug"], check=True)
print("--------\n")
print("Packaging debug info...")
# (note that the top-level package dir is not included)
subprocess.run([os.environ["SEVENZIP_EXE"], "a", "-tzip",
- f"{pkg_name}-dbg.zip", "-r", f"{pkg_root}\\**\\*.pdb"], check=True)
+ f"{pkg_name}-dbg.zip", "-r", f"{pkg_root}\\*.debug"], check=True)
print("--------\n")
print("\n")