Retrieve path to locally installed Rscript or first in PATH.

    Prefers Rscript version installed via conda to a system version.
429380
def Rscript_cmd():
    
    rscript = which(os.path.join(get_bcbio_bin(), "Rscript"))
    if rscript:
        return rscript
    else:
        return which("Rscript")
565957
def _python_rpath(self):
        """"""
        # Windows virtualenv installation installs pip to the [Ss]cripts
        # folder. Here's a simple check to support:
        if sys.platform == 'win32':
            return os.path.join('Scripts', 'python.exe')
        return os.path.join('bin', 'python')
845398
def get_version(name, dirs=None, config=None):
    
    if dirs:
        p = _get_program_file(dirs)
    else:
        p = tz.get_in(["resources", "program_versions"], config)
    if p:
        with open(p) as in_handle:
            for line in in_handle:
                prog, version = line.rstrip().split(",")
                if prog == name and version:
                    return version
        raise KeyError("Version information not found for %s in %s" % (name, p))
491278
def sys_path(self):
        

        from .vendor.vistir.compat import JSONDecodeError
        current_executable = vistir.compat.Path(sys.executable).as_posix()
        if not self.python or self.python == current_executable:
            return sys.path
        elif any([sys.prefix == self.prefix, not self.is_venv]):
            return sys.path
        cmd_args = [self.python, "-c", "import json, sys; print(json.dumps(sys.path))"]
        path, _ = vistir.misc.run(cmd_args, return_object=False, nospin=True, block=True, combine_stderr=False, write_to_stdout=False)
        try:
            path = json.loads(path.strip())
        except JSONDecodeError:
            path = sys.path
        return path
1194847
def python_path(self, script):
        
        if not script:
            try:
                import __main__
                script = getfile(__main__)
            except Exception:  # pragma    nocover
                return
        script = os.path.realpath(script)
        if self.cfg.get('python_path', True):
            path = os.path.dirname(script)
            if path not in sys.path:
                sys.path.insert(0, path)
        return script
969706
def find(self, relpath, rsc=None, useFilepath=None):
        
        self.init()
        
        # load the default resource information
        if rsc is None:
            try:
                key = relpath.replace('\\', '/').split('/')[0]
                rsc = self.default(key)
            except IndexError:
                return ''
        
        # determine the filepath location
        relpath = os.path.normpath(nativestring(relpath))
        rscpath = self.resourcePath()
        
        if useFilepath is None:
            useFilepath = self.useFilepath()
        
        # return from the filesystem
        if useFilepath and rscpath:
            if rsc and isinstance(rsc, XResourceManager):
                return rsc.find(relpath, useFilepath=useFilepath)
            elif rsc:
                filepath = os.path.join(rscpath, rsc, relpath)
            else:
                filepath = os.path.join(rscpath, relpath)
            
            if os.path.exists(filepath):
                return filepath
        
        # return resource
        if isinstance(rsc, XResourceManager):
            return rsc.find(relpath, useFilepath=useFilepath)
        elif rsc:
            return ':{0}/{1}'.format(rsc, relpath.replace(os.path.sep, '/'))
        else:
            return ':{0}'.format(relpath.replace(os.path.sep, '/'))
1276014
def get_path(src):  # pragma: no cover
    
    res = None
    while not res:
        if res is False:
            print(colored('You must provide a path to an existing directory!', 'red'))
        print('You need a local clone or release of (a fork of) '
              'https://github.com/{0}'.format(src))
        res = input(colored('Local path to {0}: '.format(src), 'green', attrs=['blink']))
        if res and Path(res).exists():
            return Path(res).resolve()
        res = False
284718
def get_calling_file(file_path=None, result='name'):
    
    # Get full path of calling python script
    if file_path is None:
        path = inspect.stack()[1][1]
    else:
        path = file_path

    name = path.split('/')[-1].split('.')[0]
    if result == 'name':
        return name
    elif result == 'path':
        return path
    else:
        return path, name
79536
def get_version(path) -> str:
    
    if path and os.path.exists(path):
        with open(path) as pkg:
            package_dict = json.load(pkg)
            version = package_dict.get('version')
    else:
        version = 'not available'
    return version
1215717
def get_path():
    '''
    
    '''
    ret = salt.utils.stringutils.to_unicode(
        __utils__['reg.read_value'](
            'HKEY_LOCAL_MACHINE',
            'SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment',
            'PATH')['vdata']
    ).split(';')

    # Trim ending backslash
    return list(map(_normalize_dir, ret))
981684
def path(self):
        
        return "/".join([
            part
            for part in [
                self.version,
                self.qualifier,
            ]
            if part
        ])
706608
def rel_path(filename):
    
    return os.path.join(os.getcwd(), os.path.dirname(__file__), filename)
471147
function getSrcDirPath(projectInfo)
{
    let srcDir
    if(projectInfo.SourceDir){
        srcDir = path.normalize(path.join(projectInfo.ProjectPath, projectInfo.SourceDir))
    }
    return srcDir
}
273351
def _get_ericscript_path(self):
        
        es = utils.which(os.path.join(utils.get_bcbio_bin(), self.EXECUTABLE))
        return os.path.dirname(os.path.realpath(es))
215006
def getScriptLocation():
	""""""
	location = os.path.abspath("./")
	if __file__.rfind("/") != -1:
		location = __file__[:__file__.rfind("/")]
	return location
1283962
def get_version(path = Dir.pwd, options = {})
      rootdir = normalized_path(path)
      version = (options[:default]) ? options[:default] : FalkorLib.config[:versioning][:default]
      type    = (options[:type])    ? options[:type]    : FalkorLib.config[:versioning][:type]
      source  = (options[:source])  ? options[:source]  : FalkorLib.config[:versioning][:source][ type ]
      puts "type = '#{type}'"
      case type
      when 'file'
        versionfile = File.join( rootdir, source[:filename] )
        puts "versionfile = '#{versionfile}'"
        version = File.read( versionfile ).chomp if File.exist?( versionfile )
      when 'gem'
        getmethod = source[:getmethod ]
        version = eval( getmethod ) unless (getmethod.nil? || getmethod.empty?)
      when 'puppet_module'
        jsonfile = File.join( rootdir, source[:filename] )
        metadata = JSON.parse( IO.read( jsonfile ) )
        version  = metadata["version"]
      end
      version
    end
1172626
def _GetRelPath(self, filename):
		""""""
		assert filename.startswith(self.subdir), (filename, self.subdir)
		return filename[len(self.subdir):].lstrip(r"\/")