2017-04-03 11:48:57 +02:00
|
|
|
import os
|
|
|
|
import pwd
|
2017-02-05 21:24:28 +01:00
|
|
|
import sys
|
|
|
|
|
python: Convert function type annotations to Python 3 style.
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>
2020-04-19 03:48:37 +02:00
|
|
|
def check_venv(filename: str) -> None:
|
2017-02-05 21:24:28 +01:00
|
|
|
try:
|
2017-10-15 04:19:37 +02:00
|
|
|
import django
|
2017-02-05 21:24:28 +01:00
|
|
|
import ujson
|
2017-10-15 04:19:37 +02:00
|
|
|
import zulip
|
2019-02-23 00:48:42 +01:00
|
|
|
django
|
|
|
|
ujson
|
|
|
|
zulip
|
2017-02-05 21:24:28 +01:00
|
|
|
except ImportError:
|
2020-06-10 06:41:04 +02:00
|
|
|
print(f"You need to run {filename} inside a Zulip dev environment.")
|
2017-04-03 11:48:57 +02:00
|
|
|
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:
|
2017-11-08 03:47:28 +01:00
|
|
|
print("You can `source /srv/zulip-py3-venv/bin/activate` "
|
|
|
|
"to enter the Zulip development environment.")
|
2017-02-05 21:24:28 +01:00
|
|
|
sys.exit(1)
|