Mercurial > kallithea
changeset 8324:ea20850dda85
windows: fix import of posix-only pwd module in d83f41634d06 (Issue #367)
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 30 Mar 2020 16:23:37 +0200 |
parents | 2b8892f92b46 |
children | da39f9548758 |
files | kallithea/lib/utils2.py |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/utils2.py Fri Mar 20 20:16:43 2020 +0100 +++ b/kallithea/lib/utils2.py Mon Mar 30 16:23:37 2020 +0200 @@ -31,7 +31,6 @@ import datetime import json import os -import pwd import re import time import urllib.parse @@ -45,6 +44,12 @@ from kallithea.lib.vcs.utils.lazy import LazyProperty +try: + import pwd +except ImportError: + pass + + # mute pyflakes "imported but unused" assert ascii_bytes assert ascii_str @@ -331,7 +336,7 @@ prefix = urllib.parse.unquote(parsed_url.path.rstrip('/')) try: system_user = pwd.getpwuid(os.getuid()).pw_name - except Exception: # TODO: support all systems - especially Windows + except NameError: # TODO: support all systems - especially Windows system_user = 'kallithea' # hardcoded default value ... args = { 'scheme': parsed_url.scheme,