2017-04-03 11:48:57 +02:00
|
|
|
import os
|
|
|
|
import pwd
|
2017-02-05 21:24:28 +01:00
|
|
|
import sys
|
|
|
|
|
2020-06-11 00:54:34 +02:00
|
|
|
|
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:
|
2020-08-11 21:03:52 +02:00
|
|
|
if os.path.basename(sys.prefix) != "zulip-py3-venv":
|
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:
|
2021-02-12 08:19:30 +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)
|