-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile.vars
162 lines (135 loc) · 6.05 KB
/
Makefile.vars
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# 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."
PYTHON_VER ?= python3.8
PYTHON_EXE = $(shell echo $(PYTHON_VER) | sed "s/\.//")
SYS_PIP = "pip3.8"
$(info "PYTHON_VER is $(PYTHON_VER).")
ifeq ($(shell echo $(PYTHON_VER) | head -c 8),python3.)
PYTHON_VER := $(shell echo $(PYTHON_VER) | sed 's/\(python3\.[0-9]*\).*/\1/')
MINOR_VER = $(shell echo $(PYTHON_VER) | sed 's/python3\.//')
ifeq ($(shell test $(MINOR_VER) -lt 8; echo $$?),0)
$(error "$(VER_ERR_MSG)")
endif
EXT_ENV_INSTALL = ext-env-pip-install
SYS_PIP := $(shell which pip$(shell echo $(PYTHON_VER) | sed "s/python//g"))
else
$(error "$(VER_ERR_MSG)")
endif
PYTHON_H ?= $(shell ls /usr/include/$(PYTHON_VER)/Python.h 2>/dev/null || ls /usr/local/include/$(PYTHON_VER)/Python.h 2>/dev/null || find /usr/local/$(PYTHON_EXE)/include/$(PYTHON_VER)* -name Python.h 2>/dev/null || find /opt/rh/rh-$(PYTHON_EXE)/root/usr/include/$(PYTHON_VER)* -name Python.h 2>/dev/null || find /Library/Frameworks/Python.framework/Versions/*/include/$(PYTHON_VER)* -name Python.h 2>/dev/null)
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
SYS_PYTHON ?= $(shell ls /usr/bin/$(PYTHON_VER) 2>/dev/null || ls /usr/local/bin/$(PYTHON_VER) 2>/dev/null || ls /usr/local/$(PYTHON_EXE)/bin/$(PYTHON_VER) 2>/dev/null || ls /opt/rh/$(PYTHON_EXE)/root/usr/bin/$(PYTHON_VER) 2>/dev/null || ls /opt/rh/rh-$(PYTHON_EXE)/root/usr/bin/$(PYTHON_VER) 2>/dev/null || ls /Library/Frameworks/Python.framework/Versions/*/bin/$(PYTHON_VER) 2>/dev/null)
else
SYS_PYTHON ?= $(shell which $(PYTHON_VER))
endif
ifeq ($(SYS_PYTHON),)
$(error "Error: Need python version >= 3.8")
else
$(info "SYS_PYTHON is $(SYS_PYTHON).")
endif
HADOOP_HOME ?= /usr/lib/hadoop
##############################
# Location of the virtual environment
##############################
BLD_DIR := $(ROOT)/build
BLD_DIR_ENV := $(BLD_DIR)/env
BLD_DIR_BIN := $(BLD_DIR_ENV)/bin
THIRDPARTY_DIR := $(ROOT)/ext/thirdparty
THIRDPARTY_JS_DIR := $(THIRDPARTY_DIR)/js
STATIC_DIR := $(BLD_DIR)/static
##############################
# ENV_PYTHON is the Python installed in the virtual environment. App
# installation should always use the ENV_PYTHON.
##############################
ENV_PYTHON := $(BLD_DIR_ENV)/bin/$(notdir $(SYS_PYTHON))
ENV_PYTHON_VERSION = $(shell $(ENV_PYTHON) -c 'import sys; print ("python%d.%d"% sys.version_info[:2])')
$(info "ENV_PYTHON is $(ENV_PYTHON).")
$(info "SYS_PIP is $(SYS_PIP).")
##############################
# 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
ENV_PIP := $(ENV_PYTHON) $(BLD_DIR_BIN)/pip
$(info "ENV_PIP is $(ENV_PIP).")
PIP_MODULES := \
cryptography==3.3.2 \
future==0.18.2 \
lockfile==0.8 \
python-daemon==1.5.1 \
pytz==2021.1 \
filelock==3.0.12 \
djangorestframework==3.9.4
##############################
# 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 := $(ROOT)/desktop/core/requirements.txt
REQUIREMENT_DOT_FILE := $(ROOT)/desktop/core/.requirements
NAVOPTAPI_WHL := $(ROOT)/desktop/core/wheels/navoptapi-1.0.0-py3-none-any.whl
##############################
# 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
endif