فهرست منبع

HUE-8737 [core] Enable make apps with py3 on Mac and fix read file in pth.py
* export PYTHON_VER=python3.5 (or above for make apps in py3)

Ying Chen 6 سال پیش
والد
کامیت
91d754a2ba
3فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 0 1
      Makefile
  2. 2 2
      Makefile.vars
  3. 4 1
      tools/app_reg/pth.py

+ 0 - 1
Makefile

@@ -145,7 +145,6 @@ $(BLD_DIR_ENV)/stamp:
 desktop: parent-pom
 # END DEV ONLY >>>>
 desktop: virtual-env
-	@echo ">>>-----> desktop: "
 	@$(MAKE) -C desktop
 
 

+ 2 - 2
Makefile.vars

@@ -56,12 +56,12 @@ else
   $(error "$(VER_ERR_MSG)")
 endif
 
-PYTHON_H ?= $(shell ls /usr/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)
+PYTHON_H ?= $(shell ls /usr/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")
   endif
-  SYS_PYTHON ?= $(shell ls /usr/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)
+  SYS_PYTHON ?= $(shell ls /usr/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

+ 4 - 1
tools/app_reg/pth.py

@@ -28,6 +28,9 @@ import common
 
 if sys.version_info[0] > 2:
   from builtins import object
+  open_file = open
+else:
+  open_file = file
 
 LOG = logging.getLogger(__name__)
 PTH_FILE = 'hue.pth'
@@ -58,7 +61,7 @@ class PthFile(object):
 
   def _read(self):
     if os.path.exists(self._path):
-      self._entries = set(file(self._path).read().split('\n'))
+      self._entries = set(open_file(self._path).read().split('\n'))
 
   def add(self, app):
     """