jaraco.windows provides the os.symlink and os.readlink functions.
	Monkey-patch the os module to include them if not present.
425644
def patch_os_module():
	
	if not hasattr(os, 'symlink'):
		os.symlink = symlink
		os.path.islink = islink
	if not hasattr(os, 'readlink'):
		os.readlink = readlink
656540
def EmitLibSymlinks(env, symlinks, libnode, **kw):
    """"""
    Verbose = False

    # nodes involved in process... all symlinks + library
    nodes = list(set([ x for x,y in symlinks ] + [libnode]))

    clean_targets = kw.get('clean_targets', [])
    if not SCons.Util.is_List(clean_targets):
        clean_targets = [ clean_targets ]

    for link, linktgt in symlinks:
        env.SideEffect(link, linktgt)
        if(Verbose):
            print("EmitLibSymlinks: SideEffect(%r,%r)" % (link.get_path(), linktgt.get_path()))
        clean_list = [x for x in nodes if x != linktgt]
        env.Clean(list(set([linktgt] + clean_targets)), clean_list)
        if(Verbose):
            print("EmitLibSymlinks: Clean(%r,%r)" % (linktgt.get_path(), [x.get_path() for x in clean_list]))
1127785
def symlink_list(load):
    '''
    
    '''
    if 'env' in load:
        # "env" is not supported; Use "saltenv".
        load.pop('env')

    ret = {}
    if load['saltenv'] not in __opts__['file_roots'] and '__env__' not in __opts__['file_roots']:
        return ret

    if 'prefix' in load:
        prefix = load['prefix'].strip('/')
    else:
        prefix = ''

    symlinks = _file_lists(load, 'links')
    return dict([(key, val)
                 for key, val in six.iteritems(symlinks)
                 if key.startswith(prefix)])
275937
def make_links(current_cn):
    '''
        
    '''
    if not os.path.isfile(CURRENT_CERTIFICATE_PATH):
        target = '{}/{}.crt'.format(CERTIFICATES_PATH, current_cn)
        print 'Create symlink {} -> {}'.format(CURRENT_CERTIFICATE_PATH,
                                               target)
        os.symlink(target, CURRENT_CERTIFICATE_PATH)

    if not os.path.isfile(CURRENT_PRIVATE_KEY_PATH):
        target = '{}/{}.key'.format(CERTIFICATES_PATH, current_cn)
        print 'Create symlink {} -> {}'.format(CURRENT_PRIVATE_KEY_PATH,
                                               target)
        os.symlink(target, CURRENT_PRIVATE_KEY_PATH)
1153001
def create_symlinks(d):
    """"""
    data = loadJson(d)
    outDir = prepare_output(d)

    unseen = data["pages"].keys()
    while len(unseen) > 0:
        latest = work = unseen[0]
        while work in unseen:
            unseen.remove(work)
            if "prev" in data["pages"][work]:
                work = data["pages"][work]["prev"]
    print("Latest page: %s" % (latest))

    order = []
    work = latest
    while work in data["pages"]:
        order.extend(data["pages"][work]["images"].values())
        if "prev" in data["pages"][work]:
            work = data["pages"][work]["prev"]
        else:
            work = None
    order.reverse()

    for i, img in enumerate(order):
        os.symlink(os.path.join('..', img), os.path.join(outDir, '%05i_%s' % (i, img)))
967878
def need_to_create_symlink(directory, checksums, filetype, symlink_path):
    """"""
    # If we don't have a symlink path, we don't need to create a symlink
    if symlink_path is None:
        return False

    pattern = NgdConfig.get_fileending(filetype)
    filename, _ = get_name_and_checksum(checksums, pattern)
    full_filename = os.path.join(directory, filename)
    symlink_name = os.path.join(symlink_path, filename)

    if os.path.islink(symlink_name):
        existing_link = os.readlink(symlink_name)
        if full_filename == existing_link:
            return False

    return True
423248
def post_link_hook(linker, bb)
      basic_name = get_basic_name(linker, bb)
      symlink_lib_to(basic_name, bb)
    end
635988
def symlink(target, link, target_is_directory=False):
	
	target_is_directory = (
		target_is_directory or
		_is_target_a_directory(link, target)
	)
	# normalize the target (MS symlinks don't respect forward slashes)
	target = os.path.normpath(target)
	handle_nonzero_success(
		api.CreateSymbolicLink(link, target, target_is_directory))
769092
def symlink(self, source, dest):
        
        dest = self._adjust_cwd(dest)
        self._log(DEBUG, 'symlink(%r, %r)' % (source, dest))
        if type(source) is unicode:
            source = source.encode('utf-8')
        self._request(CMD_SYMLINK, source, dest)
