diff options
author | Robin Dunn (cyclops) <robin@alldunn.com> | 2013-03-25 13:35:01 -0700 |
---|---|---|
committer | Robin Dunn <rdunn@enthought.com> | 2013-04-29 14:13:31 -0700 |
commit | 8a1db87a2319c626601904c9d10d65e470beb1fb (patch) | |
tree | 3b10a292be82164bc4a2bda14be6f74da540102f | |
parent | d5ba61e5d07153626bf4c948b66eb872516c6989 (diff) |
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.
-rw-r--r-- | setup.py | 33 |
1 files changed, 25 insertions, 8 deletions
@@ -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 [] # <install>/lib/site-packages/PySide/* -> <setup>/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': # <build>/pyside/PySide/*.pdb -> <setup>/PySide copydir( "{build_dir}/pyside/PySide", "{dist_dir}/PySide", - filter=["*.pdb"], + filter=pdbs, recursive=False, logger=log, vars=vars) # <build>/shiboken/doc/html/* -> <setup>/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) # <install>/lib/site-packages/pysideuic/* -> <setup>/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) - # <install>/bin/*.exe,*.dll -> PySide/ + # <install>/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) # <install>/lib/*.lib -> PySide/ copydir( @@ -772,9 +784,10 @@ class pyside_build(_build): if self.debug: # <qt>/bin/*d4.dll -> <setup>/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': # <qt>/lib/*.pdb -> <setup>/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': + # <qt>/lib/*pdb -> <setup>/PySide + copydir("{qt_lib_dir}", "{setup_dir}/PySide", + filter=pdbs, + recursive=False, logger=log, vars=vars) # <qt>/plugins/* -> <setup>/PySide/plugins copydir("{qt_plugins_dir}", "{dist_dir}/PySide/plugins", - filter=["*.dll"], + filter=["*.dll"] + pdbs, logger=log, vars=vars) # <qt>/imports/* -> <setup>/PySide/imports copydir("{qt_imports_dir}", "{dist_dir}/PySide/imports", - filter=["qmldir", "*.dll"], + filter=["qmldir", "*.dll"] + pdbs, logger=log, vars=vars) # <qt>/translations/* -> <setup>/PySide/translations copydir("{qt_translations_dir}", "{dist_dir}/PySide/translations", |