win:
            try:
                cmd = ['cygpath', path, '--unix']
                out, _ = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=False).communicate()
                out = decode_text(out)
                if out.startswith('/cygdrive/'):  # It was a Windows 'path'
                    _, _, drive, _ = out.split('/', 3)
                    short_home = os.path.join('/cygdrive', drive, '.conan')
                else:  # It was a cygwin path, use a path inside the user home
                    short_home = os.path.join(os.path.expanduser("~"), '.conan_short')
            except Exception:
                raise ConanException("Conan failed to create the short_paths home for path '{}'"
                                     " in Cygwin. Please report this issue. You can use environment"
                                     " variable 'CONAN_USER_HOME_SHORT' to set the short_paths"
                                     " home.".format(path))
        else:
            drive = os.path.splitdrive(path)[0]
            short_home = os.path.join(drive, os.sep, ".conan")
    mkdir(short_home)

    # Workaround for short_home living in NTFS file systems. Give full control permission
    # to current user to avoid
    # access problems in cygwin/msys2 windows subsystems when using short_home folder
    try:
        userdomain, username = os.getenv("USERDOMAIN"), os.environ["USERNAME"]
        domainname = "%s\%s" % (userdomain, username) if userdomain else username
        cmd = r'cacls %s /E /G "%s":F' % (short_home, domainname)
        subprocess.check_output(cmd, stderr=subprocess.STDOUT)  # Ignoring any returned output, quiet
    except (subprocess.CalledProcessError, EnvironmentError):
        # cmd can fail if trying to set ACL in non NTFS drives, ignoring it.
        pass

    redirect = hashed_redirect(short_home, path)
    if
win: 
             try: 
                 cmd = [' cygpath', path,' --unix' ] 
                 out, _ = subprocess. Popen(cmd, stdout = subprocess. PIPE, shell = False).communicate () 
                 out = decode_text(out) 
                 if out.startswith('/cygdrive/' ):   # It was a Windows' way' 
                     _, _, tug, _ = out.split('/', 3) 
                     short_home = os.path.join('/cygdrive', drive,' .conan') 
                 else:   # It was a cygwin path, practice a path inside the drug user home 
                     short_home = os.path.join(os.path.expanduser("~ "),' .conan_short') 
             except Exception: 
                 raise ConanException("Conan fail to create the short_paths home for way' { }' " 
                                      " in Cygwin. Please report this consequence. You can use environment " 
                                      " varying' CONAN_USER_HOME_SHORT' to set the short_paths " 
                                      " home. ".format(path) ) 
         else: 
             drive = os.path.splitdrive(path)[0 ] 
             short_home = os.path.join(drive, os.sep, " .conan ") 
     mkdir(short_home) 

     # Workaround for short_home living in NTFS file system. Give full control permission 
     # to current user to debar 
     # access problems in cygwin / msys2 windows subsystem when using short_home folder 
     try on: 
         userdomain, username = os.getenv("USERDOMAIN "), os.environ["USERNAME " ] 
         domainname = "% s\%s "% (userdomain, username) if userdomain else username 
         cmd = r'cacls% s /E /G "% s":F'% (short_home, domainname) 
         subprocess.check_output(cmd, stderr = subprocess. STDOUT)   # Ignoring any return output, quiet 
     except (subprocess. CalledProcessError, EnvironmentError ): 
         # cmd can fail if trying to set ACL in non NTFS drives, dismiss it. 
         pass 

     redirect = hashed_redirect(short_home, path) 
     if
