HUE-8737 [core] Initial python 3 support

Review Request #13941 - Created May 10, 2019 and updated

Ying Chen
hue
ying-django
HUE-8737
hue
jgauthier, johan, ranade, romain, weixia
commit 4c2d9b41d85025929557782240a41fc81a527132
Author: Ying Chen <yingchen@cloudera.com>
Date:   Fri May 10 08:41:29 2019 -0700

    [core] make Hue can be built on both py2 and py3

:100644 100644 ee789b3... 6f0aee2... M	Makefile.vars
1. Not done yet, need to check py3 Python.h and create requirement.txt for both python version.
2. allow python version to 2.7 and 3.5
3. tested header files: "/usr/include/python2.7/Python.h", " /usr/include/python3.5m/Python.h", "/opt/rh/rh-python36/root/usr/include/python3.6m/Python.h"
4. tested exe file: /opt/rh/rh-python36/root/usr/bin/python3.6
  • 0
  • 0
  • 14
  • 1
  • 15
Description From Last Updated
  1. Nice!

    How about keeping it shorter by reusing the same logic as before?

  2. Makefile.vars (Diff revision 1)
     
     

    IS HUE_PYTHON_VERSION a new variable of the official one used in other parts already?

  3. Makefile.vars (Diff revision 1)
     
     

    This looks incorrect as not in sync with master?

  4. Makefile.vars (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Would it make sense to default
    HUE_PYTHON_VERSION to 2.7
    and have everything else in common?

    Final check would be 2.7 or > 3.5.

  5. 
      
  1. 
      
  2. Makefile.vars (Diff revision 2)
     
     

    Could we make it Python >= 3.5, not just 3.5?

  3. 
      
  1. 
      
  2. Makefile.vars (Diff revision 2)
     
     

    Do reverse

    ifeq ($(PYTHON_VER),python2.7)

    else ifeq ($(PYTHON_VER),python3.5)

    else ifeq ($(PYTHON_VER),)

    else

  3. Makefile.vars (Diff revision 2)
     
     

    I think you should split just like above.

  4. Makefile.vars (Diff revision 2)
     
     

    I think this should be the first if condition.

  5. 
      
  1. 
      
  2. Makefile.vars (Diff revision 3)
     
     

    if PYTHON_VER is not set:
    PYTHON_VER = python2.7

    if PYTHON_VER == python2.7:
    ...
    else if [[ $string >= "python3.5" ]]; then
    ...
    else:
    Python $PYTHON_VER not supported. Requires 2.7 or >= 3.5.

  3. Makefile.vars (Diff revision 3)
     
     
     
     
     
     
     
     
     
     
     

    Could revert if as cf. above PYTHON_H would be empty if we did not match ay .h?

  4. Makefile.vars (Diff revision 3)
     
     

    "Please install python$(PYTHON_VER)-devel"

    ?

  5. 
      
  1. 
      
  2. Makefile.vars (Diff revision 4)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Could this be changed in just:

    PYTHON_VER = ${PYTHON_VER:-python2.7}
    PYTHON_EXE = "${PYTHON_VER/./}"

    PYTHON_H ?= $(shell ls /usr/include/${PYTHON_VER}/Python.h 2>/dev/null || ls /usr/local/${PYTHON_EXE}/include/${PYTHON_VER}/Python.h 2>/dev/null || ls /opt/rh/${PYTHON_EXE}/root/usr/include/${PYTHON_VER}/Python.h 2>/dev/null)

    Then check [PYTHON_VER == python2.7 or PYTHON_VER >= python3.5 ]

    1. My Python 3.5 header path: /usr/include/python3.5m/Python.h

  3. Makefile.vars (Diff revision 4)
     
     
     
     
     

    Might become not needed if we do above check on the version

    1. Preventing system has python2.x header files, but it starts to run python3.x?

  4. 
      
  1. 
      
  2. Makefile.vars (Diff revision 6)
     
     

    nit:

    "If it's not set, default as python2.7!"
    -->
    "If not set, defaults to python2.7."

  3. Makefile.vars (Diff revision 6)
     
     

    Is python27 expected or should be generic?

  4. 
      
  1. 
      
  2. Makefile.vars (Diff revision 7)
     
     

    Still two python27 hardcoded?

  3. 
      
Review request changed

Testing Done:

   
  1. Not done yet, need to check py3 Python.h and create requirement.txt for both python version.
   
  1. allow python version to 2.7 and 3.5
   
  1. tested header files: "/usr/include/python2.7/Python.h", " /usr/include/python3.5m/Python.h", "/opt/rh/rh-python36/root/usr/include/python3.6m/Python.h"
  +
  1. tested exe file: /opt/rh/rh-python36/root/usr/bin/python3.6

Diff:

Revision 8 (+22 -6)

Show changes

  1. 
      
  2. 
      
Loading...