Skip to content

Commit

Permalink
Merge branch 'issue_1119-code-removal'
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdvegas committed Nov 19, 2021
2 parents 411bfbc + c6c2d27 commit b138d91
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
47 changes: 23 additions & 24 deletions src/rez/build_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,29 +278,11 @@ def get_standard_vars(cls, context, variant, build_type, install,
return vars_

@classmethod
def add_standard_build_actions(cls, executor, context, variant, build_type,
install, build_path, install_path=None):
"""Perform build actions common to every build system.
"""
# set env vars
env_vars = cls.get_standard_vars(
context=context,
variant=variant,
build_type=build_type,
install=install,
build_path=build_path,
install_path=install_path
)
def add_pre_build_commands(cls, executor, variant, build_type, install,
build_path, install_path=None):
"""Execute pre_build_commands function if present."""

for var, value in env_vars.items():
executor.env[var] = value

@classmethod
def add_pre_build_commands(cls, executor, variant, build_type,
install, build_path, install_path=None):
"""Execute pre_build_commands if present.
"""
from rez.utils.data_utils import RO_AttrDictWrapper
from rez.utils.data_utils import RO_AttrDictWrapper as ROA

# bind build-related values into a 'build' namespace
build_ns = {
Expand All @@ -316,10 +298,27 @@ def add_pre_build_commands(cls, executor, variant, build_type,
if pre_build_commands:
with executor.reset_globals():
executor.bind("this", variant)
executor.bind("build", RO_AttrDictWrapper(build_ns))

executor.bind("build", ROA(build_ns))
executor.execute_code(pre_build_commands)

@classmethod
def add_standard_build_actions(cls, executor, context, variant, build_type,
install, build_path, install_path=None):
"""Perform build actions common to every build system.
"""
# set env vars
env_vars = cls.get_standard_vars(
context=context,
variant=variant,
build_type=build_type,
install=install,
build_path=build_path,
install_path=install_path
)

for var, value in env_vars.items():
executor.env[var] = value


# Copyright 2013-2016 Allan Johns.
#
Expand Down
4 changes: 2 additions & 2 deletions src/rez/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ def __str__(self):

class FailureReason(_Common):
def involved_requirements(self):
raise NotImplementedError
return []

def description(self):
raise NotImplementedError
return ""


class TotalReduction(FailureReason):
Expand Down
17 changes: 8 additions & 9 deletions src/rez/utils/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from rez.utils.yaml import dump_yaml
from rez.vendor.enum import Enum
from contextlib import contextmanager
from io import UnsupportedOperation
import subprocess
import sys
import stat
import os
import io


@contextmanager
Expand Down Expand Up @@ -54,14 +54,13 @@ def __init__(self, args, **kwargs):
if "stdin" not in kwargs:
try:
file_no = sys.stdin.fileno()
except (
AttributeError,
UnsupportedOperation # https://github.com/nerdvegas/rez/pull/966
):
if sys.__stdin__ is None:
file_no = None
else:
file_no = sys.__stdin__.fileno()

# https://github.com/nerdvegas/rez/pull/966
except (AttributeError, io.UnsupportedOperation):
file_no = None

if file_no is None and sys.__stdin__ is not None:
file_no = sys.__stdin__.fileno()

if file_no not in (0, 1, 2):
kwargs["stdin"] = subprocess.PIPE
Expand Down
3 changes: 2 additions & 1 deletion src/rez/utils/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ def is_pure_python_package(installed_dist):
wheel_data = Parser().parsestr(wheel_data)

# see https://www.python.org/dev/peps/pep-0427/#what-s-the-deal-with-purelib-vs-platlib
return (wheel_data.get("Root-Is-Purelib", "").lower() == "true")
is_purelib = wheel_data.get("Root-Is-Purelib", "").lower()
return (is_purelib == "true")


def get_rez_requirements(installed_dist, python_version, name_casings=None):
Expand Down
5 changes: 3 additions & 2 deletions src/rezplugins/shell/_utils/powershell_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,9 @@ def alias(self, key, value):
value = EscapedString.disallow(value)
# TODO: Find a way to properly escape paths in alias() calls that also
# contain args
cmd = "function {key}() {{ {value} @args }}"
self._addline(cmd.format(key=key, value=value))
#
cmd = "function %s() {{ %s @args }}" % (key, value)
self._addline(cmd)

def comment(self, value):
for line in value.split('\n'):
Expand Down

0 comments on commit b138d91

Please sign in to comment.