parameters: (self, version, installed_dir)
docstring: Symlinks the binaries in the 'installed_dir' to the 'link_dir.
docstring_summary: Symlinks the binaries in the 'installed_dir' to the 'link_dir.
docstring_tokens: Symlinks the binaries in the installed_dir to the link_dir .
function: def symlink_version(self, version, installed_dir):
          """Symlinks the binaries in the 'installed_dir' to the 'link_dir.'"""
          try:
              os.makedirs(self.link_dir)
          except OSError as exc:
              if exc.errno == errno.EEXIST and os.path.isdir(self.link_dir):
                  pass
              else:
                  raise
  
          for executable in os.listdir(os.path.join(installed_dir, "bin")):
  
              executable_name, executable_extension = os.path.splitext(executable)
              link_name = "{}-{}{}".format(executable_name, version, executable_extension)
  
              try:
                  executable = os.path.join(installed_dir, "bin", executable)
                  executable_link = os.path.join(self.link_dir, link_name)
                  if os.name == "nt":
                      # os.symlink is not supported on Windows, use a direct method instead.
                      def symlink_ms(source, link_name):
                          """Provides symlink for Windows."""
                          import ctypes
                          csl = ctypes.windll.kernel32.CreateSymbolicLinkW
                          csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
                          csl.restype = ctypes.c_ubyte
                          flags = 1 if os.path.isdir(source) else 0
                          if csl(link_name, source.replace("/", "\\"), flags) == 0:
                              raise ctypes.WinError()
                      os.symlink = symlink_ms
                  os.symlink(executable, executable_link)
              except OSError as exc:
                  if exc.errno == errno.EEXIST:
                      pass
                  else:
                      raise
function_tokens: def symlink_version ( self , version , installed_dir ) : try : os . makedirs ( self . link_dir ) except OSError as exc : if exc . errno == errno . EEXIST and os . path . isdir ( self . link_dir ) : pass else : raise for executable in os . listdir ( os . path . join ( installed_dir , "bin" ) ) : executable_name , executable_extension = os . path . splitext ( executable ) link_name = "{}-{}{}" . format ( executable_name , version , executable_extension ) try : executable = os . path . join ( installed_dir , "bin" , executable ) executable_link = os . path . join ( self . link_dir , link_name ) if os . name == "nt" : # os.symlink is not supported on Windows, use a direct method instead. def symlink_ms ( source , link_name ) : """Provides symlink for Windows.""" import ctypes csl = ctypes . windll . kernel32 . CreateSymbolicLinkW csl . argtypes = ( ctypes . c_wchar_p , ctypes . c_wchar_p , ctypes . c_uint32 ) csl . restype = ctypes . c_ubyte flags = 1 if os . path . isdir ( source ) else 0 if csl ( link_name , source . replace ( "/" , "\\" ) , flags ) == 0 : raise ctypes . WinError ( ) os . symlink = symlink_ms os . symlink ( executable , executable_link ) except OSError as exc : if exc . errno == errno . EEXIST : pass else : raise