Mercurial > hg
comparison mercurial/util.py @ 3466:8b55c0ba8048
makes username mandatory
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 18 Oct 2006 22:24:03 +0200 |
parents | ec6f400cff4d |
children | bb44489b901f 3b07e223534b |
comparison
equal
deleted
inserted
replaced
3465:2d35a8d2b32d | 3466:8b55c0ba8048 |
---|---|
517 try: | 517 try: |
518 return sys.getwindowsversion()[3] == 1 | 518 return sys.getwindowsversion()[3] == 1 |
519 except AttributeError: | 519 except AttributeError: |
520 return os.name == 'nt' and 'command' in os.environ.get('comspec', '') | 520 return os.name == 'nt' and 'command' in os.environ.get('comspec', '') |
521 | 521 |
522 getuser_fallback = None | |
523 | |
524 def getuser(): | |
525 '''return name of current user''' | |
526 try: | |
527 return getpass.getuser() | |
528 except ImportError: | |
529 # import of pwd will fail on windows - try fallback | |
530 if getuser_fallback: | |
531 return getuser_fallback() | |
532 # raised if win32api not available | |
533 raise Abort(_('user name not available - set USERNAME ' | |
534 'environment variable')) | |
535 | |
536 # Platform specific variants | 522 # Platform specific variants |
537 if os.name == 'nt': | 523 if os.name == 'nt': |
538 demandload(globals(), "msvcrt") | 524 demandload(globals(), "msvcrt") |
539 nulldev = 'NUL:' | 525 nulldev = 'NUL:' |
540 | 526 |