Explorar el Código

Hue [py3] Improve Hue makefiles to support python 3.8
1. Use pip as python package manger.
2. Use "requirements.txt" for python packages listing.
3. Perform one of a kind package installation.

Prakash Ranade hace 3 años
padre
commit
1120348a1f
Se han modificado 5 ficheros con 39 adiciones y 20 borrados
  1. 16 7
      Makefile
  2. 6 0
      Makefile.sdk
  3. 6 3
      Makefile.vars
  4. 1 2
      desktop/core/Makefile
  5. 10 8
      desktop/core/requirements.txt

+ 16 - 7
Makefile

@@ -130,11 +130,20 @@ endif
 ###################################
 virtual-env: $(BLD_DIR_ENV)/stamp
 $(BLD_DIR_ENV)/stamp:
-	@echo "--- Creating virtual environment at $(BLD_DIR_ENV)"
-	$(SYS_PYTHON) $(VIRTUAL_BOOTSTRAP) \
-		$(VIRTUALENV_OPTS) --system-site-packages $(BLD_DIR_ENV)
-	@touch $@
-	@echo "--- $(BLD_DIR_ENV) ready"
+	@if [ "$(PYTHON_VER)" = "python2.7" ]; then \
+	  echo "--- Creating virtual environment at $(BLD_DIR_ENV)"; \
+	  $(SYS_PYTHON) $(VIRTUAL_BOOTSTRAP) \
+	    $(VIRTUALENV_OPTS) --system-site-packages $(BLD_DIR_ENV); \
+	  touch $@; \
+	  echo "--- $(BLD_DIR_ENV) ready"; \
+	else \
+	  echo "--- Creating virtual environment at $(BLD_DIR_ENV)"; \
+	  $(SYS_PYTHON) -m pip install --upgrade pip; \
+	  $(SYS_PIP) install virtualenv; \
+	  virtualenv $(BLD_DIR_ENV); \
+	  touch $@; \
+	  echo "--- $(BLD_DIR_ENV) ready"; \
+	fi
 
 .PHONY: virtual-env
 
@@ -177,7 +186,7 @@ INSTALL_CORE_FILES = \
 	tools/virtual-bootstrap \
 	tools/enable-python27.sh \
 	tools/relocatable.sh \
-	VERS* LICENSE* README* webpack-stats*.json
+	VERS* LICENSE* README*
 
 .PHONY: install
 install: virtual-env install-check install-core-structure install-desktop install-apps install-env
@@ -191,7 +200,7 @@ install-check:
 
 .PHONY: install-core-structure
 install-core-structure:
-	@echo --- Installing core source structure...
+	@echo --- Installing core source structure in $(INSTALL_DIR)...
 	@mkdir -p $(INSTALL_DIR)
 	@tar cf - $(INSTALL_CORE_FILES) | tar -C $(INSTALL_DIR) -xf -
 	@# Add some variables to Makefile to make sure that our virtualenv

+ 6 - 0
Makefile.sdk

@@ -120,6 +120,10 @@ ext-env-pip-install:
 	@echo '--- Finished $(REQUIREMENT_FILE) into virtual-env'
 	@$(ENV_PIP) install $(NAVOPTAPI_WHL)
 	@echo '--- Finished $(NAVOPTAPI_WHL) into virtual-env'
+	@echo '--- Installing ext-py3 into virtual-env via $(ENV_PIP)'
+	@$(ENV_PIP) install -e $(BOTO_PKG)
+	@echo '--- Finished installing ext-py3 into virtual-env via $(ENV_PIP)'
+	@touch $@
 
 #
 # ext-eggs
@@ -129,10 +133,12 @@ ext-env-pip-install:
 .PHONY: ext-eggs
 ext-eggs: $(EXT_PY_EGG_TARGETS)
 $(EXT_PY_EGG_TARGETS):
+ifeq ($(PYTHON_VER),python2.7)
 	@echo '--- Building egg for $(CUR_EXT_PY)'
 	@cd ext-py/$(CUR_EXT_PY) && $(ENV_PYTHON) \
 	  -c '__import__("setuptools.sandbox").sandbox.run_setup("setup.py", __import__("sys").argv[1:])' \
 	  bdist_egg
+endif
 	@mkdir -p $(@D) && touch $@
 
 #

+ 6 - 3
Makefile.vars

