equal
deleted
inserted
replaced
10 platform-specific details from the core. |
10 platform-specific details from the core. |
11 """ |
11 """ |
12 |
12 |
13 from i18n import gettext as _ |
13 from i18n import gettext as _ |
14 from demandload import * |
14 from demandload import * |
15 demandload(globals(), "cStringIO errno popen2 re shutil sys tempfile") |
15 demandload(globals(), "cStringIO errno getpass popen2 re shutil sys tempfile") |
16 demandload(globals(), "os threading time") |
16 demandload(globals(), "os threading time") |
17 |
17 |
18 # used by parsedate |
18 # used by parsedate |
19 defaultdateformats = ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', |
19 defaultdateformats = ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', |
20 '%a %b %d %H:%M:%S %Y') |
20 '%a %b %d %H:%M:%S %Y') |
508 try: |
508 try: |
509 return sys.getwindowsversion()[3] == 1 |
509 return sys.getwindowsversion()[3] == 1 |
510 except AttributeError: |
510 except AttributeError: |
511 return os.name == 'nt' and 'command' in os.environ.get('comspec', '') |
511 return os.name == 'nt' and 'command' in os.environ.get('comspec', '') |
512 |
512 |
|
513 getuser_fallback = None |
|
514 |
|
515 def getuser(): |
|
516 '''return name of current user''' |
|
517 try: |
|
518 return getpass.getuser() |
|
519 except ImportError: |
|
520 return getuser_fallback and getuser_fallback() |
|
521 raise util.Abort(_('user name not available - set USERNAME ' |
|
522 'environment variable')) |
|
523 |
513 # Platform specific variants |
524 # Platform specific variants |
514 if os.name == 'nt': |
525 if os.name == 'nt': |
515 demandload(globals(), "msvcrt") |
526 demandload(globals(), "msvcrt") |
516 nulldev = 'NUL:' |
527 nulldev = 'NUL:' |
517 |
528 |