mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
Generated by com2ann (slightly patched to avoid also converting assignment type annotations, which require Python 3.6), followed by some manual whitespace adjustment, and six fixes for runtime issues: - def __init__(self, token: Token, parent: Optional[Node]) -> None: + def __init__(self, token: Token, parent: "Optional[Node]") -> None: -def main(options: argparse.Namespace) -> NoReturn: +def main(options: argparse.Namespace) -> "NoReturn": -def fetch_request(url: str, callback: Any, **kwargs: Any) -> Generator[Callable[..., Any], Any, None]: +def fetch_request(url: str, callback: Any, **kwargs: Any) -> "Generator[Callable[..., Any], Any, None]": -def assert_server_running(server: subprocess.Popen[bytes], log_file: Optional[str]) -> None: +def assert_server_running(server: "subprocess.Popen[bytes]", log_file: Optional[str]) -> None: -def server_is_up(server: subprocess.Popen[bytes], log_file: Optional[str]) -> bool: +def server_is_up(server: "subprocess.Popen[bytes]", log_file: Optional[str]) -> bool: - method_kwarg_pairs: List[FuncKwargPair], + method_kwarg_pairs: "List[FuncKwargPair]", Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
23 lines
704 B
Python
23 lines
704 B
Python
import os
|
|
import pwd
|
|
import sys
|
|
|
|
def check_venv(filename: str) -> None:
|
|
try:
|
|
import django
|
|
import ujson
|
|
import zulip
|
|
django
|
|
ujson
|
|
zulip
|
|
except ImportError:
|
|
print("You need to run %s inside a Zulip dev environment." % (filename,))
|
|
user_id = os.getuid()
|
|
user_name = pwd.getpwuid(user_id).pw_name
|
|
if user_name != 'vagrant' and user_name != 'zulipdev':
|
|
print("If you are using Vagrant, you can `vagrant ssh` to enter the Vagrant guest.")
|
|
else:
|
|
print("You can `source /srv/zulip-py3-venv/bin/activate` "
|
|
"to enter the Zulip development environment.")
|
|
sys.exit(1)
|