| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- # Licensed to Cloudera, Inc. under one
- # or more contributor license agreements. See the NOTICE file
- # distributed with this work for additional information
- # regarding copyright ownership. Cloudera, Inc. licenses this file
- # to you under the Apache License, Version 2.0 (the
- # "License"); you may not use this file except in compliance
- # with the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- #
- # Public (SDK) Makefile variables. It requires the following to be defined:
- # ROOT
- # Points to the root of the Hue installation.
- # From here, we can include $(ROOT)/Makefile.vars
- # to access various
- #
- SHELL := /bin/bash
- ##############################
- # 1. Check for python-dev
- # 2. Locate the system Python
- ##############################
- # If we're an installed Makefile, allow the build to override
- # some things. This allows the install to prepopulate
- # SYS_PYTHON, in particular.
- ifneq ($(wildcard $(ROOT)/Makefile.buildvars),)
- include $(ROOT)/Makefile.buildvars
- endif
- VER_ERR_MSG = "Variable PYTHON_VER is $(PYTHON_VER) but it only supports >= python3.8. If not set, defaults to python3.8."
- # Major rewrite to support multi-python environments.
- PYTHON_VERSIONS ?= python3.8 python3.9 python3.10 python3.11
- PYTHON_VER ?= python3.11
- ifeq ($(filter $(PYTHON_VER), $(PYTHON_VERSIONS)),)
- $(error PYTHON_VER ($(PYTHON_VER)) is not in PYTHON_VERSIONS ($(PYTHON_VERSIONS)))
- endif
- ##############################
- # Location of the virtual environment
- ##############################
- BLD_DIR := $(ROOT)/build
- # Default case for Python 3.11
- ifndef BLD_DIR_ENV
- ifeq ($(PYTHON_VER),python3.11)
- BLD_DIR_ENV := $(BLD_DIR)/env
- else
- BLD_DIR_ENV := $(BLD_DIR)/venvs/$(PYTHON_VER)
- endif
- endif
- ifdef INSTALL_DIR
- INST_DIR := $(INSTALL_DIR)/build
- ifeq ($(BLD_DIR_ENV),"$(BLD_DIR)/env")
- INST_DIR_ENV := $(INST_DIR)/env
- else
- INST_DIR_ENV := $(INST_DIR)/venvs/$(PYTHON_VER)
- endif
- endif
- BLD_DIR_BIN := $(BLD_DIR_ENV)/bin
- # Adds detection and configuration for python3.8 through python3.11.
- # Sets up per-version BLD_DIR_ENV and INST_DIR_ENV variables.
- # Introduces version-specific requirement file generation via generate_requirements.py.
- SYS_PYTHON := $(shell IFS=:; for p in $$PATH; do if [ -x "$$p/$(PYTHON_VER)" ]; then echo "$$p/$(PYTHON_VER)"; break; fi; done)
- SYS_PIP := $(shell echo $(SYS_PYTHON) | sed "s/python\([0-9][0-9]*\.[0-9][0-9]*\)$$/pip\1/")
- ENV_PYTHON := $(shell echo $(BLD_DIR_BIN)/$(shell basename $(SYS_PYTHON)))
- ENV_PIP := $(shell echo $(BLD_DIR_BIN)/$(shell basename $(SYS_PIP)))
- PYTHON_INCLUDE_DIR := $(shell $(SYS_PYTHON) -c "import sysconfig; print(sysconfig.get_path('include'))" 2>/dev/null)
- PYTHON_H := $(shell [ -f "$(PYTHON_INCLUDE_DIR)/Python.h" ] && echo "$(PYTHON_INCLUDE_DIR)/Python.h" || echo "")
- PYTHON_VERSION = $(shell $(SYS_PYTHON) -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
- $(info "PYTHON_VER is $(PYTHON_VER).")
- ifeq ($(shell echo $(PYTHON_VER) | head -c 8),python3.)
- MINOR_VER = $(shell $(SYS_PYTHON) --version | sed -E 's/Python [0-9]+\.([0-9]+).*/\1/')
- ifeq ($(shell test $(MINOR_VER) -lt 8; echo $$?),0)
- $(error "$(VER_ERR_MSG)")
- endif
- EXT_ENV_INSTALL = ext-env-pip-install
- else
- $(error "$(VER_ERR_MSG)")
- endif
- ifndef SKIP_PYTHONDEV_CHECK
- ifeq ($(PYTHON_H),)
- $(error "Error: must have python development packages for $(PYTHON_VER). Could not find Python.h. Please install $(PYTHON_VER)-devel or $(PYTHON_VER)-dev")
- endif
- endif
- ifeq ($(SYS_PYTHON),)
- $(error "Error: Need python version >= 3.8")
- endif
- HADOOP_HOME ?= /usr/lib/hadoop
- THIRDPARTY_DIR := $(ROOT)/ext/thirdparty
- THIRDPARTY_JS_DIR := $(THIRDPARTY_DIR)/js
- STATIC_DIR := $(BLD_DIR)/static
- ##############################
- # ENV_EASY_INSTALL uses the easy_install script installed in the virtual
- # environment. It must be called as an argument to ENV_PYTHON so the
- # problem of the shebang being truncated at 80 characters in most kernels
- # doesn't arise.
- ##############################
- ENV_EASY_INSTALL := $(ENV_PYTHON) $(BLD_DIR_BIN)/easy_install
- $(info "ENV_PYTHON is $(ENV_PYTHON).")
- $(info "ENV_PIP is $(ENV_PIP).")
- $(info "BLD_DIR_BIN is $(BLD_DIR_BIN).")
- ##############################
- # This version is substituted through to the tarballs and packages.
- ##############################
- DESKTOP_VERSION := $(shell $(SYS_PYTHON) <(cat $(ROOT)/VERSION; echo print '(VERSION)'))
- MAVEN_VERSION = $(DESKTOP_VERSION)-SNAPSHOT
- ##############################
- # Path to the desktop dbproxy jar
- ##############################
- DB_PROXY_JAR := $(ROOT)/desktop/libs/librdbms/java-lib/dbproxy-1.0.jar
- ################################################
- # Internationalization
- ################################################
- PYBABEL := $(ROOT)/build/env/bin/pybabel
- ##############################
- # Path to files for pip requirements
- ##############################
- REQUIREMENT_FILE := $(shell $(SYS_PYTHON) $(ROOT)/desktop/core/generate_requirements.py)
- REQUIREMENT_TEST_FILE := $(ROOT)/desktop/core/test_requirements.txt
- REQ_DIR := $(dir $(REQUIREMENT_FILE))
- REQ_BASE := $(notdir $(REQUIREMENT_FILE))
- REQ_BASE_NOEXT := $(basename $(REQ_BASE))
- NAVOPTAPI_WHL := $(ROOT)/desktop/core/wheels/navoptapi-1.0.0-py3-none-any.whl
- LOCAL_PY_BASE := $(shell $(SYS_PYTHON) -m site --user-base)
- LOCAL_PY_BIN := $(LOCAL_PY_BASE)/bin
- export PATH := $(PATH):$(LOCAL_PY_BIN)
- ##############################
- # Set specific versions for some libraries
- ##############################
- PIP_VERSION := 22.2.2
- VIRTUAL_ENV_RELOCATABLE_VERSION := 0.0.1
- ##############################
- # Set specific versions for some libraries
- ##############################
- ifeq ($(PYTHON_VER),python3.8)
- PIP_VERSION := 22.2.2
- VIRTUAL_ENV_VERSION := 20.24.4
- VIRTUAL_ENV_RELOCATABLE_VERSION := 0.0.1
- REQUIREMENT_PPC64LE_FILE := $(ROOT)/desktop/core/requirements_ppc64le.txt
- else ifeq ($(PYTHON_VER),python3.9)
- PIP_VERSION := 22.2.2
- VIRTUAL_ENV_VERSION := 20.19.0
- VIRTUAL_ENV_RELOCATABLE_VERSION := 0.0.1
- REQUIREMENT_PPC64LE_FILE := $(ROOT)/desktop/core/requirements_ppc64le_py39.txt
- else ifeq ($(PYTHON_VER),python3.10)
- PIP_VERSION := 22.2.2
- VIRTUAL_ENV_VERSION := 20.24.4
- VIRTUAL_ENV_RELOCATABLE_VERSION := 0.0.1
- else ifeq ($(PYTHON_VER),python3.11)
- PIP_VERSION := 22.2.2
- VIRTUAL_ENV_VERSION := 20.24.4
- VIRTUAL_ENV_RELOCATABLE_VERSION := 0.0.1
- endif
- RELOCATABLE := $(shell which virtualenv-make-relocatable)
|