Procházet zdrojové kódy

Update build scripts to use python3

Chris Mullins před 6 roky
rodič
revize
7f4783df01
5 změnil soubory, kde provedl 19 přidání a 18 odebrání
  1. 12 12
      .build_web.py
  2. 2 2
      .get_version.py
  3. 3 3
      .travis.yml
  4. 1 1
      platformio.ini
  5. 1 0
      web/.nvmrc

+ 12 - 12
.build_web.py

@@ -21,24 +21,24 @@ def build_web():
         print("Attempting to build webpage...")
         try:
             if platform.system() == "Windows":
-                print check_output(["npm.cmd", "install", "--only=dev"])
-                print check_output(["node_modules\\.bin\\gulp.cmd"])
+                print(check_output(["npm.cmd", "install", "--only=dev"]))
+                print(check_output(["node_modules\\.bin\\gulp.cmd"]))
             else:
-                print check_output(["npm", "install"])
-                print check_output(["node_modules/.bin/gulp"])
+                print(check_output(["npm", "install"]))
+                print(check_output(["node_modules/.bin/gulp"]))
             copyfile("build/index.html.gz.h", "../dist/index.html.gz.h")
         except OSError as e:
-            print "Encountered error OSError building webpage:", e
+            print("Encountered error OSError building webpage:", e)
             if e.filename:
-                print "Filename is", e.filename
-            print "WARNING: Failed to build web package. Using pre-built page."
+                print("Filename is", e.filename)
+            print("WARNING: Failed to build web package. Using pre-built page.")
         except CalledProcessError as e:
-            print e.output
-            print "Encountered error CalledProcessError building webpage:", e
-            print "WARNING: Failed to build web package. Using pre-built page."
+            print(e.output)
+            print("Encountered error CalledProcessError building webpage:", e)
+            print("WARNING: Failed to build web package. Using pre-built page.")
         except Exception as e:
-            print "Encountered error", type(e).__name__, "building webpage:", e
-            print "WARNING: Failed to build web package. Using pre-built page."
+            print("Encountered error", type(e).__name__, "building webpage:", e)
+            print("WARNING: Failed to build web package. Using pre-built page.")
         finally:
             os.chdir("..");
 

+ 2 - 2
.get_version.py

@@ -14,7 +14,7 @@ def is_tool(name):
         check_output([cmd, "git"])
         return True
     except:
-        return False;
+        return False
 
 version = "UNKNOWN"
 
@@ -28,4 +28,4 @@ if is_tool("git"):
             pass
         pass
 
-sys.stdout.write("-DMILIGHT_HUB_VERSION=%s %s" % (version, ' '.join(sys.argv[1:])))
+sys.stdout.write("-DMILIGHT_HUB_VERSION=%s %s" % (version.decode('utf-8'), ' '.join(sys.argv[1:])))

+ 3 - 3
.travis.yml

@@ -1,6 +1,6 @@
 language: python
 python:
-- '2.7'
+- '3.4'
 sudo: false
 cache:
   directories:
@@ -10,7 +10,7 @@ env:
 before_install:
   - nvm install $NODE_VERSION
 install:
-- pip install -U platformio
+- pip3 install -U platformio
 - platformio lib install
 - cd web && npm install && cd ..
 - npm install -g swagger-cli redoc-cli
@@ -38,4 +38,4 @@ deploy:
     keep_history: true
     on:
       repo: sidoh/esp8266_milight_hub
-      tags: true
+      tags: true

+ 1 - 1
platformio.ini

@@ -29,7 +29,7 @@ extra_scripts =
 test_ignore = remote
 upload_speed = 460800
 build_flags =
-  !python .get_version.py
+  !python3 .get_version.py
   # For compatibility with WebSockets 2.1.4 and v2.4 of the Arduino SDK
   -D USING_AXTLS
   -D MQTT_MAX_PACKET_SIZE=250

+ 1 - 0
web/.nvmrc

@@ -0,0 +1 @@
+10