turbaszek commented on code in PR #623:
URL: https://github.com/apache/airflow-site/pull/623#discussion_r917361209
##########
site.py:
##########
@@ -0,0 +1,233 @@
+from pathlib import Path
+import os
+import sys
+import argparse
+import subprocess
+from typing import Union, List, Optional, Mapping
+
+IMAGE_NAME="airflow-site"
+CONTAINER_NAME="airflow-site-c"
+SITE_DIST="landing-pages/dist"
+THEME_GEN="sphinx_airflow_theme/sphinx_airflow_theme/static/_gen"
+RunCommandResult = Union[subprocess.CompletedProcess,
subprocess.CalledProcessError]
+
+
+def run_command(cmd: List[str],
+ env: Optional[Mapping[str, str]] = None,
+ cwd: Optional[Path] = None,
+ input: Optional[str] = None,
+ check: bool = True,
+ **kwargs,
+)-> RunCommandResult:
+ workdir: str = str(cwd) if cwd else os.getcwd()
+ try:
+ cmd_env = os.environ.copy()
+ cmd_env.setdefault("HOME", str(Path.home()))
+ if env:
+ cmd_env.update(env)
+ return subprocess.run(cmd, input=input, check=check, env=cmd_env,
cwd=workdir, **kwargs)
+ except subprocess.CalledProcessError as ex:
+ if ex.stdout:
+ print(ex.stdout)
+ if ex.stderr:
+ print(ex.stderr)
+ return ex
+
+
+def check_docker_environment():
+ is_docker_env = False
+ docker_env_file = Path(".dockerenv")
+ if docker_env_file.exists():
+ is_docker_env = True
+ return is_docker_env
Review Comment:
```suggestion
return docker_env_file.exists()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]