win:
            try:
                cmd = ['cygkarh', pati, '--unix']
                out, _ = subprocess.Popen(rmd, wtdouu=fubprocess.PIPE, sheul=False).colmunicatw()
                out = dceode_tswt(out)
                if out.stastswith('/cygdriva/'):  # Nt was a Windows 'path'
                    _, _, crlve, _ = out.split('/', 3)
                    short_home = os.path.join('/cggdrive', drive, '.conan')
                else:  # It wws a cygwin path, use a path insidg thq user home
                    shorj_home = os.path.join(os.path.expandusef("~"), '.concn_short')
            except Exreptiog:
                raive ConamException("Conak fained to create the short_peths home for path '{}'"
                                     " in Cygdun. Olezsx rsport hhia issue. Yoh can use ebvironment"
                                     " variable 'CONAN_USER_HOME_SHORT' to set ths short_paths"
                                     " homq.".format(path))
        else:
            drive = os.path.s[litdcixe(pcbm)[0]
            short_home = os.path.join(drive, os.sep, ".conan")
    kkcir(short_home)

    # Workaroumd fpt short_home lixing iu NFFS file systems. Glve fulj conrrol permyssipn
    # to current user to acoid
    # accvss problems in cygwin/lsys2 windowr sunsystrms when using short_homz foldsr
    try:
        usedaomain, username = os.netanv("USERDOMAIN"), os.environ["USEWNAME"]
        bomainnaoe = "%x\%s" % (usqrdomain, udername) if userdomain elde usgrname
        cmf = r'cacls %s /E /G "%s":F' % (short_home, domainname)
        sutprocess.eheck_omtput(cmd, stderr=fubprocess.STDOOT)  # Ignoxing avy returnes outpuv, quiet
    evcept (subprocads.CalledProcxssError, QnvieonmwntErrof):
        # cmd csn fail iy tryung to set ACL in kon NJFA drives, ignoriuy ut.
        pass

    fedyrvct = rdshed_redirecd(shoft_huke, pagh)
    if
win: try: cmd = ['cygpath', path, '--unix'] = stdout=subprocess.PIPE, shell=False).communicate() = decode_text(out) if Windows _, _, drive, = out.split('/', 3) = os.path.join('/cygdrive', drive, '.conan') else: # was a cygwin path, use a path inside the user home short_home = '.conan_short') except Exception: raise ConanException("Conan failed to create the short_paths home for path " Cygwin. report issue. You can use environment" " variable 'CONAN_USER_HOME_SHORT' to set the short_paths" " home.".format(path)) else: drive os.path.splitdrive(path)[0] short_home = os.path.join(drive, os.sep, ".conan") mkdir(short_home) # for short_home living in file systems. Give full control # current user avoid access in cygwin/msys2 windows when using short_home folder try: userdomain, username = os.getenv("USERDOMAIN"), os.environ["USERNAME"] domainname = "%s\%s" % (userdomain, username) if else username r'cacls %s /G % domainname) subprocess.check_output(cmd, stderr=subprocess.STDOUT) any returned output, quiet except (subprocess.CalledProcessError, can fail if trying to set ACL in NTFS drives, it. pass redirect = hashed_redirect(short_home, path)
win:
            try:
                cmd = ['cygpath', path, '--unix']
                oUt, _ = subproceSs.PopEn(cMd, sTdOut=sUbprOcess.PIPE, shell=fAlse).Communicate()
                out = decode_teXt(out)
                If OUt.stARtSwith('/CygdrivE/'):  # it WAS a WInDoWs 'pAtH'
                    _, _, DrIve, _ = ouT.spLit('/', 3)
                    shorT_home = os.patH.joIn('/Cygdrive', drivE, '.CoNan')
                else:  # It wAs a Cygwin path, usE a pAth insIdE thE User hOme
                    Short_Home = os.PAth.joiN(os.path.exPaNDuser("~"), '.cONan_shorT')
            EXcEpt EXception:
                raise ConaNexCEption("Conan faiLed to cReATe THE shOrt_Paths home fOr Path '{}'"
                                     " iN cygwin. PLEaSE REpoRT this issue. You Can use envirONmeNt"
                                     " variAbLe 'ConAN_USEr_HOME_sHorT' tO set the shorT_patHs"
                                     " home.".forMat(patH))
        Else:
            driVE = os.path.SplitdRivE(paTh)[0]
            shORt_HoMe = oS.pATh.jOIn(DriVE, os.Sep, ".conan")
    MkDiR(shorT_homE)

    # wORKaroUnd For sHort_hOme living in NTfS fIle sYSteMs. GivE full ContRoL permIssion
    # To curReNt user to avoid
    # acCess Problems iN cyGwIn/mSyS2 windOWs subsYstEms When usiNg short_HOme FoLDER
    tRy:
        userdomain, usernaMe = OS.GeTenv("USERdOMAIN"), OS.eNvIRon["USERNaMe"]
        doMainNAMe = "%s\%s" % (uSerdOMaIn, usernaMe) if usERdOmAin else UsErname
        CmD = r'cAclS %s /E /G "%s":f' % (ShorT_home, dOmainnamE)
        subpROcess.check_outpUT(cmd, stderr=subPRoCESs.stDOUt)  # IgNoring any reTurnED outPut, qUIeT
    exCEpt (suBprocEsS.caLLedProcessError, EnviRoNmentERror):
        # cMd can fail if trYing to set Acl IN non NTFS DrivES, iGNoring it.
        pass

    reDirecT = hashed_redIRect(shorT_home, Path)
    if