@@ -37,24 +37,26 @@ ifneq ($(wildcard $(ROOT)/Makefile.buildvars),)
 endif
 
 
-VER_ERR_MSG = "Variable PYTHON_VER is $(PYTHON_VER) but it only supports python2.7 or >= python3.5. If not set, defaults to python2.7."
+VER_ERR_MSG = "Variable PYTHON_VER is $(PYTHON_VER) but it only supports python2.7 or >= python3.8. If not set, defaults to python2.7."
 
 PYTHON_VER ?= python2.7
 PYTHON_EXE = $(shell echo $(PYTHON_VER) | sed "s/\.//")
+SYS_PIP = "pip2.7"
 
 $(info "PYTHON_VER is $(PYTHON_VER).")
 
 ifeq ($(PYTHON_VER),python2.7)
   $(info "Python 2 module install of desktop/ext-py")
   EXT_ENV_INSTALL = ext-env-install
+  SYS_PIP := $(shell which pip2.7)
 else ifeq ($(shell echo $(PYTHON_VER) | head -c 8),python3.)
-  $(info "Python 3 module install via pip")
   PYTHON_VER := $(shell echo $(PYTHON_VER) | head -c 9)
   MINOR_VER = $(shell echo -n $(PYTHON_VER) | tail -c 1)
-  ifeq ($(shell test $(MINOR_VER) -lt 5; echo $$?),0)
+  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
@@ -140,3 +142,4 @@ PYBABEL := $(ROOT)/build/env/bin/pybabel
 ##############################
 REQUIREMENT_FILE := $(ROOT)/desktop/core/requirements.txt
 NAVOPTAPI_WHL := $(ROOT)/desktop/core/wheels/navoptapi-1.0.0-py3-none-any.whl
+BOTO_PKG := $(ROOT)/desktop/core/ext-py3/boto-2.49.0

+ 1 - 2
desktop/core/Makefile

@@ -35,8 +35,7 @@ default::
 # 	Install app into the virtual environment.
 #
 .PHONY: env-install
-env-install: compile $(EXT_ENV_INSTALL)
+env-install: $(EXT_ENV_INSTALL) compile
 	@echo '--- Installing $(APP_NAME) into virtual-env'
 	@echo '--- env-install: EXT_ENV_INSTALL: $(EXT_ENV_INSTALL)'
 	@$(ENV_PYTHON) setup.py develop -N -q
-

+ 10 - 8
desktop/core/requirements.txt

@@ -5,11 +5,11 @@ Babel==2.5.1
 boto==2.46.1
 # boto3==1.17.41  # Last Py2 is 1.17
 celery[redis]==5.1.2
-cffi==1.14.5
+cffi==1.15.0
 channels==3.0.3
 channels-redis==3.2.0
 configobj==5.0.6
-cryptography==3.3.2
+cryptography==36.0.1
 django-auth-ldap==2.3.0
 Django==3.2.12
 daphne==3.0.2
@@ -38,10 +38,9 @@ jdcal==1.0.1
 kazoo==2.8.0
 kerberos==1.3.0
 lockfile==0.12.2
-lxml==4.6.5
+lxml==4.5.0
 Mako==1.1.4
 Markdown==3.1
-mysqlclient==1.4.6
 nose==1.3.7
 openpyxl==2.6.2
 pandas==1.1.5
@@ -51,18 +50,17 @@ protobuf==3.17.0
 pyformance==0.3.2
 pylint==2.6.0
 pylint-django==2.3.0
-pysaml2>=4.5.0
 pytest==6.0.2
 pytest-django==3.10.0
-python-dateutil==2.8.1
+python-dateutil==2.8.2
 python-daemon==2.2.4
 python-ldap==3.1.0
 python-oauth2==1.1.0
 pytidylib==0.3.2
-pytz==2021.1
+pytz==2021.3
 PyJWT==1.7.1
 PyYAML==5.4.1
-requests>=2.25.1
+requests==2.27.1
 requests-kerberos==0.12.0
 rsa==4.7
 sasl==0.2.1  # Move to https://pypi.org/project/sasl3/ ?
@@ -76,3 +74,7 @@ thrift-sasl==0.4.2
 git+https://github.com/gethue/django-babel.git
 git+https://github.com/gethue/django-mako.git
 werkzeug==2.0.1  # Should remove it here and from devtools.mk
+pysaml2==5.0.0
+djangosaml2==0.18.0
+django-utils-six==2.0
+six==1.16.0