Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal windows fixes #2

Merged
merged 2 commits into from
May 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/rez/backport/shutilwhich.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def _access_check(fn, mode):
path.insert(0, os.curdir)

# PATHEXT is necessary to check on Windows.
pathext = env.get("PATHEXT", "").split(os.pathsep)
default_pathext = \
'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
pathext = env.get("PATHEXT", default_pathext).split(os.pathsep)
# See if the given file matches any of the expected path extensions.
# This will allow us to short circuit when given "python.exe".
matches = [cmd for ext in pathext if cmd.lower().endswith(ext.lower())]
Expand Down
3 changes: 2 additions & 1 deletion src/rez/bind/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def commands():

def bind(path, version_range=None, opts=None, parser=None):
exepath = find_exe("cmake", getattr(opts, "exe", None))
version = extract_version(exepath, "--version")
version = extract_version(exepath, "--version",
word_index=2 if os.name == 'nt' else -1)
check_version(version, version_range)

def make_root(variant, root):
Expand Down
4 changes: 2 additions & 2 deletions src/rez/cli/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def command(opts, parser, extra_arg_groups=None):
from rez.pip import pip_install_package

if opts.py_ver:
pyvers = opts.py_ver.strip(',').split(',')
py_vers = opts.py_ver.strip(',').split(',')
else:
pyvers = None
py_vers = None

pip_install_package(opts.PACKAGE,
pip_version=opts.pip_ver,
Expand Down
13 changes: 8 additions & 5 deletions src/rezplugins/build_system/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def _pr(s):
cmd += (self.build_args or [])

cmd.append("-DCMAKE_INSTALL_PREFIX=%s" % install_path)
cmd.append("-DCMAKE_MODULE_PATH=%s" % sh.get_key_token("CMAKE_MODULE_PATH"))
cmd.append("-DCMAKE_MODULE_PATH=%s" %
sh.get_key_token("CMAKE_MODULE_PATH").replace('\\', '/'))
cmd.append("-DCMAKE_BUILD_TYPE=%s" % self.build_target)
cmd.append("-DREZ_BUILD_TYPE=%s" % build_type.name)
cmd.append("-DREZ_BUILD_INSTALL=%d" % (1 if install else 0))
Expand Down Expand Up @@ -174,9 +175,11 @@ def _pr(s):
cmd = ["make"]
cmd += (self.child_build_args or [])

if not any(x.startswith("-j") for x in (self.child_build_args or [])):
n = variant.config.build_thread_count
cmd.append("-j%d" % n)
# nmake has no -j
if self.settings.make_binary != 'nmake':
if not any(x.startswith("-j") for x in (self.child_build_args or [])):
n = variant.config.build_thread_count
cmd.append("-j%d" % n)

# execute make within the build env
_pr("\nExecuting: %s" % ' '.join(cmd))
Expand Down Expand Up @@ -204,7 +207,7 @@ def _add_build_actions(executor, context, package, variant, build_type):
cmake_path = os.path.join(os.path.dirname(__file__), "cmake_files")
template_path = os.path.join(os.path.dirname(__file__), "template_files")

executor.env.CMAKE_MODULE_PATH.append(cmake_path)
executor.env.CMAKE_MODULE_PATH.append(cmake_path.replace('\\', '/'))
executor.env.REZ_BUILD_DOXYFILE = os.path.join(template_path, 'Doxyfile')
executor.env.REZ_BUILD_VARIANT_INDEX = variant.index or 0
executor.env.REZ_BUILD_THREAD_COUNT = package.config.build_thread_count
Expand Down
3 changes: 3 additions & 0 deletions src/rezplugins/build_system/cmake_files/RezPipInstall.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ macro (rez_pip_install)
set(install_cmd "")
endif()

# PIP on Windows doesn't like forward slashes for the --install-scripts argument
file(TO_NATIVE_PATH ${destbinpath} destbinpath)

ExternalProject_add(
${label}
URL ${url}
Expand Down
8 changes: 6 additions & 2 deletions src/rezplugins/shell/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def get_syspaths(cls):
def _bind_interactive_rez(self):
if config.set_prompt and self.settings.prompt:
stored_prompt = os.getenv("REZ_STORED_PROMPT")
curr_prompt = stored_prompt or os.getenv("PROMPT", "foobar")
curr_prompt = stored_prompt or os.getenv("PROMPT", "")
if not stored_prompt:
self.setenv("REZ_STORED_PROMPT", curr_prompt)

Expand Down Expand Up @@ -121,7 +121,11 @@ def _record_shell(ex, files, bind_rez=True, print_msg=False):
# ex.info('You are now in a rez-configured environment.')
# ex.info('')
if system.is_production_rez_install:
ex.command("cmd /Q /K rezolve context")
# previously this was called with the /K flag, however
# that would leave spawn_shell hung on a blocked call
# waiting for the user to type "exit" into the shell that
# was spawned to run the rez context printout
ex.command("cmd /Q /C rez context")

def _create_ex():
return RexExecutor(interpreter=self.new_shell(),
Expand Down