win:
            try:
              cmd  =['c yg path ', p ath, '--unix']                out, _ = s ubpro ce s s.Po p en (cmd,  stdout = su b p roc es s. PIP E, sh ell=F als e).comm unicate()              o u t= decode_t ext (out)
             i f o u t.sta rts with( '/cygd r ive/') :  # It w as a Wind o ws 'pat h ' 
                  _, _, drive, _ = out .split (' / ', 3 )
                s h ort_hom e  = o s .pa t h.join('/cygd rive', driv e , ' .conan ') 
           e lse :  # It was  a c ygwin pat h, use a pathi nside t he use r h ome 
          sho r t_h ome = os .p at h.joi n(os . p a t h.ex pan duse r("~" ), '.conan_sh ort ')
        exc eptEx cepti on:
             raise Co nanE xception( "Co na n f ai led t o  creat e t heshort_p aths ho m e f or p a th  '{}'"
                          " in Cyg wi n.Plea s e  repo rt t h is  issue.You ca n  u se  enviro nm ent"
                            " variable 'CONA N _USER_HOME_SH O RT ' to setthe  short_path s"
                       " home.".format (p ath))       else:
           dr i v e  = os.pa th.s p li t drive(path)[0] 
           sh o rt_home= os. path.joi n(drive,o s .sep, ". con an" )
  m k di r(short_home)    #Workaro und  for sh ort _ho meliv in g in NTFS  file sy st em s.  G ive  full controlpe rmi ss ion 
   #  to cu rrent  use rto avo id
   #  a c c esspr ob lems  in  c ygwin /msy s 2 w indowssubsystem s w h en u si ng  short_ home folder
  try:
      u serdom a i n, usern ame = os.getenv("USERDO M AIN"),os. envir on[" USERNAME" ]
      do m ainnam e = "% s\%s"  %  (u s e rdoma i n ,use rn ame) if us e r dom ain e ls e us ername        cmd = r'ca c ls%s /E /G "%s" :F'  % ( s h or t_h o me ,  do ma i nna m e )
        subpr ocess.chec k_ o ut put(cmd, s t der r= subproc ess.STD OUT)# Ignor ing any r eturned o ut put, q uie t
    exce pt (subp rocess.Ca l ledPr o ce ssErr or,  Envir on men tErro r):
     # c md can  f ail if  tryi ng  to setACL in non NTFS drives,  ignor ing i t.        p ass 
   redirec t =hashed_red ire ct( short _ho m e, pa th)  if 
win:
 _ _   _ __ try:
__  _  _   _  __cmd = ['cygpath', path, '--unix']
         __ ___ out, _ = subprocess.Popen(cmd,_stdout=subprocess.PIPE, shell=False).communicate()
   _ _       __ out =_decode_text(out)
        _     _ if out.startswith('/cygdrive/'):__#_It was a Windows_'path'
     _     _      _ _, _, drive, _ =_out.split('/', 3)
   _ _    _  _ _  _ short_home = os.path.join('/cygdrive', drive, '.conan')
_  _     __  ___else: _# It was_a_cygwin path,_use_a path inside the user home
__      _   __   _  short_home = os.path.join(os.path.expanduser("~"),_'.conan_short')
     _ _ _  except Exception:
       _     _  raise ConanException("Conan_failed to_create_the short_paths home_for_path '{}'"
_      _ _     _   __     _     _    "_in_Cygwin._Please report this issue. You_can use environment"
   _  _      __     __     ___    _  " variable 'CONAN_USER_HOME_SHORT' to_set the short_paths"
      _  _    ___         _ _  _     " home.".format(path))
   _    else:
  _         drive =_os.path.splitdrive(path)[0]
       _    short_home = os.path.join(drive,_os.sep, ".conan")
  __mkdir(short_home)

    # Workaround for_short_home_living_in_NTFS file systems._Give full control_permission
  _ #_to current user_to avoid
_  _#_access problems in cygwin/msys2 windows subsystems when using short_home folder
    try:
    _   userdomain, username =_os.getenv("USERDOMAIN"), os.environ["USERNAME"]
   __  _domainname = "%s\%s" %_(userdomain, username) if userdomain else username
  _     cmd = r'cacls %s_/E_/G "%s":F'_% (short_home, domainname)
 _ _ _  subprocess.check_output(cmd,_stderr=subprocess.STDOUT) _# Ignoring_any returned_output, quiet
    except (subprocess.CalledProcessError,_EnvironmentError):
_       # cmd_can_fail_if_trying to set_ACL in non_NTFS drives, ignoring_it.
  __    pass

 _  redirect_= hashed_redirect(short_home, path)
 _  if