Fix http_status
The #includes made no sense and it was generating a file into the source
directory...
Change-Id: I37aa44f30b03f25f56026e46017e38a394cce38a
diff --git a/aos/externals/seasocks/gen_embedded.py b/aos/externals/seasocks/gen_embedded.py
index 4ebcb2a..d0fd603 100755
--- a/aos/externals/seasocks/gen_embedded.py
+++ b/aos/externals/seasocks/gen_embedded.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# This file is a modified version of the gen_embedded script included in the
# scripts directory of seasocks (version 1.1.2). It has been modified to
@@ -10,7 +10,14 @@
import os, os.path, sys
-o = open('embedded.h', 'w')
+output = sys.argv[1]
+assert output[0] == '"'
+assert output[-1] == '"'
+output = output[1:-1]
+
+if not os.path.exists(os.path.dirname(output)):
+ os.makedirs(os.path.dirname(output))
+o = open(output, 'w')
web = []
for root, dirs, files in os.walk("./www_defaults", topdown=False):
diff --git a/frc971/http_status/http_status.cc b/frc971/http_status/http_status.cc
index 6cdb303..e0ee5de 100644
--- a/frc971/http_status/http_status.cc
+++ b/frc971/http_status/http_status.cc
@@ -1,6 +1,4 @@
-#include "seasocks/PrintfLogger.h"
-#include "seasocks/WebSocket.h"
-#include "seasocks/Server.h"
+#include "frc971/http_status/http_status.h"
#include <iostream>
#include <sstream>
@@ -8,6 +6,8 @@
#include <thread>
#include <vector>
+#include "seasocks/Server.h"
+
#include "aos/linux_code/init.h"
#include "aos/common/logging/logging.h"
#include "aos/common/time.h"
@@ -17,7 +17,7 @@
#include "frc971/control_loops/claw/claw.q.h"
#include "frc971/control_loops/fridge/fridge.q.h"
-#include "frc971/http_status/http_status.h"
+#include "frc971/http_status/embedded.h"
namespace frc971 {
namespace http_status {
diff --git a/frc971/http_status/http_status.gyp b/frc971/http_status/http_status.gyp
index a0065db..410e8b9 100644
--- a/frc971/http_status/http_status.gyp
+++ b/frc971/http_status/http_status.gyp
@@ -11,12 +11,13 @@
'action_name': 'http_status_gen_embedded',
'inputs': [
'<!@(find ./www_defaults)',
+ '<(AOS)/externals/seasocks/gen_embedded.py',
],
'outputs': [
- '<(SHARED_INTERMEDIATE_DIR)/http_status/embedded.h',
+ '<(SHARED_INTERMEDIATE_DIR)/http_status/frc971/http_status/embedded.h',
],
'action': [
- 'python', '<(AOS)/externals/seasocks/gen_embedded.py', 'http_status', '<(_outputs)',
+ 'python', '<(AOS)/externals/seasocks/gen_embedded.py', '<(_outputs)',
],
},
],
diff --git a/frc971/http_status/http_status.h b/frc971/http_status/http_status.h
index 9ce8dcb..2f7497d 100644
--- a/frc971/http_status/http_status.h
+++ b/frc971/http_status/http_status.h
@@ -1,7 +1,3 @@
-#include "seasocks/PageHandler.h"
-#include "seasocks/PrintfLogger.h"
-#include "seasocks/StringUtil.h"
-
#include <iostream>
#include <memory>
#include <sstream>
@@ -10,16 +6,16 @@
#include <atomic>
#include <vector>
+#include "seasocks/PageHandler.h"
+#include "seasocks/PrintfLogger.h"
+#include "seasocks/StringUtil.h"
+#include "seasocks/WebSocket.h"
+
#include "aos/linux_code/init.h"
#include "aos/common/time.h"
#include "aos/common/util/phased_loop.h"
#include "aos/common/mutex.h"
-#include "frc971/control_loops/claw/claw.q.h"
-#include "frc971/control_loops/fridge/fridge.q.h"
-
-#include "frc971/http_status/embedded.h"
-
namespace frc971 {
namespace http_status {