diff --git a/scripts/base.py b/scripts/base.py index 6f1dc51..dd9060b 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -307,6 +307,12 @@ def cmd_in_dir(directory, prog, args=[], is_no_errors=False): os.chdir(cur_dir) return ret +def cmd_and_return_cwd(prog, args=[], is_no_errors=False): + cur_dir = os.getcwd() + ret = cmd(prog, args, is_no_errors) + os.chdir(cur_dir) + return ret + def run_command(sCommand): popen = subprocess.Popen(sCommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) result = {'stdout' : '', 'stderr' : ''} diff --git a/scripts/build.py b/scripts/build.py index 5f56a33..3d5e076 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -62,9 +62,9 @@ def make_pro_file(makefiles_dir, pro_file): base.delete_file(makefiles_dir + "/build.makefile_" + file_suff) base.cmd(qt_dir + "/bin/qmake", ["-nocache", pro_file, "CONFIG+=" + config_param] + qmake_addon) if ("1" == config.option("clean")): - base.cmd_in_dir(makefiles_dir, base.app_make(), ["clean", "-f", "./build.makefile_" + file_suff], True) - base.cmd_in_dir(makefiles_dir, base.app_make(), ["distclean", "-f", "./build.makefile_" + file_suff], True) - base.cmd_in_dir(makefiles_dir, base.app_make(), ["-f", "./build.makefile_" + file_suff]) + base.cmd_and_return_cwd(base.app_make(), ["clean", "-f", makefiles_dir + "/build.makefile_" + file_suff], True) + base.cmd_and_return_cwd(base.app_make(), ["distclean", "-f", makefiles_dir + "/build.makefile_" + file_suff], True) + base.cmd_and_return_cwd(base.app_make(), ["-f", makefiles_dir + "/build.makefile_" + file_suff]) else: qmake_bat = [] qmake_bat.append("call \"" + config.option("vs-path") + "/vcvarsall.bat\" " + ("x86" if base.platform_is_32(platform) else "x64"))