From 8a1db87a2319c626601904c9d10d65e470beb1fb Mon Sep 17 00:00:00 2001 From: "Robin Dunn (cyclops)" Date: Mon, 25 Mar 2013 13:35:01 -0700 Subject: Add a release-with-debug-info (relwithdebinfo) build mode, which will build normal release mode binaries, but will also include the *.pdb files in the install or egg, to facilitate debugging on Windows without needing a full debug build. --- setup.py | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 3223b656f..ef87e6e7a 100644 --- a/setup.py +++ b/setup.py @@ -87,6 +87,7 @@ from utils import get_environment_from_batch_command # Declare options OPTION_DEBUG = has_option("debug") +OPTION_RELWITHDEBINFO = has_option('relwithdebinfo') OPTION_QMAKE = option_value("qmake") OPTION_CMAKE = option_value("cmake") OPTION_OPENSSL = option_value("openssl") @@ -164,6 +165,9 @@ if os.path.isdir(".git") and not OPTION_IGNOREGIT and not OPTION_ONLYPACKAGE: git_update_cmd = ["git", "submodule", "update", "--init"] if run_process(git_update_cmd) != 0: raise DistutilsSetupError("Failed to initialize the git submodules") + git_pull_cmd = ["git", "submodule", "foreach", "git", "fetch", "origin"] + if run_process(git_pull_cmd) != 0: + raise DistutilsSetupError("Failed to initialize the git submodules") git_pull_cmd = ["git", "submodule", "foreach", "git", "pull", "origin", "master"] if run_process(git_pull_cmd) != 0: raise DistutilsSetupError("Failed to initialize the git submodules") @@ -318,6 +322,8 @@ class pyside_build(_build): # Prepare parameters build_type = OPTION_DEBUG and "Debug" or "Release" + if OPTION_RELWITHDEBINFO: + build_type = 'RelWithDebInfo' py_executable = sys.executable py_version = "%s.%s" % (sys.version_info[0], sys.version_info[1]) py_include_dir = get_config_var("INCLUDEPY") @@ -689,17 +695,18 @@ class pyside_build(_build): logger=log, vars=vars) def prepare_packages_win32(self, vars): + pdbs = ['*.pdb'] if self.debug or self.build_type == 'RelWithDebInfo' else [] # /lib/site-packages/PySide/* -> /PySide copydir( "{install_dir}/lib/site-packages/PySide", "{dist_dir}/PySide", logger=log, vars=vars) - if self.debug: + if self.debug or self.build_type == 'RelWithDebInfo': # /pyside/PySide/*.pdb -> /PySide copydir( "{build_dir}/pyside/PySide", "{dist_dir}/PySide", - filter=["*.pdb"], + filter=pdbs, recursive=False, logger=log, vars=vars) # /shiboken/doc/html/* -> /PySide/docs/shiboken copydir( @@ -711,6 +718,11 @@ class pyside_build(_build): "{install_dir}/lib/site-packages/shiboken{dbgPostfix}.pyd", "{dist_dir}/PySide/shiboken{dbgPostfix}.pyd", logger=log, vars=vars) + if self.debug or self.build_type == 'RelWithDebInfo': + copyfile( + "{build_dir}/shiboken/shibokenmodule/shiboken{dbgPostfix}.pdb", + "{setup_dir}/PySide/shiboken{dbgPostfix}.pdb", + logger=log, vars=vars) # /lib/site-packages/pysideuic/* -> /pysideuic copydir( "{install_dir}/lib/site-packages/pysideuic", @@ -724,11 +736,11 @@ class pyside_build(_build): "{install_dir}/bin/pyside-uic", "{dist_dir}/PySide/scripts/uic.py", force=False, logger=log, vars=vars) - # /bin/*.exe,*.dll -> PySide/ + # /bin/*.exe,*.dll,*.pdb -> PySide/ copydir( "{install_dir}/bin/", "{dist_dir}/PySide", - filter=["*.exe", "*.dll"], + filter=["*.exe", "*.dll"] + pdbs, recursive=False, logger=log, vars=vars) # /lib/*.lib -> PySide/ copydir( @@ -772,9 +784,10 @@ class pyside_build(_build): if self.debug: # /bin/*d4.dll -> /PySide copydir("{qt_bin_dir}", "{dist_dir}/PySide", - filter=["*d4.dll"], + filter=["*d4.dll"] + pdbs, recursive=False, logger=log, vars=vars) + if self.debug or self.build_type == 'RelWithDebInfo': # /lib/*.pdb -> /PySide copydir("{qt_lib_dir}", "{setup_dir}/PySide", filter=["*.pdb"], @@ -792,15 +805,19 @@ class pyside_build(_build): copydir("{qt_lib_dir}", "{setup_dir}/PySide", filter=["*d?.dll"], recursive=False, logger=log, vars=vars) - + if self.debug or self.build_type == 'RelWithDebInfo': + # /lib/*pdb -> /PySide + copydir("{qt_lib_dir}", "{setup_dir}/PySide", + filter=pdbs, + recursive=False, logger=log, vars=vars) # /plugins/* -> /PySide/plugins copydir("{qt_plugins_dir}", "{dist_dir}/PySide/plugins", - filter=["*.dll"], + filter=["*.dll"] + pdbs, logger=log, vars=vars) # /imports/* -> /PySide/imports copydir("{qt_imports_dir}", "{dist_dir}/PySide/imports", - filter=["qmldir", "*.dll"], + filter=["qmldir", "*.dll"] + pdbs, logger=log, vars=vars) # /translations/* -> /PySide/translations copydir("{qt_translations_dir}", "{dist_dir}/PySide/translations", -- cgit v1.2.3