How to use the rez.rex.Setenv function in rez

To help you get started, we’ve selected a few rez examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nerdvegas / rez / tests / test_rex.py View on Github external
def get_reference_commands(self, version):
        commands = []
        commands.append(rex.Comment(''))
        commands.append(rex.Comment('Commands from package rextest-%s' % version))
        commands.append(rex.Setenv('REZ_REXTEST_VERSION', version))
        commands.append(rex.Setenv('REZ_REXTEST_BASE', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REZ_REXTEST_ROOT', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REXTEST_ROOT', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REXTEST_VERSION', version))
        commands.append(rex.Setenv('REXTEST_MAJOR_VERSION', version.split('.')[0]))
        commands.append(rex.Setenv('REXTEST_DIRS', '%s/rextest/%s/%s/bin' % (self.release_path, version, version)))
        commands.append(rex.Alias('rextest', 'foobar'))
        return commands
github nerdvegas / rez / tests / test_rex.py View on Github external
def get_reference_commands(self, version):
        commands = []
        commands.append(rex.Comment(''))
        commands.append(rex.Comment('Commands from package rextest-%s' % version))
        commands.append(rex.Setenv('REZ_REXTEST_VERSION', version))
        commands.append(rex.Setenv('REZ_REXTEST_BASE', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REZ_REXTEST_ROOT', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REXTEST_ROOT', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REXTEST_VERSION', version))
        commands.append(rex.Setenv('REXTEST_MAJOR_VERSION', version.split('.')[0]))
        commands.append(rex.Setenv('REXTEST_DIRS', '%s/rextest/%s/%s/bin' % (self.release_path, version, version)))
        commands.append(rex.Alias('rextest', 'foobar'))
        return commands
github nerdvegas / rez / tests / test_rex.py View on Github external
def get_reference_commands(self, version):
        commands = []
        commands.append(rex.Comment(''))
        commands.append(rex.Comment('Commands from package rextest-%s' % version))
        commands.append(rex.Setenv('REZ_REXTEST_VERSION', version))
        commands.append(rex.Setenv('REZ_REXTEST_BASE', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REZ_REXTEST_ROOT', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REXTEST_ROOT', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REXTEST_VERSION', version))
        commands.append(rex.Setenv('REXTEST_MAJOR_VERSION', version.split('.')[0]))
        commands.append(rex.Setenv('REXTEST_DIRS', '%s/rextest/%s/%s/bin' % (self.release_path, version, version)))
        commands.append(rex.Alias('rextest', 'foobar'))
        return commands
github nerdvegas / rez / tests / test_rex.py View on Github external
def get_reference_commands(self, version):
        commands = []
        commands.append(rex.Comment(''))
        commands.append(rex.Comment('Commands from package rextest-%s' % version))
        commands.append(rex.Setenv('REZ_REXTEST_VERSION', version))
        commands.append(rex.Setenv('REZ_REXTEST_BASE', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REZ_REXTEST_ROOT', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REXTEST_ROOT', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REXTEST_VERSION', version))
        commands.append(rex.Setenv('REXTEST_MAJOR_VERSION', version.split('.')[0]))
        commands.append(rex.Setenv('REXTEST_DIRS', '%s/rextest/%s/%s/bin' % (self.release_path, version, version)))
        commands.append(rex.Alias('rextest', 'foobar'))
        return commands
github nerdvegas / rez / tests / test_rex.py View on Github external
def get_reference_commands(self, version):
        commands = []
        commands.append(rex.Comment(''))
        commands.append(rex.Comment('Commands from package rextest-%s' % version))
        commands.append(rex.Setenv('REZ_REXTEST_VERSION', version))
        commands.append(rex.Setenv('REZ_REXTEST_BASE', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REZ_REXTEST_ROOT', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REXTEST_ROOT', '%s/rextest/%s' % (self.release_path, version)))
        commands.append(rex.Setenv('REXTEST_VERSION', version))
        commands.append(rex.Setenv('REXTEST_MAJOR_VERSION', version.split('.')[0]))
        commands.append(rex.Setenv('REXTEST_DIRS', '%s/rextest/%s/%s/bin' % (self.release_path, version, version)))
        commands.append(rex.Alias('rextest', 'foobar'))
        return commands
github nerdvegas / rez / python / rez / cli / env_autowrappers.py View on Github external
dotfile = os.path.join(pkgdir, _g_dot_filename)

        resolver = rc.Resolver(rc.RESOLVE_MODE_LATEST, quiet=opts.quiet,
                               time_epoch=opts.time, build_requires=opts.build,
                               assume_dt=not opts.no_assume_dt,
                               caching=not opts.no_cache)

        result = resolver.guarded_resolve(d['pkgs'], no_os=opts.no_os, is_wrapper=True,
                                          meta_vars=["tools"], shallow_meta_vars=["tools"], dot_file=dotfile)

        if not result:
            sys.exit(1)

        import rez.rex
        commands = result[1]
        commands.append(rez.rex.Setenv("REZ_CONTEXT_FILE", contextfile))

        # TODO: support other shells
        script = rez.rex.interpret(commands, shell='bash')

        with open(contextfile, 'w') as f:
            f.write(script)

        # extract the tools from the context file, create the alias scripts
        tools = []
        f = open(contextfile, 'r')
        lines = f.read().strip().split('\n')
        for l in lines:
            if l.startswith("export REZ_META_SHALLOW_TOOLS="):
                toks = l.strip().split("'")[1].split()
                for tok in toks:
                    toks2 = tok.split(':')