Skip to content

Commit

Permalink
Update build scripts to use python3
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Mullins committed Aug 30, 2019
1 parent 06e5c39 commit 7f4783d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
24 changes: 12 additions & 12 deletions .build_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("..");

Expand Down
4 changes: 2 additions & 2 deletions .get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def is_tool(name):
check_output([cmd, "git"])
return True
except:
return False;
return False

version = "UNKNOWN"

Expand All @@ -28,4 +28,4 @@ def is_tool(name):
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:])))
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: python
python:
- '2.7'
- '3.4'
sudo: false
cache:
directories:
Expand All @@ -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
Expand Down Expand Up @@ -38,4 +38,4 @@ deploy:
keep_history: true
on:
repo: sidoh/esp8266_milight_hub
tags: true
tags: true
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions web/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10

0 comments on commit 7f4783d

Please sign in to comment.