1075879
def _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, soname_func):
    
    Verbose = False

    if Verbose:
        print("_versioned_lib_symlinks: libnode={:r}".format(libnode.get_path()))
        print("_versioned_lib_symlinks: version={:r}".format(version))

    if sys.platform.startswith('openbsd'):
        # OpenBSD uses x.y shared library versioning numbering convention
        # and doesn't use symlinks to backwards-compatible libraries
        if Verbose:
            print("_versioned_lib_symlinks: return symlinks={:r}".format(None))
        return None

    linkdir = libnode.get_dir()
    if Verbose:
        print("_versioned_lib_symlinks: linkdir={:r}".format(linkdir.get_path()))

    name = name_func(env, libnode, version, prefix, suffix)
    if Verbose:
        print("_versioned_lib_symlinks: name={:r}".format(name))

    soname = soname_func(env, libnode, version, prefix, suffix)

    link0 = env.fs.File(soname, linkdir)
    link1 = env.fs.File(name, linkdir)

    # We create direct symlinks, not daisy-chained.
    if link0 == libnode:
        # This enables SHLIBVERSION without periods (e.g. SHLIBVERSION=1)
        symlinks = [ (link1, libnode) ]
    else:
        # This handles usual SHLIBVERSION, i.e. '1.2', '1.2.3', etc.
        symlinks = [ (link0, libnode), (link1, libnode) ]

    if Verbose:
        print("_versioned_lib_symlinks: return symlinks={:r}".format(SCons.Tool.StringizeLibSymlinks(symlinks)))

    return symlinks
560825
function getProgramDir(programFile) {
    const info = programFile.query_info('standard::', Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null);
    if (info.get_is_symlink()) {
      const symlinkFile = programFile.get_parent().resolve_relative_path(info.get_symlink_target());
      return symlinkFile.get_parent();
    } else {
      return programFile.get_parent();
    }
  }
156135
def symlink_list(self, load):
        '''
        
        '''
        if 'env' in load:
            # "env" is not supported; Use "saltenv".
            load.pop('env')

        if not salt.utils.stringutils.is_hex(load['saltenv']) \
                and load['saltenv'] not in self.envs():
            return {}
        if 'prefix' in load:
            prefix = load['prefix'].strip('/')
        else:
            prefix = ''
        symlinks = self._file_lists(load, 'symlinks')
        return dict([(key, val)
                     for key, val in six.iteritems(symlinks)
                     if key.startswith(prefix)])
144729
def symlink(target, linkname):
    
    target = os.path.abspath(target)
    linkname = os.path.abspath(linkname)
    if not os.path.exists(target):
        raise ValueError("target {} not found".format(target))

    link_dir = os.path.dirname(linkname)
    if not os.path.exists(link_dir):
        os.makedirs(link_dir)

    run(['ln', '-s', '-f', target, linkname])
    return linkname
192106
public static int symLink(String target, String linkname) throws IOException{
    String cmd = "ln -s " + target + " " + linkname;
    Process p = Runtime.getRuntime().exec(cmd, null);
    int returnVal = -1;
    try{
      returnVal = p.waitFor();
    } catch(InterruptedException e){
      //do nothing as of yet
    }
    return returnVal;
  }
450801
def mklink():
	
	from optparse import OptionParser
	parser = OptionParser(usage="usage: %prog [options] link target")
	parser.add_option(
		'-d', '--directory',
		help="Target is a directory (only necessary if not present)",
		action="store_true")
	options, args = parser.parse_args()
	try:
		link, target = args
	except ValueError:
		parser.error("incorrect number of arguments")
	symlink(target, link, options.directory)
	sys.stdout.write("Symbolic link created: %(link)s --> %(target)s\n" % vars())
951377
private void visit_OP_SYMLINK() throws IOException {
    visitTxId();
    if (!LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
      v.visitInt(EditsElement.LENGTH);
    }
    v.visitStringUTF8( EditsElement.SOURCE);
    v.visitStringUTF8( EditsElement.DESTINATION);
    if (LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
      v.visitLong(EditsElement.MTIME);
      v.visitLong(EditsElement.ATIME);
    } else {
      v.visitStringUTF8(EditsElement.MTIME);
      v.visitStringUTF8(EditsElement.ATIME);
    }
    // PERMISSION_STATUS
    v.visitEnclosingElement(EditsElement.PERMISSION_STATUS);

    v.visitStringText( EditsElement.USERNAME);
    v.visitStringText( EditsElement.GROUPNAME);
    v.visitShort(      EditsElement.FS_PERMISSIONS);

    v.leaveEnclosingElement();
  }
1097302
def generate(env):
    """"""
    link.generate(env)

    if env['PLATFORM'] == 'hpux':
        env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared -fPIC')

    # __RPATH is set to $_RPATH in the platform specification if that
    # platform supports it.
    env['RPATHPREFIX'] = '-Wl,-rpath='
    env['RPATHSUFFIX'] = ''
    env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}'

    # OpenBSD doesn't usually use SONAME for libraries
    use_soname = not sys.platform.startswith('openbsd')
    link._setup_versioned_lib_variables(env, tool = 'gnulink', use_soname = use_soname)
    env['LINKCALLBACKS'] = link._versioned_lib_callbacks()

    # For backward-compatibility with older SCons versions
    env['SHLIBVERSIONFLAGS'] = SCons.Util.CLVar('-Wl,-Bsymbolic')