equal
deleted
inserted
replaced
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """ |
18 """ |
19 |
19 |
20 """ |
20 """ |
21 import os |
21 import os |
22 import pwd |
22 import sys |
23 |
23 |
24 from logilab.common.pytest import PyTester |
24 from logilab.common.pytest import PyTester |
25 |
25 |
26 def getlogin(): |
26 def getlogin(): |
27 """avoid usinng os.getlogin() because of strange tty / stdin problems |
27 """avoid usinng os.getlogin() because of strange tty / stdin problems |
28 (man 3 getlogin) |
28 (man 3 getlogin) |
29 Another solution would be to use $LOGNAME, $USER or $USERNAME |
29 Another solution would be to use $LOGNAME, $USER or $USERNAME |
30 """ |
30 """ |
|
31 if sys.platform == 'win32': |
|
32 return os.environ.get('USERNAME') or 'cubicweb' |
|
33 import pwd |
31 return pwd.getpwuid(os.getuid())[0] |
34 return pwd.getpwuid(os.getuid())[0] |
32 |
35 |
33 |
36 |
34 def update_parser(parser): |
37 def update_parser(parser): |
35 login = getlogin() |
38 login = getlogin() |