This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch v2-8-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit bcf340667fe43e630d421400428c327ba074e87f Author: Jarek Potiuk <[email protected]> AuthorDate: Sun Feb 11 19:36:24 2024 +0100 Fix remote installation from git (#37340) Having hatch_build.py in dev is not a good idea because hatch_build is removed from the archive produced by git archive and effectively it means that when you install Airflow from git URL it cannot find hatch_build.py (cherry picked from commit 82f1f3879a166e751ef93a23bd502c76a823ef2f) --- .dockerignore | 1 + Dockerfile.ci | 2 +- dev/hatch_build.py => hatch_build.py | 6 +++--- pyproject.toml | 6 +++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index 5240d438d7..ae3496d802 100644 --- a/.dockerignore +++ b/.dockerignore @@ -53,6 +53,7 @@ !.github !empty !Dockerfile +!hatch_build.py # This folder is for you if you want to add any packages to the docker context when you build your own # docker image. most of other files and any new folder you add will be excluded by default diff --git a/Dockerfile.ci b/Dockerfile.ci index e915d6a51f..73b7bd5313 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -1179,7 +1179,7 @@ COPY generated/* ${AIRFLOW_SOURCES}/generated/ COPY constraints/* ${AIRFLOW_SOURCES}/constraints/ COPY LICENSE ${AIRFLOW_SOURCES}/LICENSE COPY dev/airflow_pre_installed_providers.txt ${AIRFLOW_SOURCES}/dev/airflow_pre_installed_providers.txt -COPY dev/hatch_build.py ${AIRFLOW_SOURCES}/dev/hatch_build.py +COPY hatch_build.py ${AIRFLOW_SOURCES}/ COPY --from=scripts install_airflow.sh /scripts/docker/ # The goal of this line is to install the dependencies from the most current pyproject.toml from sources diff --git a/dev/hatch_build.py b/hatch_build.py similarity index 97% rename from dev/hatch_build.py rename to hatch_build.py index afbf35df63..844bd39dca 100644 --- a/dev/hatch_build.py +++ b/hatch_build.py @@ -32,7 +32,7 @@ log = logging.getLogger(__name__) log_level = logging.getLevelName(os.getenv("CUSTOM_AIRFLOW_BUILD_LOG_LEVEL", "INFO")) log.setLevel(log_level) -AIRFLOW_ROOT_PATH = Path(__file__).parent.parent.resolve() +AIRFLOW_ROOT_PATH = Path(__file__).parent.resolve() GENERATED_PROVIDERS_DEPENDENCIES_FILE = AIRFLOW_ROOT_PATH / "generated" / "provider_dependencies.json" DEV_DIR_PATH = AIRFLOW_ROOT_PATH / "dev" PREINSTALLED_PROVIDERS_FILE = DEV_DIR_PATH / "airflow_pre_installed_providers.txt" @@ -84,7 +84,7 @@ class CustomBuild(BuilderInterface[BuilderConfig, PluginManager]): run(cmd, cwd=work_dir.as_posix(), check=True, shell=True) def get_version_api(self) -> dict[str, Callable[..., str]]: - """Custom build target for standard package preparation.""" + """Get custom build target for standard package preparation.""" return {"standard": self.build_standard} def build_standard(self, directory: str, artifacts: Any, **build_data: Any) -> str: @@ -149,7 +149,7 @@ class CustomBuildHook(BuildHookInterface[BuilderConfig]): def initialize(self, version: str, build_data: dict[str, Any]) -> None: """ - This occurs immediately before each build. + Initialize hook immediately before each build. Any modifications to the build data will be seen by the build target. """ diff --git a/pyproject.toml b/pyproject.toml index 42dea4c650..a8c4adf269 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1218,13 +1218,13 @@ features = [] path = "airflow/__init__.py" [tool.hatch.build.targets.wheel.hooks.custom] -path = "./dev/hatch_build.py" +path = "./hatch_build.py" [tool.hatch.build.hooks.custom] -path = "./dev/hatch_build.py" +path = "./hatch_build.py" [tool.hatch.build.targets.custom] -path = "./dev/hatch_build.py" +path = "./hatch_build.py" [tool.hatch.build.targets.sdist] include = [
